Changeset 961 for trunk/source/processes/electromagnetic/lowenergy/src
- Timestamp:
- Apr 6, 2009, 12:21:12 PM (17 years ago)
- Location:
- trunk/source/processes/electromagnetic/lowenergy/src
- Files:
-
- 81 edited
-
G4AtomicDeexcitation.cc (modified) (1 diff)
-
G4AtomicShell.cc (modified) (1 diff)
-
G4AtomicTransitionManager.cc (modified) (3 diffs)
-
G4AugerData.cc (modified) (1 diff)
-
G4BremsstrahlungCrossSectionHandler.cc (modified) (1 diff)
-
G4BremsstrahlungParameters.cc (modified) (1 diff)
-
G4CompositeEMDataSet.cc (modified) (2 diffs)
-
G4CrossSectionChargeDecrease.cc (modified) (3 diffs)
-
G4CrossSectionChargeDecreasePartial.cc (modified) (9 diffs)
-
G4CrossSectionChargeIncrease.cc (modified) (4 diffs)
-
G4CrossSectionChargeIncreasePartial.cc (modified) (10 diffs)
-
G4CrossSectionElasticScreenedRutherford.cc (modified) (1 diff)
-
G4CrossSectionExcitationBorn.cc (modified) (2 diffs)
-
G4CrossSectionExcitationBornPartial.cc (modified) (4 diffs)
-
G4CrossSectionExcitationEmfietzoglou.cc (modified) (2 diffs)
-
G4CrossSectionExcitationEmfietzoglouPartial.cc (modified) (7 diffs)
-
G4CrossSectionExcitationMillerGreen.cc (modified) (5 diffs)
-
G4CrossSectionExcitationMillerGreenPartial.cc (modified) (13 diffs)
-
G4CrossSectionHandler.cc (modified) (1 diff)
-
G4CrossSectionIonisationBorn.cc (modified) (4 diffs)
-
G4CrossSectionIonisationBornElectron.cc (modified) (1 diff)
-
G4CrossSectionIonisationBornPartial.cc (modified) (4 diffs)
-
G4CrossSectionIonisationBornPartialElectron.cc (modified) (1 diff)
-
G4CrossSectionIonisationRudd.cc (modified) (6 diffs)
-
G4CrossSectionIonisationRuddPartial.cc (modified) (10 diffs)
-
G4CrossSectionKill.cc (modified) (1 diff)
-
G4DNACrossSectionDataSet.cc (modified) (1 diff)
-
G4DNAGenericIonsManager.cc (modified) (7 diffs)
-
G4DummyFinalState.cc (modified) (1 diff)
-
G4EMDataSet.cc (modified) (2 diffs)
-
G4FinalStateChargeDecrease.cc (modified) (12 diffs)
-
G4FinalStateChargeIncrease.cc (modified) (6 diffs)
-
G4FinalStateElasticBrennerZaider.cc (modified) (4 diffs)
-
G4FinalStateElasticScreenedRutherford.cc (modified) (5 diffs)
-
G4FinalStateExcitationBorn.cc (modified) (1 diff)
-
G4FinalStateExcitationEmfietzoglou.cc (modified) (1 diff)
-
G4FinalStateExcitationMillerGreen.cc (modified) (1 diff)
-
G4FinalStateIonisationBorn.cc (modified) (9 diffs)
-
G4FinalStateIonisationRudd.cc (modified) (24 diffs)
-
G4FinalStateKill.cc (modified) (1 diff)
-
G4FinalStateProduct.cc (modified) (4 diffs)
-
G4FluoTransition.cc (modified) (1 diff)
-
G4LinInterpolation.cc (modified) (1 diff)
-
G4LogLogInterpolation.cc (modified) (4 diffs)
-
G4LowEnergyBremsstrahlung.cc (modified) (1 diff)
-
G4LowEnergyCompton.cc (modified) (8 diffs)
-
G4LowEnergyGammaConversion.cc (modified) (1 diff)
-
G4LowEnergyIonisation.cc (modified) (2 diffs)
-
G4LowEnergyPhotoElectric.cc (modified) (1 diff)
-
G4LowEnergyPolarizedCompton.cc (modified) (8 diffs)
-
G4LowEnergyPolarizedRayleigh.cc (modified) (1 diff)
-
G4LowEnergyRayleigh.cc (modified) (1 diff)
-
G4PenelopeBremsstrahlung.cc (modified) (1 diff)
-
G4PenelopeBremsstrahlungAngular.cc (modified) (1 diff)
-
G4PenelopeBremsstrahlungContinuous.cc (modified) (12 diffs)
-
G4PenelopeCompton.cc (modified) (19 diffs)
-
G4PenelopeIonisation.cc (modified) (1 diff)
-
G4PenelopePhotoElectric.cc (modified) (3 diffs)
-
G4PenelopeRayleigh.cc (modified) (1 diff)
-
G4RangeTest.cc (modified) (1 diff)
-
G4SemiLogInterpolation.cc (modified) (1 diff)
-
G4ShellData.cc (modified) (10 diffs)
-
G4ShellEMDataSet.cc (modified) (15 diffs)
-
G4VCrossSectionHandler.cc (modified) (1 diff)
-
G4VLowEnergyDiscretePhotonProcess.cc (modified) (1 diff)
-
G4VeLowEnergyLoss.cc (modified) (1 diff)
-
G4WaterExcitationStructure.cc (modified) (1 diff)
-
G4WaterIonisationStructure.cc (modified) (1 diff)
-
G4eBremsstrahlungSpectrum.cc (modified) (1 diff)
-
G4eCrossSectionExcitationEmfietzoglou.cc (modified) (1 diff)
-
G4eCrossSectionScreenedRutherford.cc (modified) (1 diff)
-
G4eIonisationCrossSectionHandler.cc (modified) (6 diffs)
-
G4eIonisationParameters.cc (modified) (1 diff)
-
G4eIonisationSpectrum.cc (modified) (1 diff)
-
G4eLowEnergyLoss.cc (modified) (1 diff)
-
G4hLowEnergyIonisation.cc (modified) (1 diff)
-
G4hLowEnergyLoss.cc (modified) (9 diffs)
-
G4hShellCrossSectionDoubleExp.cc (modified) (2 diffs)
-
G4hShellCrossSectionDoubleExpData.cc (modified) (1 diff)
-
G4hShellCrossSectionExp.cc (modified) (2 diffs)
-
G4hShellCrossSectionExpData.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/electromagnetic/lowenergy/src/G4AtomicDeexcitation.cc
r819 r961 26 26 // 27 27 // $Id: G4AtomicDeexcitation.cc,v 1.11 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it) -
trunk/source/processes/electromagnetic/lowenergy/src/G4AtomicShell.cc
r819 r961 26 26 // 27 27 // $Id: G4AtomicShell.cc,v 1.2 ???? 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it) -
trunk/source/processes/electromagnetic/lowenergy/src/G4AtomicTransitionManager.cc
r819 r961 26 26 // 27 27 // $Id: G4AtomicTransitionManager.cc,v 1.2 ???? 28 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it) … … 319 319 G4double totalRadTransProb = 0; 320 320 321 for (size_t j = 1; j<transProb.size(); j++) 321 for (size_t j = 0; j<transProb.size(); j++) // AM -- corrected, it was 1 322 322 { 323 323 totalRadTransProb = totalRadTransProb + transProb[j]; … … 361 361 G4double totalRadTransProb = 0; 362 362 363 for(size_t j = 1; j<transProb.size(); j++)363 for(size_t j = 0; j<transProb.size(); j++) // AM -- Corrected, was 1 364 364 { 365 365 totalRadTransProb = totalRadTransProb + transProb[j]; -
trunk/source/processes/electromagnetic/lowenergy/src/G4AugerData.cc
r819 r961 480 480 481 481 482 for (G4int element = 6; element < 10 1; element++)482 for (G4int element = 6; element < 100; element++) 483 483 { 484 if(nMaterials == 0 || activeZ.contains(element)) { 485 augerTransitionTable.insert(trans_Table::value_type(element,LoadData(element))); 486 487 G4cout << "G4AugerData for Element no. " << element << " are loaded" << G4endl; 488 // PrintData(element); 489 } 490 } 491 492 G4cout << "AugerTransitionTable complete"<< G4endl; 484 // if(nMaterials == 0 || activeZ.contains(element)) { 485 augerTransitionTable.insert(trans_Table::value_type(element,LoadData(element))); 486 // G4cout << "G4AugerData for Element no. " << element << " are loaded" << G4endl; 487 // G4cout << "G4AugerData for Element no. " << element << " are loaded" << G4endl; 488 G4cout << "AugerTransitionTable complete"<< G4endl; 489 } 493 490 } 494 491 -
trunk/source/processes/electromagnetic/lowenergy/src/G4BremsstrahlungCrossSectionHandler.cc
r819 r961 25 25 // 26 26 // $Id: G4BremsstrahlungCrossSectionHandler.cc,v 1.9 2006/06/29 19:38:42 gunter Exp $ 27 // GEANT4 tag $Name: $27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- -
trunk/source/processes/electromagnetic/lowenergy/src/G4BremsstrahlungParameters.cc
r819 r961 26 26 // 27 27 // $Id: G4BremsstrahlungParameters.cc,v 1.19 2006/06/29 19:38:44 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) -
trunk/source/processes/electromagnetic/lowenergy/src/G4CompositeEMDataSet.cc
r819 r961 25 25 // 26 26 // 27 // $Id: G4CompositeEMDataSet.cc,v 1. 9 2006/06/29 19:38:46 gunterExp $28 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $27 // $Id: G4CompositeEMDataSet.cc,v 1.13 2008/03/17 13:40:53 pia Exp $ 28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) … … 42 42 #include <sstream> 43 43 44 G4CompositeEMDataSet :: G4CompositeEMDataSet(G4VDataSetAlgorithm* argAlgorithm, G4double argUnitEnergies, G4double argUnitData, G4int argMinZ, G4int argMaxZ) 45 : 46 algorithm(argAlgorithm), 47 unitEnergies(argUnitEnergies), 48 unitData(argUnitData), 49 minZ(argMinZ), 50 maxZ(argMaxZ) 44 G4CompositeEMDataSet::G4CompositeEMDataSet(G4VDataSetAlgorithm* argAlgorithm, 45 G4double argUnitEnergies, 46 G4double argUnitData, 47 G4int argMinZ, 48 G4int argMaxZ) 49 : 50 algorithm(argAlgorithm), 51 unitEnergies(argUnitEnergies), 52 unitData(argUnitData), 53 minZ(argMinZ), 54 maxZ(argMaxZ) 51 55 { 52 if (algorithm == 0)53 G4Exception("G4CompositeEMDataSet::G4CompositeEMDataSet - interpolation == 0");56 if (algorithm == 0) 57 G4Exception("G4CompositeEMDataSet::G4CompositeEMDataSet - interpolation == 0"); 54 58 } 55 59 56 60 57 61 58 G4CompositeEMDataSet ::~G4CompositeEMDataSet()62 G4CompositeEMDataSet::~G4CompositeEMDataSet() 59 63 { 60 CleanUpComponents(); 64 CleanUpComponents(); 65 if (algorithm) delete algorithm; 66 } 61 67 62 if (algorithm) 63 delete algorithm; 68 69 G4double G4CompositeEMDataSet::FindValue(G4double argEnergy, G4int argComponentId) const 70 { 71 const G4VEMDataSet* component(GetComponent(argComponentId)); 72 73 if (component) return component->FindValue(argEnergy); 74 75 std::ostringstream message; 76 message << "G4CompositeEMDataSet::FindValue - component " << argComponentId << " not found"; 77 78 G4Exception(message.str().c_str()); 79 80 return 0.; 81 } 82 83 void G4CompositeEMDataSet::PrintData(void) const 84 { 85 const size_t n(NumberOfComponents()); 86 87 G4cout << "The data set has " << n << " components" << G4endl; 88 G4cout << G4endl; 89 90 size_t i(0); 91 92 while (i<n) 93 { 94 G4cout << "--- Component " << i << " ---" << G4endl; 95 GetComponent(i)->PrintData(); 96 i++; 97 } 98 } 99 100 void G4CompositeEMDataSet::SetEnergiesData(G4DataVector* argEnergies, G4DataVector* argData, G4int argComponentId) 101 { 102 G4VEMDataSet * component(components[argComponentId]); 103 104 if (component) 105 { 106 component->SetEnergiesData(argEnergies, argData, 0); 107 return; 108 } 109 110 std::ostringstream message; 111 message << "G4CompositeEMDataSet::SetEnergiesData - component " << argComponentId << " not found"; 112 113 G4Exception(message.str().c_str()); 114 } 115 116 G4bool G4CompositeEMDataSet::LoadData(const G4String& argFileName) 117 { 118 CleanUpComponents(); 119 120 for (G4int z(minZ); z<maxZ; z++) 121 { 122 G4VEMDataSet* component = new G4EMDataSet(z, algorithm->Clone(), unitEnergies, unitData); 123 if (!component->LoadData(argFileName)) 124 { 125 delete component; 126 return false; 127 } 128 AddComponent(component); 129 } 130 return true; 64 131 } 65 132 66 133 67 134 135 G4bool G4CompositeEMDataSet::SaveData(const G4String& argFileName) const 136 { 137 for (G4int z=minZ; z<maxZ; z++) 138 { 139 const G4VEMDataSet* component(GetComponent(z-minZ)); 140 141 if (!component) 142 { 143 std::ostringstream message; 144 message << "G4CompositeEMDataSet::SaveData - component " << (z-minZ) << " not found"; 145 G4Exception(message.str().c_str()); 146 } 68 147 148 if (!component->SaveData(argFileName)) 149 return false; 150 } 151 152 return true; 153 } 69 154 70 71 G4double G4CompositeEMDataSet :: FindValue(G4double argEnergy, G4int argComponentId) const 155 void G4CompositeEMDataSet::CleanUpComponents(void) 72 156 { 73 const G4VEMDataSet * component(GetComponent(argComponentId)); 74 75 if (component) 76 return component->FindValue(argEnergy); 77 78 std::ostringstream message; 79 message << "G4CompositeEMDataSet::FindValue - component " << argComponentId << " not found"; 80 81 G4Exception(message.str().c_str()); 82 83 return 0.; 157 while (!components.empty()) 158 { 159 if (components.back()) 160 delete components.back(); 161 components.pop_back(); 162 } 84 163 } 85 164 86 165 87 88 89 90 void G4CompositeEMDataSet :: PrintData(void) const 166 G4double G4CompositeEMDataSet::RandomSelect(G4int componentId) const 91 167 { 92 const size_t n(NumberOfComponents()); 93 94 G4cout << "The data set has " << n << " components" << G4endl; 95 G4cout << G4endl; 96 97 size_t i(0); 98 99 while (i<n) 100 { 101 G4cout << "--- Component " << i << " ---" << G4endl; 102 GetComponent(i)->PrintData(); 103 i++; 104 } 168 G4double value = 0.; 169 if (componentId >= 0 && componentId < (G4int)components.size()) 170 { 171 const G4VEMDataSet* dataSet = GetComponent(componentId); 172 value = dataSet->RandomSelect(); 173 } 174 return value; 105 175 } 106 107 108 109 110 111 void G4CompositeEMDataSet :: SetEnergiesData(G4DataVector * argEnergies, G4DataVector * argData, G4int argComponentId)112 {113 G4VEMDataSet * component(components[argComponentId]);114 115 if (component)116 {117 component->SetEnergiesData(argEnergies, argData, 0);118 return;119 }120 121 std::ostringstream message;122 message << "G4CompositeEMDataSet::SetEnergiesData - component " << argComponentId << " not found";123 124 G4Exception(message.str().c_str());125 }126 127 128 129 130 131 G4bool G4CompositeEMDataSet :: LoadData(const G4String & argFileName)132 {133 CleanUpComponents();134 135 for (G4int z(minZ); z<maxZ; z++)136 {137 G4VEMDataSet * component=new G4EMDataSet(z, algorithm->Clone(), unitEnergies, unitData);138 if (!component->LoadData(argFileName))139 {140 delete component;141 return false;142 }143 144 AddComponent(component);145 }146 147 return true;148 }149 150 151 152 G4bool G4CompositeEMDataSet :: SaveData(const G4String & argFileName) const153 {154 for (G4int z(minZ); z<maxZ; z++)155 {156 const G4VEMDataSet * component(GetComponent(z-minZ));157 158 if (!component)159 {160 std::ostringstream message;161 message << "G4CompositeEMDataSet::SaveData - component " << (z-minZ) << " not found";162 163 G4Exception(message.str().c_str());164 }165 166 if (!component->SaveData(argFileName))167 return false;168 }169 170 return true;171 }172 173 174 175 176 177 void G4CompositeEMDataSet :: CleanUpComponents(void)178 {179 while (!components.empty())180 {181 if (components.back())182 delete components.back();183 184 components.pop_back();185 }186 }187 -
trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionChargeDecrease.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4CrossSectionChargeDecrease.cc,v 1.2 2007/11/09 20:11:04 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 40 // ------------------------------------------------------------------- 41 42 // Class description: 43 // Geant4-DNA Cross total cross section for electron elastic scattering in water 44 // Reference: TNS Geant4-DNA paper 45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 46 // design foundation and implementation of the first set of models, 47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 48 // Further documentation available from http://www.ge.infn.it/geant4/dna 49 50 // ------------------------------------------------------------------- 51 26 // $Id: G4CrossSectionChargeDecrease.cc,v 1.4 2008/07/14 20:47:34 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 52 28 53 29 #include "G4CrossSectionChargeDecrease.hh" 54 #include "G4Track.hh" 55 #include "G4DynamicParticle.hh" 56 #include "G4Proton.hh" 57 #include "G4CrossSectionExcitationEmfietzoglouPartial.hh" 58 #include "G4DNAGenericIonsManager.hh" 30 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 59 32 60 33 G4CrossSectionChargeDecrease::G4CrossSectionChargeDecrease() 61 34 { 62 // Default energy limits (defined for protection against anomalous behaviour only)63 name = "ChargeDecrease";64 35 lowEnergyLimitDefault = 1 * keV; 65 36 highEnergyLimitDefault = 10 * MeV; … … 76 47 77 48 if (protonDef != 0) 78 {79 proton = protonDef->GetParticleName();80 lowEnergyLimit[proton] = 1. * keV;81 highEnergyLimit[proton] = 10. * keV;82 }49 { 50 proton = protonDef->GetParticleName(); 51 lowEnergyLimit[proton] = 1. * keV; 52 highEnergyLimit[proton] = 10. * MeV; 53 } 83 54 else 84 {85 G4Exception("G4CrossSectionChargeDecrease Constructor: proton is not defined");86 }55 { 56 G4Exception("G4CrossSectionChargeDecrease Constructor: proton is not defined"); 57 } 87 58 88 59 if (alphaPlusPlusDef != 0) 89 {90 alphaPlusPlus = alphaPlusPlusDef->GetParticleName();91 lowEnergyLimit[alphaPlusPlus] = 1. * keV;92 highEnergyLimit[alphaPlusPlus] = 10. * MeV;93 }60 { 61 alphaPlusPlus = alphaPlusPlusDef->GetParticleName(); 62 lowEnergyLimit[alphaPlusPlus] = 1. * keV; 63 highEnergyLimit[alphaPlusPlus] = 10. * MeV; 64 } 94 65 else 95 {96 G4Exception("G4CrossSectionChargeDecrease Constructor: alphaPlusPlus is not defined");97 }66 { 67 G4Exception("G4CrossSectionChargeDecrease Constructor: alphaPlusPlus is not defined"); 68 } 98 69 99 70 if (alphaPlusDef != 0) 100 {101 alphaPlus = alphaPlusDef->GetParticleName();102 lowEnergyLimit[alphaPlus] = 1. * keV;103 highEnergyLimit[alphaPlus] = 10. * MeV;104 }71 { 72 alphaPlus = alphaPlusDef->GetParticleName(); 73 lowEnergyLimit[alphaPlus] = 1. * keV; 74 highEnergyLimit[alphaPlus] = 10. * MeV; 75 } 105 76 else 106 {107 G4Exception("G4CrossSectionChargeDecrease Constructor: alphaPlus is not defined");108 }77 { 78 G4Exception("G4CrossSectionChargeDecrease Constructor: alphaPlus is not defined"); 79 } 109 80 110 81 } 111 82 83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 112 84 113 85 G4CrossSectionChargeDecrease::~G4CrossSectionChargeDecrease() 114 86 {} 115 87 88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 116 89 117 90 G4double G4CrossSectionChargeDecrease::CrossSection(const G4Track& track) … … 140 113 G4Exception("G4CrossSectionChargeDecrease: attempting to calculate cross section for wrong particle"); 141 114 142 // Retrieve energy limits for the current particle type143 144 115 std::map< G4String,G4double,std::less<G4String> >::iterator pos1; 145 116 pos1 = lowEnergyLimit.find(particleName); 146 117 147 // Lower limit148 118 if (pos1 != lowEnergyLimit.end()) 149 {150 lowLim = pos1->second;151 }119 { 120 lowLim = pos1->second; 121 } 152 122 153 // Upper limit154 123 std::map< G4String,G4double,std::less<G4String> >::iterator pos2; 155 124 pos2 = highEnergyLimit.find(particleName); 156 125 157 126 if (pos2 != highEnergyLimit.end()) 158 { 159 highLim = pos2->second; 160 } 161 162 // 127 { 128 highLim = pos2->second; 129 } 163 130 164 131 G4double crossSection(0.); 165 132 if (k >= lowLim && k <= highLim) 166 {133 { 167 134 crossSection = partialCrossSection.Sum(k,particleDefinition); 168 }135 } 169 136 170 137 return crossSection; -
trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionChargeDecreasePartial.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4CrossSectionChargeDecreasePartial.cc,v 1.1 2007/11/08 18:25:25 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 08 Nov 2007 MGP Got code from S.I.; added variable initialisation to avoid compilation warnings 40 // 41 // ------------------------------------------------------------------- 42 43 // Class description: 44 // Geant4-DNA Cross total cross section for electron elastic scattering in water 45 // Reference: TNS Geant4-DNA paper 46 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 47 // design foundation and implementation of the first set of models, 48 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 49 // Further documentation available from http://www.ge.infn.it/geant4/dna 50 51 // ------------------------------------------------------------------- 52 26 // $Id: G4CrossSectionChargeDecreasePartial.cc,v 1.2 2008/07/14 20:47:34 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 53 28 54 29 #include "G4CrossSectionChargeDecreasePartial.hh" 55 #include "G4ParticleDefinition.hh" 56 #include "G4Proton.hh" 57 #include "G4DNAGenericIonsManager.hh" 58 59 #include "Randomize.hh" 60 30 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 61 32 62 33 G4CrossSectionChargeDecreasePartial::G4CrossSectionChargeDecreasePartial() … … 116 87 } 117 88 89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 90 118 91 G4CrossSectionChargeDecreasePartial::~G4CrossSectionChargeDecreasePartial() 119 { } 120 92 {} 93 94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 95 121 96 G4double G4CrossSectionChargeDecreasePartial::CrossSection(G4double k, G4int index, 122 97 const G4ParticleDefinition* particleDefinition) … … 149 124 150 125 if (x1[index][particleTypeIndex]<x0[index][particleTypeIndex]) 151 {126 { 152 127 // 153 128 // if x1 < x0 means that x1 and b1 will be calculated with the following formula (this piece of code is run on all alphas and not on protons) … … 163 138 + b0[index][particleTypeIndex] - c0[index][particleTypeIndex] * std::pow(x1[index][particleTypeIndex] 164 139 - x0[index][particleTypeIndex], d0[index][particleTypeIndex]); 165 }140 } 166 141 167 142 G4double x(std::log10(k/eV)); … … 197 172 198 173 while (i>0) 199 {174 { 200 175 i--; 201 176 values[i]=CrossSection(k, i, particleDefinition); 202 177 value+=values[i]; 203 }178 } 204 179 205 180 value*=G4UniformRand(); … … 207 182 i=n; 208 183 while (i>0) 209 {184 { 210 185 i--; 211 186 … … 214 189 215 190 value-=values[i]; 216 }191 } 217 192 218 193 delete[] values; … … 220 195 return i; 221 196 } 197 198 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 222 199 223 200 G4double G4CrossSectionChargeDecreasePartial::Sum(G4double k, const G4ParticleDefinition* particleDefinition) … … 234 211 235 212 for (G4int i=0; i<numberOfPartialCrossSections[particleTypeIndex]; i++) 236 {237 totalCrossSection += CrossSection(k,i,particleDefinition);238 }213 { 214 totalCrossSection += CrossSection(k,i,particleDefinition); 215 } 239 216 return totalCrossSection; 240 217 } 241 242 -
trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionChargeIncrease.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4CrossSectionChargeIncrease.cc,v 1.3 2007/12/10 16:31:21 gunter Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 40 // ------------------------------------------------------------------- 41 42 // Class description: 43 // Geant4-DNA Cross total cross section for electron elastic scattering in water 44 // Reference: TNS Geant4-DNA paper 45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 46 // design foundation and implementation of the first set of models, 47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 48 // Further documentation available from http://www.ge.infn.it/geant4/dna 49 50 // ------------------------------------------------------------------- 51 26 // $Id: G4CrossSectionChargeIncrease.cc,v 1.4 2008/07/14 20:47:34 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 52 28 53 29 #include "G4CrossSectionChargeIncrease.hh" 54 #include "G4Track.hh" 55 #include "G4DynamicParticle.hh" 56 #include "G4ParticleDefinition.hh" 57 #include "G4DNAGenericIonsManager.hh" 30 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 58 32 59 33 G4CrossSectionChargeIncrease::G4CrossSectionChargeIncrease() 60 34 { 61 // Default energy limits (defined for protection against anomalous behaviour only)62 name = "ChargeIncrease";63 35 lowEnergyLimitDefault = 1 * keV; 64 36 highEnergyLimitDefault = 10 * MeV; … … 75 47 76 48 if (hydrogenDef != 0) 77 {78 hydrogen = hydrogenDef->GetParticleName();79 lowEnergyLimit[hydrogen] = 1. * keV;80 highEnergyLimit[hydrogen] = 10. * MeV;81 }49 { 50 hydrogen = hydrogenDef->GetParticleName(); 51 lowEnergyLimit[hydrogen] = 1. * keV; 52 highEnergyLimit[hydrogen] = 10. * MeV; 53 } 82 54 else 83 {84 G4Exception("G4CrossSectionChargeIncrease Constructor: hydrogen is not defined");85 }55 { 56 G4Exception("G4CrossSectionChargeIncrease Constructor: hydrogen is not defined"); 57 } 86 58 87 59 if (alphaPlusDef != 0) 88 {89 alphaPlus = alphaPlusDef->GetParticleName();90 lowEnergyLimit[alphaPlus] = 1. * keV;91 highEnergyLimit[alphaPlus] = 10. * MeV;92 }60 { 61 alphaPlus = alphaPlusDef->GetParticleName(); 62 lowEnergyLimit[alphaPlus] = 1. * keV; 63 highEnergyLimit[alphaPlus] = 10. * MeV; 64 } 93 65 else 94 {95 G4Exception("G4CrossSectionChargeIncrease Constructor: alphaPlus is not defined");96 }66 { 67 G4Exception("G4CrossSectionChargeIncrease Constructor: alphaPlus is not defined"); 68 } 97 69 98 70 if (heliumDef != 0) 99 {100 helium = heliumDef->GetParticleName();101 lowEnergyLimit[helium] = 1. * keV;102 highEnergyLimit[helium] = 10. * MeV;103 }71 { 72 helium = heliumDef->GetParticleName(); 73 lowEnergyLimit[helium] = 1. * keV; 74 highEnergyLimit[helium] = 10. * MeV; 75 } 104 76 else 105 {106 G4Exception("G4CrossSectionChargeIncrease Constructor: helium is not defined");107 }77 { 78 G4Exception("G4CrossSectionChargeIncrease Constructor: helium is not defined"); 79 } 108 80 109 81 } 110 82 83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 111 84 112 85 G4CrossSectionChargeIncrease::~G4CrossSectionChargeIncrease() 113 86 {} 114 87 88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 115 89 116 90 G4double G4CrossSectionChargeIncrease::CrossSection(const G4Track& track) … … 139 113 G4Exception("G4CrossSectionChargeIncrease: attempting to calculate cross section for wrong particle"); 140 114 141 142 // Retrieve energy limits for the current particle type143 144 115 std::map< G4String,G4double,std::less<G4String> >::iterator pos1; 145 116 pos1 = lowEnergyLimit.find(particleName); 146 117 147 // Lower limit148 118 if (pos1 != lowEnergyLimit.end()) 149 {150 lowLim = pos1->second;151 }119 { 120 lowLim = pos1->second; 121 } 152 122 153 // Upper limit154 123 std::map< G4String,G4double,std::less<G4String> >::iterator pos2; 155 124 pos2 = highEnergyLimit.find(particleName); 156 125 157 126 if (pos2 != highEnergyLimit.end()) 158 {159 highLim = pos2->second;160 }127 { 128 highLim = pos2->second; 129 } 161 130 162 131 G4double totalCrossSection = 0.; 163 132 164 133 if (k >= lowLim && k <= highLim) 165 {134 { 166 135 //HYDROGEN 167 136 if (particleDefinition == instance->GetIon("hydrogen")) 168 {137 { 169 138 const G4double aa = 2.835; 170 139 const G4double bb = 0.310; … … 180 149 G4double sigmah = temp * (aa * std::log(1.0 + x) + bb) / x; 181 150 totalCrossSection = 1.0/(1.0/sigmal + 1.0/sigmah) *m*m; 182 }151 } 183 152 else 184 {153 { 185 154 totalCrossSection = partialCrossSection.Sum(k,particleDefinition); 186 }187 }155 } 156 } 188 157 189 158 return totalCrossSection; -
trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionChargeIncreasePartial.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4CrossSectionChargeIncreasePartial.cc,v 1.1 2007/11/08 18:25:25 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 40 // ------------------------------------------------------------------- 41 42 // Class description: 43 // Geant4-DNA Cross total cross section for electron elastic scattering in water 44 // Reference: TNS Geant4-DNA paper 45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 46 // design foundation and implementation of the first set of models, 47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 48 // Further documentation available from http://www.ge.infn.it/geant4/dna 49 50 // ------------------------------------------------------------------- 51 26 // $Id: G4CrossSectionChargeIncreasePartial.cc,v 1.2 2008/07/14 20:47:34 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 52 28 53 29 #include "G4CrossSectionChargeIncreasePartial.hh" 54 #include "G4DynamicParticle.hh" 55 #include "G4ParticleDefinition.hh" 56 #include "G4Proton.hh" 57 #include "G4DNAGenericIonsManager.hh" 58 59 #include "Randomize.hh" 30 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 60 32 61 33 G4CrossSectionChargeIncreasePartial::G4CrossSectionChargeIncreasePartial() 62 34 { 63 64 35 //ALPHA+ 36 65 37 f0[0][0]=1.; 66 38 a0[0][0]=2.25; … … 101 73 102 74 numberOfPartialCrossSections[1]=2; 103 104 } 75 } 76 77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 105 78 106 79 G4CrossSectionChargeIncreasePartial::~G4CrossSectionChargeIncreasePartial() 107 { }80 {} 108 81 82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 83 109 84 G4double G4CrossSectionChargeIncreasePartial::CrossSection(G4double k, G4int index, 110 85 const G4ParticleDefinition* particleDefinition) … … 137 112 138 113 if (x1[index][particleTypeIndex]<x0[index][particleTypeIndex]) 139 {114 { 140 115 // 141 116 // if x1 < x0 means that x1 and b1 will be calculated with the following formula (this piece of code is run on all alphas and not on protons) … … 148 123 x1[index][particleTypeIndex]=x0[index][particleTypeIndex] + std::pow((a0[index][particleTypeIndex] - a1[index][particleTypeIndex]) / (c0[index][particleTypeIndex] * d0[index][particleTypeIndex]), 1. / (d0[index][particleTypeIndex] - 1.)); 149 124 b1[index][particleTypeIndex]=(a0[index][particleTypeIndex] - a1[index][particleTypeIndex]) * x1[index][particleTypeIndex] + b0[index][particleTypeIndex] - c0[index][particleTypeIndex] * std::pow(x1[index][particleTypeIndex] - x0[index][particleTypeIndex], d0[index][particleTypeIndex]); 150 }125 } 151 126 152 127 G4double x(std::log10(k/eV)); … … 161 136 162 137 return f0[index][particleTypeIndex] * std::pow(10., y)*m*m; 163 164 165 } 138 139 } 140 141 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 166 142 167 143 G4int G4CrossSectionChargeIncreasePartial::RandomSelect(G4double k, … … 183 159 184 160 while (i>0) 185 {161 { 186 162 i--; 187 163 values[i]=CrossSection(k, i, particleDefinition); 188 164 value+=values[i]; 189 }165 } 190 166 191 167 value*=G4UniformRand(); … … 193 169 i=n; 194 170 while (i>0) 195 {171 { 196 172 i--; 197 173 … … 200 176 201 177 value-=values[i]; 202 }178 } 203 179 204 180 delete[] values; … … 206 182 return i; 207 183 } 184 185 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 208 186 209 187 G4double G4CrossSectionChargeIncreasePartial::Sum(G4double k, const G4ParticleDefinition* particleDefinition) … … 219 197 220 198 for (G4int i=0; i<numberOfPartialCrossSections[particleTypeIndex]; i++) 221 {222 totalCrossSection += CrossSection(k,i,particleDefinition);223 }199 { 200 totalCrossSection += CrossSection(k,i,particleDefinition); 201 } 224 202 return totalCrossSection; 225 203 } 226 204 227 -
trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionElasticScreenedRutherford.cc
r819 r961 26 26 // 27 27 // $Id: G4CrossSectionElasticScreenedRutherford.cc,v 1.1 2007/10/12 23:11:41 pia Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) -
trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionExcitationBorn.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4CrossSectionExcitationBorn.cc,v 1.2 2007/11/09 20:11:04 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 40 // ------------------------------------------------------------------- 41 42 // Class description: 43 // Geant4-DNA Cross total cross section for electron elastic scattering in water 44 // Reference: TNS Geant4-DNA paper 45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 46 // design foundation and implementation of the first set of models, 47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 48 // Further documentation available from http://www.ge.infn.it/geant4/dna 49 50 // ------------------------------------------------------------------- 51 26 // $Id: G4CrossSectionExcitationBorn.cc,v 1.4 2008/07/14 20:47:34 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 52 28 53 29 #include "G4CrossSectionExcitationBorn.hh" 54 #include "G4Track.hh"55 #include "G4DynamicParticle.hh"56 #include "G4ParticleDefinition.hh"57 #include "G4Electron.hh"58 #include "G4LogLogInterpolation.hh"59 30 60 #include "Randomize.hh" 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 61 32 62 33 G4CrossSectionExcitationBorn::G4CrossSectionExcitationBorn() 63 34 { 64 65 // ---- MGP ---- Limits to be checked: current values are just temporary for testing purpose 66 name = "ExcitationBorn"; 67 lowEnergyLimit = 1. * keV; 35 lowEnergyLimit = 500. * keV; 68 36 highEnergyLimit = 10 * MeV; 69 70 37 table = 0; 71 38 } 72 39 40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 73 41 74 42 G4CrossSectionExcitationBorn::~G4CrossSectionExcitationBorn() … … 77 45 } 78 46 47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 48 79 49 G4double G4CrossSectionExcitationBorn::CrossSection(const G4Track& track) 80 50 { 81 // Lazy initialisation: load cross section tables in memory the first time access to them is required 82 51 83 52 G4double sigma = 0.; 84 53 85 54 if (table == 0) 86 { 87 // Load tables 88 // ---- MGP ---- 89 table = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,(1e-22/3.343)*m*m ); 90 table->LoadData("dna/sigma_excitation_p_born"); 91 92 // ---- MGP ---- Temporary 93 table->PrintData(); 94 } 55 { 56 table = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,(1e-22/3.343)*m*m ); 57 table->LoadData("dna/sigma_excitation_p_born"); 58 } 95 59 96 60 const G4DynamicParticle* particle = track.GetDynamicParticle(); 97 61 G4double k = particle->GetKineticEnergy(); 98 62 99 if (k > lowEnergyLimit && k <highEnergyLimit)100 {101 sigma = table->FindValue(k); // no electron interaction ---- MGP ---- What does this mean?102 }63 if (k >= lowEnergyLimit && k <= highEnergyLimit) 64 { 65 sigma = table->FindValue(k); 66 } 103 67 return sigma; 104 68 } -
trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionExcitationBornPartial.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4CrossSectionExcitationBornPartial.cc,v 1.1 2007/10/15 08:57:54 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 40 // ------------------------------------------------------------------- 41 42 // Class description: 43 // Geant4-DNA Cross total cross section for electron elastic scattering in water 44 // Reference: TNS Geant4-DNA paper 45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 46 // design foundation and implementation of the first set of models, 47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 48 // Further documentation available from http://www.ge.infn.it/geant4/dna 49 50 // ------------------------------------------------------------------- 51 26 // $Id: G4CrossSectionExcitationBornPartial.cc,v 1.3 2008/07/14 20:47:34 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 52 28 53 29 #include "G4CrossSectionExcitationBornPartial.hh" 54 #include "G4Track.hh"55 #include "G4DynamicParticle.hh"56 #include "G4ParticleDefinition.hh"57 #include "G4Electron.hh"58 #include "G4LogLogInterpolation.hh"59 30 60 #include "Randomize.hh" 61 62 #include <deque> 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 63 32 64 33 G4CrossSectionExcitationBornPartial::G4CrossSectionExcitationBornPartial() 65 34 { 66 35 table = 0; 67 // nLevels = waterExcitation.NumberOfLevels();68 36 } 69 37 38 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 70 39 71 40 G4CrossSectionExcitationBornPartial::~G4CrossSectionExcitationBornPartial() … … 74 43 } 75 44 45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 76 46 77 47 G4int G4CrossSectionExcitationBornPartial::RandomSelect(G4double k) 78 48 { 79 // Lazy initialisation: load cross section tables in memory the first time access to them is required80 81 49 G4int level = 0; 82 50 83 51 if (table == 0) 84 { 85 // Load tables 86 // ---- MGP ---- 87 table = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,(1e-22/3.343)*m*m ); 88 table->LoadData("dna/sigma_excitation_p_born"); 89 90 // ---- MGP ---- Temporary 91 table->PrintData(); 92 } 52 { 53 table = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,(1e-22/3.343)*m*m ); 54 table->LoadData("dna/sigma_excitation_p_born"); 55 } 93 56 94 57 G4double* valuesBuffer = new G4double[table->NumberOfComponents()]; … … 99 62 100 63 while (i>0) 101 {102 i--;103 valuesBuffer[i] = table->GetComponent(i)->FindValue(k);104 value += valuesBuffer[i];105 }64 { 65 i--; 66 valuesBuffer[i] = table->GetComponent(i)->FindValue(k); 67 value += valuesBuffer[i]; 68 } 106 69 107 70 value *= G4UniformRand(); … … 110 73 111 74 while (i > 0) 75 { 76 i--; 77 78 if (valuesBuffer[i] > value) 112 79 { 113 i--; 114 115 if (valuesBuffer[i] > value) 116 { 117 delete[] valuesBuffer; 118 return i; 119 } 80 delete[] valuesBuffer; 81 return i; 82 } 120 83 value -= valuesBuffer[i]; 121 }84 } 122 85 123 // It should never end up here124 125 // ---- MGP ---- Is the following line really necessary?126 86 if (valuesBuffer) delete[] valuesBuffer; 127 87 -
trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionExcitationEmfietzoglou.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4CrossSectionExcitationEmfietzoglou.cc,v 1.2 2007/10/15 08:36:35 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 40 // ------------------------------------------------------------------- 41 42 // Class description: 43 // Geant4-DNA Cross total cross section for electron elastic scattering in water 44 // Reference: TNS Geant4-DNA paper 45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 46 // design foundation and implementation of the first set of models, 47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 48 // Further documentation available from http://www.ge.infn.it/geant4/dna 49 50 // ------------------------------------------------------------------- 51 26 // $Id: G4CrossSectionExcitationEmfietzoglou.cc,v 1.5 2008/12/05 11:58:16 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 52 28 53 29 #include "G4CrossSectionExcitationEmfietzoglou.hh" 54 #include "G4Track.hh" 55 #include "G4DynamicParticle.hh" 30 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 56 32 57 33 G4CrossSectionExcitationEmfietzoglou::G4CrossSectionExcitationEmfietzoglou() 58 34 { 59 60 name = "CrossSectionExcitationEmfietzoglou"; 61 lowEnergyLimit = 7.4 * eV; 35 lowEnergyLimit = 8.23 * eV; 62 36 highEnergyLimit = 10. * MeV; 63 37 } 64 38 39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 65 40 66 41 G4CrossSectionExcitationEmfietzoglou::~G4CrossSectionExcitationEmfietzoglou() 67 { }42 {} 68 43 44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 69 45 70 46 G4double G4CrossSectionExcitationEmfietzoglou::CrossSection(const G4Track& track) … … 73 49 G4double k = particle->GetKineticEnergy(); 74 50 75 // Cross section = 0 outside the energy validity limits set in the constructor76 // ---- MGP ---- Better handling of these limits to be set in a following design iteration77 78 51 G4double sigma = 0.; 79 52 80 if (k > lowEnergyLimit && k <highEnergyLimit) sigma = partialCrossSection.Sum(k);53 if (k >= lowEnergyLimit && k <= highEnergyLimit) sigma = partialCrossSection.Sum(k); 81 54 82 55 return sigma; -
trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionExcitationEmfietzoglouPartial.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4CrossSectionExcitationEmfietzoglouPartial.cc,v 1.2 2007/12/10 16:31:26 gunter Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 40 // ------------------------------------------------------------------- 41 42 // Class description: 43 // Geant4-DNA Cross total cross section for electron elastic scattering in water 44 // Reference: TNS Geant4-DNA paper 45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 46 // design foundation and implementation of the first set of models, 47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 48 // Further documentation available from http://www.ge.infn.it/geant4/dna 49 50 // ------------------------------------------------------------------- 51 26 // $Id: G4CrossSectionExcitationEmfietzoglouPartial.cc,v 1.3 2008/07/14 20:47:34 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 52 28 53 29 #include "G4CrossSectionExcitationEmfietzoglouPartial.hh" 54 #include "G4Track.hh"55 #include "G4DynamicParticle.hh"56 #include "G4ParticleDefinition.hh"57 #include "G4Electron.hh"58 30 59 #include "Randomize.hh" 60 61 #include <deque> 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 62 32 63 33 G4CrossSectionExcitationEmfietzoglouPartial::G4CrossSectionExcitationEmfietzoglouPartial() 64 34 { 65 66 35 nLevels = waterExcitation.NumberOfLevels(); 67 //G4cout << "Water excitation energy: number of levels = " << nLevels << G4endl;68 36 } 69 37 38 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 70 39 71 40 G4CrossSectionExcitationEmfietzoglouPartial::~G4CrossSectionExcitationEmfietzoglouPartial() 72 { }41 {} 73 42 43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 44 74 45 G4double G4CrossSectionExcitationEmfietzoglouPartial::CrossSection(G4double t, G4int level) 75 46 { … … 84 55 // Aj, Bj, Cj & Pj are parameters that can be found in Emfietzoglou's papers 85 56 // 86 //87 57 // From Phys. Med. Biol. 48 (2003) 2355-2371, D.Emfietzoglou, 88 58 // Monte Carlo Simulation of the energy loss of low energy electrons in liquid Water 89 59 // 90 60 // Scaling for macroscopic cross section: number of water moleculs per unit volume 91 // (capra) const G4double sigma0 = (10. / 3.343e22) * cm2; 61 // const G4double sigma0 = (10. / 3.343e22) * cm2; 62 92 63 const G4double density = 3.34192e+19 * mm3; 93 64 … … 100 71 101 72 G4double exc = waterExcitation.ExcitationEnergy(level); 102 // G4cout << "Water excitation energy " << exc/keV << " level = " << level << G4endl; 103 73 104 74 if (t >= exc) 105 75 { … … 113 83 } 114 84 85 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 86 115 87 G4int G4CrossSectionExcitationEmfietzoglouPartial::RandomSelect(G4double k) 116 88 { … … 119 91 std::deque<double> values; 120 92 121 // ---- MGP ---- The following algorithm is wrong: it works i sthe cross section93 // ---- MGP ---- The following algorithm is wrong: it works if the cross section 122 94 // is a monotone increasing function. 123 95 // The algorithm should be corrected by building the cumulative function … … 126 98 127 99 while (i > 0) 128 {129 i--;130 G4double partial = CrossSection(k,i);131 values.push_front(partial);132 value += partial;133 }100 { 101 i--; 102 G4double partial = CrossSection(k,i); 103 values.push_front(partial); 104 value += partial; 105 } 134 106 135 value *= G4UniformRand();107 value *= G4UniformRand(); 136 108 137 i = nLevels;109 i = nLevels; 138 110 139 while (i > 0)140 {141 i--;142 if (values[i] > value) return i;143 value -= values[i];144 }111 while (i > 0) 112 { 113 i--; 114 if (values[i] > value) return i; 115 value -= values[i]; 116 } 145 117 146 return 0;118 return 0; 147 119 } 120 121 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 148 122 149 123 G4double G4CrossSectionExcitationEmfietzoglouPartial::Sum(G4double k) … … 152 126 153 127 for (G4int i=0; i<nLevels; i++) 154 {155 totalCrossSection += CrossSection(k,i);156 }128 { 129 totalCrossSection += CrossSection(k,i); 130 } 157 131 return totalCrossSection; 158 132 } -
trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionExcitationMillerGreen.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4CrossSectionExcitationMillerGreen.cc,v 1.3 2007/11/09 20:11:04 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 40 // ------------------------------------------------------------------- 41 42 // Class description: 43 // Geant4-DNA Cross total cross section for electron elastic scattering in water 44 // Reference: TNS Geant4-DNA paper 45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 46 // design foundation and implementation of the first set of models, 47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 48 // Further documentation available from http://www.ge.infn.it/geant4/dna 49 50 // ------------------------------------------------------------------- 51 26 // $Id: G4CrossSectionExcitationMillerGreen.cc,v 1.4 2008/07/14 20:47:34 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 52 28 53 29 #include "G4CrossSectionExcitationMillerGreen.hh" 54 #include "G4Track.hh" 55 #include "G4DynamicParticle.hh" 56 #include "G4Proton.hh" 57 #include "G4CrossSectionExcitationEmfietzoglouPartial.hh" 58 #include "G4DNAGenericIonsManager.hh" 30 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 59 32 60 33 G4CrossSectionExcitationMillerGreen::G4CrossSectionExcitationMillerGreen() 61 34 { 62 // Default energy limits (defined for protection against anomalous behaviour only)63 name = "ExcitationMillerGreen";64 35 lowEnergyLimitDefault = 10 * eV; 65 36 highEnergyLimitDefault = 10 * MeV; … … 78 49 79 50 if (protonDef != 0) 80 {81 proton = protonDef->GetParticleName();82 lowEnergyLimit[proton] = 10. * eV;83 highEnergyLimit[proton] = 500. * keV;84 }51 { 52 proton = protonDef->GetParticleName(); 53 lowEnergyLimit[proton] = 10. * eV; 54 highEnergyLimit[proton] = 500. * keV; 55 } 85 56 else 86 {87 G4Exception("G4CrossSectionExcitationMillerGreen Constructor: proton is not defined");88 }57 { 58 G4Exception("G4CrossSectionExcitationMillerGreen Constructor: proton is not defined"); 59 } 89 60 90 61 if (alphaPlusPlusDef != 0) 91 {92 alphaPlusPlus = alphaPlusPlusDef->GetParticleName();93 lowEnergyLimit[alphaPlusPlus] = 1. * keV;94 highEnergyLimit[alphaPlusPlus] = 10. * MeV;95 }62 { 63 alphaPlusPlus = alphaPlusPlusDef->GetParticleName(); 64 lowEnergyLimit[alphaPlusPlus] = 1. * keV; 65 highEnergyLimit[alphaPlusPlus] = 10. * MeV; 66 } 96 67 else 97 {68 { 98 69 G4Exception("G4CrossSectionExcitationMillerGreen Constructor: alphaPlusPlus is not defined"); 99 }70 } 100 71 101 72 if (alphaPlusDef != 0) 102 {103 alphaPlus = alphaPlusDef->GetParticleName();104 lowEnergyLimit[alphaPlus] = 1. * keV;105 highEnergyLimit[alphaPlus] = 10. * MeV;106 }73 { 74 alphaPlus = alphaPlusDef->GetParticleName(); 75 lowEnergyLimit[alphaPlus] = 1. * keV; 76 highEnergyLimit[alphaPlus] = 10. * MeV; 77 } 107 78 else 108 {109 G4Exception("G4CrossSectionExcitationMillerGreen Constructor: alphaPlus is not defined");110 }79 { 80 G4Exception("G4CrossSectionExcitationMillerGreen Constructor: alphaPlus is not defined"); 81 } 111 82 112 83 if (heliumDef != 0) 113 {114 helium = heliumDef->GetParticleName();115 lowEnergyLimit[helium] = 1. * keV;116 highEnergyLimit[helium] = 10. * MeV;117 }84 { 85 helium = heliumDef->GetParticleName(); 86 lowEnergyLimit[helium] = 1. * keV; 87 highEnergyLimit[helium] = 10. * MeV; 88 } 118 89 else 119 { 120 G4Exception("G4CrossSectionExcitationMillerGreen Constructor: helium is not defined"); 121 } 122 123 90 { 91 G4Exception("G4CrossSectionExcitationMillerGreen Constructor: helium is not defined"); 92 } 93 124 94 } 125 95 96 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 126 97 127 98 G4CrossSectionExcitationMillerGreen::~G4CrossSectionExcitationMillerGreen() 128 99 {} 129 100 101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 130 102 131 103 G4double G4CrossSectionExcitationMillerGreen::CrossSection(const G4Track& track) … … 154 126 const G4String& particleName = particle->GetDefinition()->GetParticleName(); 155 127 156 // Retrieve energy limits for the current particle type157 158 128 std::map< G4String,G4double,std::less<G4String> >::iterator pos1; 159 129 pos1 = lowEnergyLimit.find(particleName); 160 130 161 // Lower limit162 131 if (pos1 != lowEnergyLimit.end()) 163 {164 lowLim = pos1->second;165 }132 { 133 lowLim = pos1->second; 134 } 166 135 167 // Upper limit168 136 std::map< G4String,G4double,std::less<G4String> >::iterator pos2; 169 137 pos2 = highEnergyLimit.find(particleName); 170 138 171 139 if (pos2 != highEnergyLimit.end()) 172 {173 highLim = pos2->second;174 }140 { 141 highLim = pos2->second; 142 } 175 143 176 //177 144 const G4ParticleDefinition* particleDefinition = track.GetDefinition(); 178 145 … … 180 147 181 148 if (k >= lowLim && k <= highLim) 149 { 150 crossSection = partialCrossSection.Sum(k,particleDefinition); 151 G4DNAGenericIonsManager *instance; 152 instance = G4DNAGenericIonsManager::Instance(); 153 154 // add ONE or TWO electron-water excitation for alpha+ and helium 155 156 if ( particleDefinition == instance->GetIon("alpha+") 157 || 158 particleDefinition == instance->GetIon("helium") 159 ) 182 160 { 183 184 crossSection = partialCrossSection.Sum(k,particleDefinition);185 G4DNAGenericIonsManager *instance;186 instance = G4DNAGenericIonsManager::Instance();187 188 // add ONE or TWO electron-water excitation for alpha+ and helium189 190 if ( particleDefinition == instance->GetIon("alpha+")191 ||192 particleDefinition == instance->GetIon("helium")193 )194 {195 161 G4CrossSectionExcitationEmfietzoglouPartial * excitationXS = 196 162 new G4CrossSectionExcitationEmfietzoglouPartial(); 163 197 164 G4double sigmaExcitation=0; 198 165 if (k*0.511/3728 > 7.4*eV && k*0.511/3728 < 10*keV) sigmaExcitation = excitationXS->Sum(k*0.511/3728); … … 200 167 if ( particleDefinition == instance->GetIon("alpha+") ) 201 168 crossSection = crossSection + sigmaExcitation ; 169 202 170 if ( particleDefinition == instance->GetIon("helium") ) 203 171 crossSection = crossSection + 2*sigmaExcitation ; 172 204 173 delete excitationXS; 205 }206 }174 } 175 } 207 176 208 177 return crossSection; -
trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionExcitationMillerGreenPartial.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4CrossSectionExcitationMillerGreenPartial.cc,v 1.1 2007/11/08 19:57:23 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 40 // ------------------------------------------------------------------- 41 42 // Class description: 43 // Geant4-DNA Cross total cross section for electron elastic scattering in water 44 // Reference: TNS Geant4-DNA paper 45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 46 // design foundation and implementation of the first set of models, 47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 48 // Further documentation available from http://www.ge.infn.it/geant4/dna 49 50 // ------------------------------------------------------------------- 51 26 // $Id: G4CrossSectionExcitationMillerGreenPartial.cc,v 1.3 2009/01/20 07:40:53 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 52 28 53 29 #include "G4CrossSectionExcitationMillerGreenPartial.hh" 54 #include "G4Track.hh" 55 #include "G4DynamicParticle.hh" 56 #include "G4ParticleDefinition.hh" 57 #include "G4Proton.hh" 58 #include "G4DNAGenericIonsManager.hh" 59 #include "G4CrossSectionExcitationEmfietzoglouPartial.hh" 60 #include "Randomize.hh" 61 #include <deque> 62 30 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 63 32 64 33 G4CrossSectionExcitationMillerGreenPartial::G4CrossSectionExcitationMillerGreenPartial() 65 34 { 66 67 35 nLevels = waterExcitation.NumberOfLevels(); 68 //G4cout << "Water excitation energy: number of levels = " << nLevels << G4endl;69 36 70 37 //PROTON … … 106 73 } 107 74 75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 76 108 77 G4CrossSectionExcitationMillerGreenPartial::~G4CrossSectionExcitationMillerGreenPartial() 109 { } 110 78 {} 79 80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 81 111 82 G4double G4CrossSectionExcitationMillerGreenPartial::CrossSection(G4double k, G4int excitationLevel, 112 83 const G4ParticleDefinition* particleDefinition) … … 144 115 tCorrected = k * kineticEnergyCorrection[particleTypeIndex]; 145 116 146 // Assume that the material is water; proper algorithm to calculate correctly for any material to be inserted here 117 // SI - added protection 118 if (tCorrected < waterExcitation.ExcitationEnergy(excitationLevel)) return 0; 119 // 120 147 121 G4int z = 10; 148 122 … … 168 142 } 169 143 144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 145 170 146 G4int G4CrossSectionExcitationMillerGreenPartial::RandomSelect(G4double k, 171 147 const G4ParticleDefinition* particle) … … 175 151 std::deque<double> values; 176 152 177 // ---- MGP ---- The following algorithm is wrong: it works i sthe cross section153 // ---- MGP ---- The following algorithm is wrong: it works if the cross section 178 154 // is a monotone increasing function. 179 155 // The algorithm should be corrected by building the cumulative function … … 186 162 // ELECTRON CORRECTION 187 163 188 if ( particle == instance->GetIon("alpha++")) 189 { while (i > 0) 190 { 164 if ( particle == instance->GetIon("alpha++")|| 165 particle == G4Proton::ProtonDefinition()) 166 167 { while (i > 0) 168 { 191 169 i--; 192 170 G4double partial = CrossSection(k,i,particle); 193 171 values.push_front(partial); 194 172 value += partial; 195 }196 197 value *= G4UniformRand();173 } 174 175 value *= G4UniformRand(); 198 176 199 i = nLevels;200 201 while (i > 0)202 {177 i = nLevels; 178 179 while (i > 0) 180 { 203 181 i--; 204 182 if (values[i] > value) return i; 205 183 value -= values[i]; 206 } 207 } 208 209 // 184 } 185 } 186 210 187 // add ONE or TWO electron-water excitation for alpha+ and helium 211 188 … … 213 190 || 214 191 particle == instance->GetIon("helium") 215 ) 192 ) 193 { 194 while (i>0) 216 195 { 217 218 while (i>0)219 {220 196 i--; 221 197 … … 232 208 value += partial; 233 209 delete excitationXS; 234 }235 236 value*=G4UniformRand();237 238 i=5;239 while (i>0)240 {210 } 211 212 value*=G4UniformRand(); 213 214 i=5; 215 while (i>0) 216 { 241 217 i--; 242 218 … … 244 220 245 221 value-=values[i]; 246 }247 }222 } 223 } 248 224 // 225 249 226 return 0; 250 227 } 251 228 229 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 230 252 231 G4double G4CrossSectionExcitationMillerGreenPartial::Sum(G4double k, const G4ParticleDefinition* particle) 253 232 { … … 255 234 256 235 for (G4int i=0; i<nLevels; i++) 257 {258 totalCrossSection += CrossSection(k,i,particle);259 }236 { 237 totalCrossSection += CrossSection(k,i,particle); 238 } 260 239 return totalCrossSection; 261 240 } 262 241 242 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 263 243 264 244 G4double G4CrossSectionExcitationMillerGreenPartial::S_1s(G4double t, … … 277 257 278 258 259 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 260 279 261 G4double G4CrossSectionExcitationMillerGreenPartial::S_2s(G4double t, 280 262 G4double energyTransferred, … … 292 274 } 293 275 276 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 294 277 295 278 G4double G4CrossSectionExcitationMillerGreenPartial::S_2p(G4double t, … … 307 290 } 308 291 292 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 309 293 310 294 G4double G4CrossSectionExcitationMillerGreenPartial::R(G4double t, -
trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionHandler.cc
r819 r961 26 26 // 27 27 // $Id: G4CrossSectionHandler.cc,v 1.18 2006/06/29 19:38:48 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) -
trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionIonisationBorn.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4CrossSectionIonisationBorn.cc,v 1.2 2007/11/08 18:51:34 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 40 // ------------------------------------------------------------------- 41 42 // Class description: 43 // Geant4-DNA Cross total cross section for electron elastic scattering in water 44 // Reference: TNS Geant4-DNA paper 45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 46 // design foundation and implementation of the first set of models, 47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 48 // Further documentation available from http://www.ge.infn.it/geant4/dna 49 50 // ------------------------------------------------------------------- 51 26 // $Id: G4CrossSectionIonisationBorn.cc,v 1.4 2008/08/20 14:51:48 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 52 28 53 29 #include "G4CrossSectionIonisationBorn.hh" 54 #include "G4ParticleDefinition.hh"55 #include "G4Electron.hh"56 #include "G4Proton.hh"57 #include "G4Track.hh"58 #include "G4LogLogInterpolation.hh"59 #include "G4SystemOfUnits.hh"60 30 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 61 32 62 33 G4CrossSectionIonisationBorn::G4CrossSectionIonisationBorn() 63 34 { 64 65 name = "IonisationBorn"; 66 67 // Default energy limits (defined for protection against anomalous behaviour only) 68 lowEnergyLimitDefault = 25 * eV; 35 lowEnergyLimitDefault = 12.61 * eV; // SI: i/o 25 eV 69 36 highEnergyLimitDefault = 30 * keV; 70 37 … … 78 45 G4String proton; 79 46 80 // Factor to scale microscopic/macroscopic cross section data in water81 // ---- MGP ---- Hardcoded (taken from prototype code); to be replaced with proper calculation82 47 G4double scaleFactor = (1.e-22 / 3.343) * m*m; 83 48 49 if (electronDef != 0) 50 { 51 electron = electronDef->GetParticleName(); 52 tableFile[electron] = fileElectron; 84 53 85 // Data members for electrons 54 lowEnergyLimit[electron] = 12.61 * eV; // SI: i/o 25 eV 55 highEnergyLimit[electron] = 30. * keV; 86 56 87 if (electronDef != 0) 88 { 89 electron = electronDef->GetParticleName(); 90 tableFile[electron] = fileElectron; 91 92 // Energy limits 93 lowEnergyLimit[electron] = 25. * eV; 94 highEnergyLimit[electron] = 30. * keV; 95 96 // Create data set with electron cross section data and load values stored in file 97 G4DNACrossSectionDataSet* tableE = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor ); 98 tableE->LoadData(fileElectron); 57 G4DNACrossSectionDataSet* tableE = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor ); 58 tableE->LoadData(fileElectron); 99 59 100 // Insert key-table pair in map 101 tableData[electron] = tableE; 102 } 60 tableData[electron] = tableE; 61 } 103 62 else 104 { 105 G4Exception("G4CrossSectionIonisationBorn Constructor: electron is not defined"); 106 } 107 108 // Data members for protons 63 { 64 G4Exception("G4CrossSectionIonisationBorn Constructor: electron is not defined"); 65 } 109 66 110 67 if (protonDef != 0) 111 {112 proton = protonDef->GetParticleName();113 tableFile[proton] = fileProton;68 { 69 proton = protonDef->GetParticleName(); 70 tableFile[proton] = fileProton; 114 71 115 // Energy limits 116 lowEnergyLimit[proton] = 500. * keV; 117 highEnergyLimit[proton] = 10. * MeV; 72 lowEnergyLimit[proton] = 500. * keV; 73 highEnergyLimit[proton] = 10. * MeV; 118 74 119 // Create data set with proton cross section data and load values stored in file 120 G4DNACrossSectionDataSet* tableP = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor ); 121 tableP->LoadData(fileProton); 75 G4DNACrossSectionDataSet* tableP = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor ); 76 tableP->LoadData(fileProton); 122 77 123 // Insert key-table pair in map 124 tableData[proton] = tableP; 125 } 78 tableData[proton] = tableP; 79 } 126 80 else 127 {128 G4Exception("G4CrossSectionIonisationBorn Constructor: proton is not defined");129 }81 { 82 G4Exception("G4CrossSectionIonisationBorn Constructor: proton is not defined"); 83 } 130 84 } 131 85 86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 132 87 133 88 G4CrossSectionIonisationBorn::~G4CrossSectionIonisationBorn() 134 89 { 135 // Destroy the content of the map136 90 std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos; 137 91 for (pos = tableData.begin(); pos != tableData.end(); ++pos) 138 {139 G4DNACrossSectionDataSet* table = pos->second;140 delete table;141 }92 { 93 G4DNACrossSectionDataSet* table = pos->second; 94 delete table; 95 } 142 96 } 143 97 144 98 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 145 99 146 100 G4double G4CrossSectionIonisationBorn::CrossSection(const G4Track& track ) … … 149 103 G4double k = particle->GetKineticEnergy(); 150 104 151 // Cross section = 0 outside the energy validity limits set in the constructor152 105 G4double sigma = 0.; 153 106 154 // ---- MGP ---- Better handling of these limits to be set in a following design iteration155 107 G4double lowLim = lowEnergyLimitDefault; 156 108 G4double highLim = highEnergyLimitDefault; … … 158 110 const G4String& particleName = particle->GetDefinition()->GetParticleName(); 159 111 160 // Retrieve energy limits for the current particle type 112 std::map< G4String,G4double,std::less<G4String> >::iterator pos1; 113 pos1 = lowEnergyLimit.find(particleName); 161 114 162 std::map< G4String,G4double,std::less<G4String> >::iterator pos1; 163 pos1 = lowEnergyLimit.find(particleName); 115 if (pos1 != lowEnergyLimit.end()) 116 { 117 lowLim = pos1->second; 118 } 164 119 165 // Lower limit 166 if (pos1 != lowEnergyLimit.end()) 120 std::map< G4String,G4double,std::less<G4String> >::iterator pos2; 121 pos2 = highEnergyLimit.find(particleName); 122 123 if (pos2 != highEnergyLimit.end()) 124 { 125 highLim = pos2->second; 126 } 127 128 if (k > lowLim && k < highLim) 129 { 130 std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos; 131 pos = tableData.find(particleName); 132 133 if (pos != tableData.end()) 134 { 135 G4DNACrossSectionDataSet* table = pos->second; 136 if (table != 0) 167 137 { 168 lowLim = pos1->second;138 sigma = table->FindValue(k); 169 139 } 140 } 141 else 142 { 143 G4Exception("G4CrossSectionIonisationBorn: attempting to calculate cross section for wrong particle"); 144 } 145 } 170 146 171 // Upper limit 172 std::map< G4String,G4double,std::less<G4String> >::iterator pos2; 173 pos2 = highEnergyLimit.find(particleName); 174 175 if (pos2 != highEnergyLimit.end()) 176 { 177 highLim = pos2->second; 178 } 179 180 // Verify that the current track is within the energy limits of validity of the cross section model 181 if (k > lowLim && k < highLim) 182 { 183 std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos; 184 pos = tableData.find(particleName); 185 186 if (pos != tableData.end()) 187 { 188 G4DNACrossSectionDataSet* table = pos->second; 189 if (table != 0) 190 { 191 // Cross section 192 sigma = table->FindValue(k); 193 } 194 } 195 else 196 { 197 // The track does not corresponds to a particle pertinent to this model 198 G4Exception("G4CrossSectionIonisationBorn: attempting to calculate cross section for wrong particle"); 199 } 200 } 201 202 return sigma; 147 return sigma; 203 148 } 204 149 -
trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionIonisationBornElectron.cc
r819 r961 26 26 // 27 27 // $Id: G4CrossSectionIonisationBornElectron.cc,v 1.2 2007/11/08 18:51:34 pia Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) -
trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionIonisationBornPartial.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4CrossSectionIonisationBornPartial.cc,v 1.3 2007/11/09 20:11:04 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 40 // ------------------------------------------------------------------- 41 42 // Class description: 43 // Geant4-DNA Cross total cross section for electron elastic scattering in water 44 // Reference: TNS Geant4-DNA paper 45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 46 // design foundation and implementation of the first set of models, 47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 48 // Further documentation available from http://www.ge.infn.it/geant4/dna 49 50 // ------------------------------------------------------------------- 51 26 // $Id: G4CrossSectionIonisationBornPartial.cc,v 1.5 2009/01/20 07:40:53 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 52 28 53 29 #include "G4CrossSectionIonisationBornPartial.hh" 54 #include "G4ParticleDefinition.hh" 55 #include "G4Electron.hh" 56 #include "G4Proton.hh" 57 #include "G4Track.hh" 58 #include "G4LogLogInterpolation.hh" 59 #include "G4SystemOfUnits.hh" 60 61 #include "Randomize.hh" 62 63 #include <utility> 30 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 64 32 65 33 G4CrossSectionIonisationBornPartial::G4CrossSectionIonisationBornPartial() 66 34 { 67 68 name = "IonisationBorn"; 69 70 // Default energy limits (defined for protection against anomalous behaviour only) 71 name = "IonisationBornPartial"; 72 lowEnergyLimitDefault = 25 * eV; 35 lowEnergyLimitDefault = 12.61 * eV; 73 36 highEnergyLimitDefault = 30 * keV; 74 37 … … 82 45 G4String proton; 83 46 84 // Factor to scale microscopic/macroscopic cross section data in water85 // ---- MGP ---- Hardcoded (taken from prototype code); to be replaced with proper calculation86 47 G4double scaleFactor = (1.e-22 / 3.343) * m*m; 87 48 88 89 // Data members for electrons90 91 49 if (electronDef != 0) 92 { 93 electron = electronDef->GetParticleName(); 94 tableFile[electron] = fileElectron; 95 96 // Energy limits 97 lowEnergyLimit[electron] = 25. * eV; 98 highEnergyLimit[electron] = 30. * keV; 99 100 // Create data set with electron cross section data and load values stored in file 101 G4DNACrossSectionDataSet* tableE = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor ); 102 tableE->LoadData(fileElectron); 50 { 51 electron = electronDef->GetParticleName(); 52 tableFile[electron] = fileElectron; 53 54 lowEnergyLimit[electron] = 12.61 * eV; 55 highEnergyLimit[electron] = 30. * keV; 56 57 G4DNACrossSectionDataSet* tableE = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor ); 58 tableE->LoadData(fileElectron); 103 59 104 // Insert key-table pair in map 105 tableData[electron] = tableE; 106 } 60 tableData[electron] = tableE; 61 } 107 62 else 108 { 109 G4Exception("G4CrossSectionIonisationBornPartial Constructor: electron is not defined"); 110 } 111 112 // Data members for protons 63 { 64 G4Exception("G4CrossSectionIonisationBornPartial Constructor: electron is not defined"); 65 } 113 66 114 67 if (protonDef != 0) 115 { 116 proton = protonDef->GetParticleName(); 117 tableFile[proton] = fileProton; 118 119 // Energy limits 120 lowEnergyLimit[proton] = 500. * keV; 121 highEnergyLimit[proton] = 10. * MeV; 122 123 // Create data set with proton cross section data and load values stored in file 124 G4DNACrossSectionDataSet* tableP = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor ); 125 tableP->LoadData(fileProton); 68 { 69 proton = protonDef->GetParticleName(); 70 tableFile[proton] = fileProton; 71 72 lowEnergyLimit[proton] = 500. * keV; 73 highEnergyLimit[proton] = 10. * MeV; 74 75 G4DNACrossSectionDataSet* tableP = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor ); 76 tableP->LoadData(fileProton); 126 77 127 // Insert key-table pair in map 128 tableData[proton] = tableP; 129 } 78 tableData[proton] = tableP; 79 } 130 80 else 131 { 132 G4Exception("G4CrossSectionIonisationBornPartial Constructor: proton is not defined"); 133 } 134 } 135 81 { 82 G4Exception("G4CrossSectionIonisationBornPartial Constructor: proton is not defined"); 83 } 84 } 85 86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 136 87 137 88 G4CrossSectionIonisationBornPartial::~G4CrossSectionIonisationBornPartial() 138 89 { 139 // Destroy the content of the map140 90 std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos; 141 91 for (pos = tableData.begin(); pos != tableData.end(); ++pos) 142 { 143 G4DNACrossSectionDataSet* table = pos->second; 144 delete table; 145 } 146 } 147 92 { 93 G4DNACrossSectionDataSet* table = pos->second; 94 delete table; 95 } 96 } 97 98 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 148 99 149 100 G4int G4CrossSectionIonisationBornPartial::RandomSelect(G4double k, const G4String& particle ) 150 101 { 151 152 102 G4int level = 0; 153 103 154 // Retrieve data table corresponding to the current particle type 155 156 std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos; 157 pos = tableData.find(particle); 158 159 if (pos != tableData.end()) 104 std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos; 105 pos = tableData.find(particle); 106 107 if (pos != tableData.end()) 108 { 109 G4DNACrossSectionDataSet* table = pos->second; 110 111 if (table != 0) 112 { 113 G4double* valuesBuffer = new G4double[table->NumberOfComponents()]; 114 const size_t n(table->NumberOfComponents()); 115 size_t i(n); 116 G4double value = 0.; 117 118 while (i>0) 119 { 120 i--; 121 valuesBuffer[i] = table->GetComponent(i)->FindValue(k); 122 value += valuesBuffer[i]; 123 } 124 125 value *= G4UniformRand(); 126 127 i = n; 128 129 while (i > 0) 160 130 { 161 G4DNACrossSectionDataSet* table = pos->second; 162 163 if (table != 0) 164 { 165 // C-style arrays are used in G4DNACrossSectionDataSet: this design feature was 166 // introduced without authorization and should be replaced by the use of STL containers 167 168 G4double* valuesBuffer = new G4double[table->NumberOfComponents()]; 169 170 const size_t n(table->NumberOfComponents()); 171 size_t i(n); 172 G4double value = 0.; 173 174 while (i>0) 175 { 176 i--; 177 valuesBuffer[i] = table->GetComponent(i)->FindValue(k); 178 value += valuesBuffer[i]; 179 } 180 181 value *= G4UniformRand(); 182 183 i = n; 184 185 while (i > 0) 186 { 187 i--; 188 189 if (valuesBuffer[i] > value) 190 { 191 delete[] valuesBuffer; 192 return i; 193 } 194 value -= valuesBuffer[i]; 195 } 196 197 // It should never end up here 198 199 // ---- MGP ---- Is the following line really necessary? 200 if (valuesBuffer) delete[] valuesBuffer; 201 202 } 131 i--; 132 133 if (valuesBuffer[i] > value) 134 { 135 delete[] valuesBuffer; 136 return i; 137 } 138 value -= valuesBuffer[i]; 203 139 } 204 else 205 { 206 G4Exception("G4CrossSectionIonisationBornPartial: attempting to calculate cross section for wrong particle"); 207 } 140 141 if (valuesBuffer) delete[] valuesBuffer; 142 143 } 144 } 145 else 146 { 147 G4Exception("G4CrossSectionIonisationBornPartial: attempting to calculate cross section for wrong particle"); 148 } 208 149 209 150 return level; 210 151 } 211 152 153 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 212 154 213 155 G4double G4CrossSectionIonisationBornPartial::CrossSection(const G4Track& track ) … … 218 160 G4double k = particle->GetKineticEnergy(); 219 161 220 // Cross section = 0 outside the energy validity limits set in the constructor221 // ---- MGP ---- Better handling of these limits to be set in a following design iteration222 223 162 G4double lowLim = lowEnergyLimitDefault; 224 163 G4double highLim = highEnergyLimitDefault; … … 226 165 const G4String& particleName = particle->GetDefinition()->GetParticleName(); 227 166 228 // Retrieve energy limits for the current particle type 229 230 std::map< G4String,G4double,std::less<G4String> >::iterator pos1; 231 pos1 = lowEnergyLimit.find(particleName); 232 233 // Lower limit 234 if (pos1 != lowEnergyLimit.end()) 235 { 236 lowLim = pos1->second; 237 } 238 239 // Upper limit 240 std::map< G4String,G4double,std::less<G4String> >::iterator pos2; 241 pos2 = highEnergyLimit.find(particleName); 242 243 if (pos2 != highEnergyLimit.end()) 244 { 245 highLim = pos2->second; 246 } 247 248 // Verify that the current track is within the energy limits of validity of the cross section model 249 if (k > lowLim && k < highLim) 250 { 251 std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos; 252 pos = tableData.find(particleName); 167 std::map< G4String,G4double,std::less<G4String> >::iterator pos1; 168 pos1 = lowEnergyLimit.find(particleName); 169 170 if (pos1 != lowEnergyLimit.end()) 171 { 172 lowLim = pos1->second; 173 } 174 175 std::map< G4String,G4double,std::less<G4String> >::iterator pos2; 176 pos2 = highEnergyLimit.find(particleName); 177 178 if (pos2 != highEnergyLimit.end()) 179 { 180 highLim = pos2->second; 181 } 182 183 if (k > lowLim && k < highLim) 184 { 185 std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos; 186 pos = tableData.find(particleName); 253 187 254 if (pos != tableData.end()) 255 { 256 G4DNACrossSectionDataSet* table = pos->second; 257 if (table != 0) 258 { 259 // ---- MGP ---- Temporary 260 // table->PrintData(); 261 262 // Cross section 263 sigma = table->FindValue(k); 264 } 265 } 266 else 267 { 268 // The track corresponds to a not pertinent particle 269 G4Exception("G4CrossSectionIonisationBornPartial: attempting to calculate cross section for wrong particle"); 270 } 271 } 272 273 return sigma; 274 } 275 188 if (pos != tableData.end()) 189 { 190 G4DNACrossSectionDataSet* table = pos->second; 191 if (table != 0) 192 { 193 sigma = table->FindValue(k); 194 } 195 } 196 else 197 { 198 G4Exception("G4CrossSectionIonisationBornPartial: attempting to calculate cross section for wrong particle"); 199 } 200 } 201 202 return sigma; 203 } 204 205 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 276 206 277 207 G4double G4CrossSectionIonisationBornPartial::Sum(G4double /* energy */, const G4String& /* particle */) 278 208 { 279 280 209 return 0; 281 210 } -
trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionIonisationBornPartialElectron.cc
r819 r961 26 26 // 27 27 // $Id: G4CrossSectionIonisationBornPartialElectron.cc,v 1.1 2007/10/15 08:57:54 pia Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) -
trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionIonisationRudd.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4CrossSectionIonisationRudd.cc,v 1.2 2007/11/09 16:20:16 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 40 // ------------------------------------------------------------------- 41 42 // Class description: 43 // Geant4-DNA Cross total cross section for electron elastic scattering in water 44 // Reference: TNS Geant4-DNA paper 45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 46 // design foundation and implementation of the first set of models, 47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 48 // Further documentation available from http://www.ge.infn.it/geant4/dna 49 50 // ------------------------------------------------------------------- 51 26 // $Id: G4CrossSectionIonisationRudd.cc,v 1.4 2008/07/14 20:47:34 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 52 28 53 29 #include "G4CrossSectionIonisationRudd.hh" 54 #include "G4ParticleDefinition.hh" 55 #include "G4Electron.hh" 56 #include "G4Proton.hh" 57 #include "G4Track.hh" 58 #include "G4LogLogInterpolation.hh" 59 #include "G4SystemOfUnits.hh" 60 #include "G4DNAGenericIonsManager.hh" 30 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 61 32 62 33 G4CrossSectionIonisationRudd::G4CrossSectionIonisationRudd() 63 34 { 64 65 name = "IonisationRudd";66 67 // Default energy limits (defined for protection against anomalous behaviour only)68 // ZERO LOW ENERGY LIMIT FOR ALLOWED KILLING69 35 lowEnergyLimitDefault = 0 * eV; 70 36 highEnergyLimitDefault = 100 * MeV; … … 90 56 G4String helium; 91 57 92 // Factor to scale microscopic/macroscopic cross section data in water93 // ---- MGP ---- Hardcoded (taken from prototype code); to be replaced with proper calculation94 58 G4double scaleFactor = 1 * m*m; 95 59 96 // Data members for protons97 98 60 if (protonDef != 0) 99 { 100 proton = protonDef->GetParticleName(); 101 tableFile[proton] = fileProton; 102 103 // Energy limits 104 lowEnergyLimit[proton] = 0. * eV; 105 highEnergyLimit[proton] = 500. * keV; 106 107 // Create data set with proton cross section data and load values stored in file 108 G4DNACrossSectionDataSet* tableProton = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, 61 { 62 proton = protonDef->GetParticleName(); 63 tableFile[proton] = fileProton; 64 65 lowEnergyLimit[proton] = 0. * eV; 66 highEnergyLimit[proton] = 500. * keV; 67 68 G4DNACrossSectionDataSet* tableProton = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, 109 69 eV, 110 70 scaleFactor ); 111 tableProton->LoadData(fileProton); 112 113 // Insert key-table pair in map 114 tableData[proton] = tableProton; 115 } 116 else 117 { 118 G4Exception("G4CrossSectionIonisationRudd Constructor: proton is not defined"); 119 } 120 121 // Data members for hydrogen 71 tableProton->LoadData(fileProton); 72 tableData[proton] = tableProton; 73 } 74 else 75 { 76 G4Exception("G4CrossSectionIonisationRudd Constructor: proton is not defined"); 77 } 122 78 123 79 if (hydrogenDef != 0) 124 { 125 hydrogen = hydrogenDef->GetParticleName(); 126 tableFile[hydrogen] = fileHydrogen; 127 128 // Energy limits 129 lowEnergyLimit[hydrogen] = 0. * eV; 130 highEnergyLimit[hydrogen] = 100. * MeV; 131 132 // Create data set with hydrogen cross section data and load values stored in file 133 G4DNACrossSectionDataSet* tableHydrogen = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, 80 { 81 hydrogen = hydrogenDef->GetParticleName(); 82 tableFile[hydrogen] = fileHydrogen; 83 84 lowEnergyLimit[hydrogen] = 0. * eV; 85 highEnergyLimit[hydrogen] = 100. * MeV; 86 87 G4DNACrossSectionDataSet* tableHydrogen = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, 134 88 eV, 135 89 scaleFactor ); 136 tableHydrogen->LoadData(fileHydrogen);90 tableHydrogen->LoadData(fileHydrogen); 137 91 138 // Insert key-table pair in map 139 tableData[hydrogen] = tableHydrogen; 140 } 141 else 142 { 143 G4Exception("G4CrossSectionIonisationRudd Constructor: hydrogen is not defined"); 144 } 145 146 // Data members for alphaPlusPlus 92 tableData[hydrogen] = tableHydrogen; 93 } 94 else 95 { 96 G4Exception("G4CrossSectionIonisationRudd Constructor: hydrogen is not defined"); 97 } 147 98 148 99 if (alphaPlusPlusDef != 0) 149 { 150 alphaPlusPlus = alphaPlusPlusDef->GetParticleName(); 151 tableFile[alphaPlusPlus] = fileAlphaPlusPlus; 152 153 // Energy limits 154 lowEnergyLimit[alphaPlusPlus] = 0. * keV; 155 highEnergyLimit[alphaPlusPlus] = 10. * MeV; 156 157 // Create data set with hydrogen cross section data and load values stored in file 158 G4DNACrossSectionDataSet* tableAlphaPlusPlus = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, 100 { 101 alphaPlusPlus = alphaPlusPlusDef->GetParticleName(); 102 tableFile[alphaPlusPlus] = fileAlphaPlusPlus; 103 104 lowEnergyLimit[alphaPlusPlus] = 0. * eV; 105 highEnergyLimit[alphaPlusPlus] = 10. * MeV; 106 107 G4DNACrossSectionDataSet* tableAlphaPlusPlus = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, 159 108 eV, 160 109 scaleFactor ); 161 tableAlphaPlusPlus->LoadData(fileAlphaPlusPlus);110 tableAlphaPlusPlus->LoadData(fileAlphaPlusPlus); 162 111 163 // Insert key-table pair in map 164 tableData[alphaPlusPlus] = tableAlphaPlusPlus; 165 } 166 else 167 { 168 G4Exception("G4CrossSectionIonisationRudd Constructor: alphaPlusPlus is not defined"); 169 } 170 171 // Data members for alphaPlus 112 tableData[alphaPlusPlus] = tableAlphaPlusPlus; 113 } 114 else 115 { 116 G4Exception("G4CrossSectionIonisationRudd Constructor: alphaPlusPlus is not defined"); 117 } 172 118 173 119 if (alphaPlusDef != 0) 174 { 175 alphaPlus = alphaPlusDef->GetParticleName(); 176 tableFile[alphaPlus] = fileAlphaPlus; 177 178 // Energy limits 179 lowEnergyLimit[alphaPlus] = 0. * keV; 180 highEnergyLimit[alphaPlus] = 10. * MeV; 181 182 // Create data set with hydrogen cross section data and load values stored in file 183 G4DNACrossSectionDataSet* tableAlphaPlus = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, 120 { 121 alphaPlus = alphaPlusDef->GetParticleName(); 122 tableFile[alphaPlus] = fileAlphaPlus; 123 124 lowEnergyLimit[alphaPlus] = 0. * eV; 125 highEnergyLimit[alphaPlus] = 10. * MeV; 126 127 G4DNACrossSectionDataSet* tableAlphaPlus = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, 184 128 eV, 185 129 scaleFactor ); 186 tableAlphaPlus->LoadData(fileAlphaPlus); 187 188 // Insert key-table pair in map 189 tableData[alphaPlus] = tableAlphaPlus; 190 } 191 else 192 { 193 G4Exception("G4CrossSectionIonisationRudd Constructor: alphaPlus is not defined"); 194 } 195 196 // Data members for helium 130 tableAlphaPlus->LoadData(fileAlphaPlus); 131 tableData[alphaPlus] = tableAlphaPlus; 132 } 133 else 134 { 135 G4Exception("G4CrossSectionIonisationRudd Constructor: alphaPlus is not defined"); 136 } 197 137 198 138 if (heliumDef != 0) 199 { 200 helium = heliumDef->GetParticleName(); 201 tableFile[helium] = fileHelium; 202 203 // Energy limits 204 lowEnergyLimit[helium] = 0. * keV; 205 highEnergyLimit[helium] = 10. * MeV; 206 207 // Create data set with hydrogen cross section data and load values stored in file 208 G4DNACrossSectionDataSet* tableHelium = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, 139 { 140 helium = heliumDef->GetParticleName(); 141 tableFile[helium] = fileHelium; 142 143 lowEnergyLimit[helium] = 0. * eV; 144 highEnergyLimit[helium] = 10. * MeV; 145 146 G4DNACrossSectionDataSet* tableHelium = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, 209 147 eV, 210 148 scaleFactor ); 211 tableHelium->LoadData(fileHelium); 212 213 // Insert key-table pair in map 214 tableData[helium] = tableHelium; 149 tableHelium->LoadData(fileHelium); 150 tableData[helium] = tableHelium; 215 151 } 216 152 else 217 {218 G4Exception("G4CrossSectionIonisationRudd Constructor: helium is not defined");219 }153 { 154 G4Exception("G4CrossSectionIonisationRudd Constructor: helium is not defined"); 155 } 220 156 } 221 157 158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 222 159 223 160 G4CrossSectionIonisationRudd::~G4CrossSectionIonisationRudd() 224 161 { 225 // Destroy the content of the map226 162 std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos; 227 163 for (pos = tableData.begin(); pos != tableData.end(); ++pos) 228 {229 G4DNACrossSectionDataSet* table = pos->second;230 delete table;231 }164 { 165 G4DNACrossSectionDataSet* table = pos->second; 166 delete table; 167 } 232 168 } 233 169 234 170 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 235 171 236 172 G4double G4CrossSectionIonisationRudd::CrossSection(const G4Track& track ) … … 252 188 && 253 189 track.GetDefinition() != instance->GetIon("helium") 254 )190 ) 255 191 256 192 G4Exception("G4CrossSectionIonisationRudd: attempting to calculate cross section for wrong particle"); 257 193 258 // Cross section = 0 outside the energy validity limits set in the constructor259 194 G4double sigma = 0.; 260 195 261 // ---- MGP ---- Better handling of these limits to be set in a following design iteration262 196 G4double lowLim = lowEnergyLimitDefault; 263 197 G4double highLim = highEnergyLimitDefault; … … 265 199 const G4String& particleName = particle->GetDefinition()->GetParticleName(); 266 200 267 // Retrieve energy limits for the current particle type268 269 201 std::map< G4String,G4double,std::less<G4String> >::iterator pos1; 270 202 pos1 = lowEnergyLimit.find(particleName); 271 203 272 // Lower limit273 204 if (pos1 != lowEnergyLimit.end()) 274 { 275 lowLim = pos1->second; 276 } 277 278 // Upper limit 205 { 206 lowLim = pos1->second; 207 } 208 279 209 std::map< G4String,G4double,std::less<G4String> >::iterator pos2; 280 210 pos2 = highEnergyLimit.find(particleName); 281 211 282 212 if (pos2 != highEnergyLimit.end()) 213 { 214 highLim = pos2->second; 215 } 216 217 if (k >= lowLim && k <= highLim) 218 { 219 std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos; 220 pos = tableData.find(particleName); 221 222 if (pos != tableData.end()) 283 223 { 284 highLim = pos2->second; 285 } 286 287 // Verify that the current track is within the energy limits of validity of the cross section model 288 if (k >= lowLim && k <= highLim) 289 { 290 std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos; 291 pos = tableData.find(particleName); 292 293 if (pos != tableData.end()) 294 { 295 G4DNACrossSectionDataSet* table = pos->second; 296 if (table != 0) 297 { 298 // Cross section 224 G4DNACrossSectionDataSet* table = pos->second; 225 if (table != 0) 226 { 299 227 sigma = table->FindValue(k); 300 301 228 302 229 // BEGIN ELECTRON CORRECTION … … 307 234 particle->GetDefinition() == instance->GetIon("helium") 308 235 ) 309 {236 { 310 237 311 238 G4DNACrossSectionDataSet* electronDataset = new G4DNACrossSectionDataSet … … 317 244 318 245 if ( particle->GetDefinition() == instance->GetIon("alpha+") ) 319 {246 { 320 247 G4double tmp1 = table->FindValue(k) + electronDataset->FindValue(kElectron); 321 248 delete electronDataset; 322 249 return tmp1; 323 }250 } 324 251 325 252 if ( particle->GetDefinition() == instance->GetIon("helium") ) 326 {253 { 327 254 G4double tmp2 = table->FindValue(k) + 2. * electronDataset->FindValue(kElectron); 328 255 delete electronDataset; 329 256 return tmp2; 330 }331 }257 } 258 } 332 259 333 260 // END ELECTRON CORRECTION 334 335 } 336 } 337 else 338 { 339 // The track does not corresponds to a particle pertinent to this model 340 G4Exception("G4CrossSectionIonisationRudd: attempting to calculate cross section for wrong particle"); 341 } 261 } 342 262 } 263 else 264 { 265 G4Exception("G4CrossSectionIonisationRudd: attempting to calculate cross section for wrong particle"); 266 } 267 } 343 268 344 269 return sigma; -
trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionIonisationRuddPartial.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4CrossSectionIonisationRuddPartial.cc,v 1.3 2007/11/09 20:11:04 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 40 // ------------------------------------------------------------------- 41 42 // Class description: 43 // Geant4-DNA Cross total cross section for electron elastic scattering in water 44 // Reference: TNS Geant4-DNA paper 45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 46 // design foundation and implementation of the first set of models, 47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 48 // Further documentation available from http://www.ge.infn.it/geant4/dna 49 50 // ------------------------------------------------------------------- 51 26 // $Id: G4CrossSectionIonisationRuddPartial.cc,v 1.4 2008/07/14 20:47:34 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 52 28 53 29 #include "G4CrossSectionIonisationRuddPartial.hh" 54 #include "G4ParticleDefinition.hh" 55 #include "G4Electron.hh" 56 #include "G4Proton.hh" 57 #include "G4Track.hh" 58 #include "G4LogLogInterpolation.hh" 59 #include "G4SystemOfUnits.hh" 60 #include "G4DNAGenericIonsManager.hh" 61 62 #include "Randomize.hh" 63 64 #include <utility> 30 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 65 32 66 33 G4CrossSectionIonisationRuddPartial::G4CrossSectionIonisationRuddPartial() 67 34 { 68 name = "IonisationRudd";69 70 // Default energy limits (defined for protection against anomalous behaviour only)71 name = "IonisationRuddPartial";72 35 lowEnergyLimitDefault = 100 * eV; 73 36 highEnergyLimitDefault = 100 * MeV; … … 93 56 G4String helium; 94 57 95 // Factor to scale microscopic/macroscopic cross section data in water96 // ---- MGP ---- Hardcoded (taken from prototype code); to be replaced with proper calculation97 58 G4double scaleFactor = 1 * m*m; 98 59 99 // Data members for protons100 101 60 if (protonDef != 0) 102 { 103 proton = protonDef->GetParticleName(); 104 tableFile[proton] = fileProton; 105 106 // Energy limits 107 lowEnergyLimit[proton] = 100. * eV; 108 highEnergyLimit[proton] = 500. * keV; 109 110 // Create data set with proton cross section data and load values stored in file 111 G4DNACrossSectionDataSet* tableProton = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor ); 112 tableProton->LoadData(fileProton); 113 114 // Insert key-table pair in map 115 tableData[proton] = tableProton; 116 } 117 else 118 { 119 G4Exception("G4CrossSectionIonisationRudd Constructor: proton is not defined"); 120 } 121 122 // Data members for hydrogen 61 { 62 proton = protonDef->GetParticleName(); 63 tableFile[proton] = fileProton; 64 65 lowEnergyLimit[proton] = 100. * eV; 66 highEnergyLimit[proton] = 500. * keV; 67 68 G4DNACrossSectionDataSet* tableProton = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor ); 69 tableProton->LoadData(fileProton); 70 71 tableData[proton] = tableProton; 72 } 73 else 74 { 75 G4Exception("G4CrossSectionIonisationRudd Constructor: proton is not defined"); 76 } 123 77 124 78 if (hydrogenDef != 0) 125 { 126 hydrogen = hydrogenDef->GetParticleName(); 127 tableFile[hydrogen] = fileHydrogen; 128 129 // Energy limits 130 lowEnergyLimit[hydrogen] = 100. * eV; 131 highEnergyLimit[hydrogen] = 100. * MeV; 132 133 // Create data set with hydrogen cross section data and load values stored in file 134 G4DNACrossSectionDataSet* tableHydrogen = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor ); 135 tableHydrogen->LoadData(fileHydrogen); 136 137 // Insert key-table pair in map 138 tableData[hydrogen] = tableHydrogen; 139 } 140 else 141 { 142 G4Exception("G4CrossSectionIonisationRudd Constructor: hydrogen is not defined"); 143 } 144 145 // Data members for alphaPlusPlus 79 { 80 hydrogen = hydrogenDef->GetParticleName(); 81 tableFile[hydrogen] = fileHydrogen; 82 83 lowEnergyLimit[hydrogen] = 100. * eV; 84 highEnergyLimit[hydrogen] = 100. * MeV; 85 86 G4DNACrossSectionDataSet* tableHydrogen = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor ); 87 tableHydrogen->LoadData(fileHydrogen); 88 89 tableData[hydrogen] = tableHydrogen; 90 } 91 else 92 { 93 G4Exception("G4CrossSectionIonisationRudd Constructor: hydrogen is not defined"); 94 } 146 95 147 96 if (alphaPlusPlusDef != 0) 148 { 149 alphaPlusPlus = alphaPlusPlusDef->GetParticleName(); 150 tableFile[alphaPlusPlus] = fileAlphaPlusPlus; 151 152 // Energy limits 153 lowEnergyLimit[alphaPlusPlus] = 1. * keV; 154 highEnergyLimit[alphaPlusPlus] = 10. * MeV; 155 156 // Create data set with hydrogen cross section data and load values stored in file 157 G4DNACrossSectionDataSet* tableAlphaPlusPlus = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor ); 158 tableAlphaPlusPlus->LoadData(fileAlphaPlusPlus); 159 160 // Insert key-table pair in map 161 tableData[alphaPlusPlus] = tableAlphaPlusPlus; 162 } 163 else 164 { 165 G4Exception("G4CrossSectionIonisationRudd Constructor: alphaPlusPlus is not defined"); 166 } 167 168 // Data members for alphaPlus 97 { 98 alphaPlusPlus = alphaPlusPlusDef->GetParticleName(); 99 tableFile[alphaPlusPlus] = fileAlphaPlusPlus; 100 101 lowEnergyLimit[alphaPlusPlus] = 1. * keV; 102 highEnergyLimit[alphaPlusPlus] = 10. * MeV; 103 104 G4DNACrossSectionDataSet* tableAlphaPlusPlus = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor ); 105 tableAlphaPlusPlus->LoadData(fileAlphaPlusPlus); 106 107 tableData[alphaPlusPlus] = tableAlphaPlusPlus; 108 } 109 else 110 { 111 G4Exception("G4CrossSectionIonisationRudd Constructor: alphaPlusPlus is not defined"); 112 } 169 113 170 114 if (alphaPlusDef != 0) 171 { 172 alphaPlus = alphaPlusDef->GetParticleName(); 173 tableFile[alphaPlus] = fileAlphaPlus; 174 175 // Energy limits 176 lowEnergyLimit[alphaPlus] = 1. * keV; 177 highEnergyLimit[alphaPlus] = 10. * MeV; 178 179 // Create data set with hydrogen cross section data and load values stored in file 180 G4DNACrossSectionDataSet* tableAlphaPlus = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor ); 181 tableAlphaPlus->LoadData(fileAlphaPlus); 182 183 // Insert key-table pair in map 184 tableData[alphaPlus] = tableAlphaPlus; 185 } 186 else 187 { 188 G4Exception("G4CrossSectionIonisationRudd Constructor: alphaPlus is not defined"); 189 } 190 191 // Data members for helium 115 { 116 alphaPlus = alphaPlusDef->GetParticleName(); 117 tableFile[alphaPlus] = fileAlphaPlus; 118 119 lowEnergyLimit[alphaPlus] = 1. * keV; 120 highEnergyLimit[alphaPlus] = 10. * MeV; 121 122 G4DNACrossSectionDataSet* tableAlphaPlus = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor ); 123 tableAlphaPlus->LoadData(fileAlphaPlus); 124 125 tableData[alphaPlus] = tableAlphaPlus; 126 } 127 else 128 { 129 G4Exception("G4CrossSectionIonisationRudd Constructor: alphaPlus is not defined"); 130 } 192 131 193 132 if (heliumDef != 0) 194 { 195 helium = heliumDef->GetParticleName(); 196 tableFile[helium] = fileHelium; 197 198 // Energy limits 199 lowEnergyLimit[helium] = 1. * keV; 200 highEnergyLimit[helium] = 10. * MeV; 201 202 // Create data set with hydrogen cross section data and load values stored in file 203 G4DNACrossSectionDataSet* tableHelium = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor ); 204 tableHelium->LoadData(fileHelium); 205 206 // Insert key-table pair in map 207 tableData[helium] = tableHelium; 208 } 209 else 210 { 211 G4Exception("G4CrossSectionIonisationRudd Constructor: helium is not defined"); 212 } 213 } 214 133 { 134 helium = heliumDef->GetParticleName(); 135 tableFile[helium] = fileHelium; 136 137 lowEnergyLimit[helium] = 1. * keV; 138 highEnergyLimit[helium] = 10. * MeV; 139 140 G4DNACrossSectionDataSet* tableHelium = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor ); 141 tableHelium->LoadData(fileHelium); 142 143 tableData[helium] = tableHelium; 144 } 145 else 146 { 147 G4Exception("G4CrossSectionIonisationRudd Constructor: helium is not defined"); 148 } 149 } 150 151 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 215 152 216 153 G4CrossSectionIonisationRuddPartial::~G4CrossSectionIonisationRuddPartial() 217 154 { 218 // Destroy the content of the map219 155 std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos; 220 156 for (pos = tableData.begin(); pos != tableData.end(); ++pos) 221 { 222 G4DNACrossSectionDataSet* table = pos->second; 223 delete table; 224 } 225 } 226 157 { 158 G4DNACrossSectionDataSet* table = pos->second; 159 delete table; 160 } 161 } 162 163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 227 164 228 165 G4int G4CrossSectionIonisationRuddPartial::RandomSelect(G4double k, const G4String& particle ) … … 243 180 particle == instance->GetIon("helium")->GetParticleName() 244 181 ) 245 {182 { 246 183 electronDataset->LoadData("dna/sigma_ionisation_e_born"); 247 184 … … 250 187 electronComponent = electronDataset->FindValue(kElectron); 251 188 252 }189 } 253 190 254 191 delete electronDataset; … … 264 201 265 202 if (pos != tableData.end()) 266 {203 { 267 204 G4DNACrossSectionDataSet* table = pos->second; 268 205 269 206 if (table != 0) 270 { 271 // C-style arrays are used in G4DNACrossSectionDataSet: this design feature was 272 // introduced without authorization and should be replaced by the use of STL containers 273 207 { 274 208 G4double* valuesBuffer = new G4double[table->NumberOfComponents()]; 275 209 … … 279 213 280 214 while (i>0) 281 {215 { 282 216 i--; 283 217 valuesBuffer[i] = table->GetComponent(i)->FindValue(k); … … 294 228 295 229 value += valuesBuffer[i]; 296 }230 } 297 231 298 232 value *= G4UniformRand(); … … 301 235 302 236 while (i > 0) 303 {237 { 304 238 i--; 305 239 306 240 if (valuesBuffer[i] > value) 307 {241 { 308 242 delete[] valuesBuffer; 309 243 return i; 310 }244 } 311 245 value -= valuesBuffer[i]; 312 } 313 314 // It should never end up here 315 316 // ---- MGP ---- Is the following line really necessary? 246 } 247 317 248 if (valuesBuffer) delete[] valuesBuffer; 318 249 319 }320 }321 else 322 {323 G4Exception("G4CrossSectionIonisationRuddPartial: attempting to calculate cross section for wrong particle");324 }250 } 251 } 252 else 253 { 254 G4Exception("G4CrossSectionIonisationRuddPartial: attempting to calculate cross section for wrong particle"); 255 } 325 256 326 257 return level; 327 258 } 328 259 260 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 329 261 330 262 G4double G4CrossSectionIonisationRuddPartial::CrossSection(const G4Track& track ) … … 335 267 G4double k = particle->GetKineticEnergy(); 336 268 337 // Cross section = 0 outside the energy validity limits set in the constructor338 // ---- MGP ---- Better handling of these limits to be set in a following design iteration339 340 269 G4double lowLim = lowEnergyLimitDefault; 341 270 G4double highLim = highEnergyLimitDefault; … … 343 272 const G4String& particleName = particle->GetDefinition()->GetParticleName(); 344 273 345 // Retrieve energy limits for the current particle type346 347 274 std::map< G4String,G4double,std::less<G4String> >::iterator pos1; 348 275 pos1 = lowEnergyLimit.find(particleName); 349 276 350 // Lower limit351 277 if (pos1 != lowEnergyLimit.end()) 352 { 353 lowLim = pos1->second; 354 } 355 356 // Upper limit 278 { 279 lowLim = pos1->second; 280 } 281 357 282 std::map< G4String,G4double,std::less<G4String> >::iterator pos2; 358 283 pos2 = highEnergyLimit.find(particleName); 359 284 360 285 if (pos2 != highEnergyLimit.end()) 361 { 362 highLim = pos2->second; 363 } 364 365 // Verify that the current track is within the energy limits of validity of the cross section model 286 { 287 highLim = pos2->second; 288 } 289 366 290 if (k >= lowLim && k <= highLim) 367 {291 { 368 292 std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos; 369 293 pos = tableData.find(particleName); 370 294 371 295 if (pos != tableData.end()) 372 {296 { 373 297 G4DNACrossSectionDataSet* table = pos->second; 374 298 if (table != 0) 375 { 376 // ---- MGP ---- Temporary 377 // table->PrintData(); 378 379 // Cross section 299 { 380 300 sigma = table->FindValue(k); 381 }382 }301 } 302 } 383 303 else 384 { 385 // The track corresponds to a not pertinent particle 304 { 386 305 G4Exception("G4CrossSectionIonisationRuddPartial: attempting to calculate cross section for wrong particle"); 387 }388 }306 } 307 } 389 308 390 309 return sigma; 391 310 } 392 311 312 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 393 313 394 314 G4double G4CrossSectionIonisationRuddPartial::Sum(G4double /* energy */, const G4String& /* particle */) 395 315 { 396 397 316 return 0; 398 317 } -
trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionKill.cc
r819 r961 26 26 // 27 27 // $Id: G4CrossSectionKill.cc,v 1.1 2007/11/09 20:26:12 pia Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) -
trunk/source/processes/electromagnetic/lowenergy/src/G4DNACrossSectionDataSet.cc
r819 r961 27 27 28 28 // $Id: G4DNACrossSectionDataSet.cc,v 1.7 2007/11/09 18:06:26 pia Exp $ 29 // GEANT4 tag $Name: $29 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 30 30 // 31 31 // Author: Riccardo Capra <capra@ge.infn.it> -
trunk/source/processes/electromagnetic/lowenergy/src/G4DNAGenericIonsManager.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4DNAGenericIonsManager.cc,v 1.4 2006/06/29 19:39:24 gunter Exp $ 28 // GEANT4 tag $Name: $ 26 // $Id: G4DNAGenericIonsManager.cc,v 1.5 2008/07/16 19:01:07 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 28 30 29 #include "G4DNAGenericIonsManager.hh" … … 32 31 #include "G4Ions.hh" 33 32 34 G4DNAGenericIonsManager * G4DNAGenericIonsManager :: Instance(void) 33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 34 35 G4DNAGenericIonsManager * G4DNAGenericIonsManager :: Instance(void) 35 36 { 36 37 if (!theInstance) … … 40 41 } 41 42 42 G4ParticleDefinition * G4DNAGenericIonsManager :: GetIon(const G4String & name) 43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 44 45 G4ParticleDefinition * G4DNAGenericIonsManager :: GetIon(const G4String & name) 43 46 { 44 47 IonsMap::const_iterator i(map.find(name)); … … 47 50 return 0; 48 51 49 // return map[name];50 51 52 return i->second; 52 53 } 53 54 54 G4DNAGenericIonsManager :: G4DNAGenericIonsManager() 55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 56 57 G4DNAGenericIonsManager :: G4DNAGenericIonsManager() 55 58 { 56 59 // name mass width charge … … 60 63 // stable lifetime decay table 61 64 62 63 65 G4Ions *helium; 64 66 G4Ions *hydrogen; 65 67 G4Ions *alphaPlus; 68 G4Ions *positronium1s; 69 G4Ions *positronium2s; 66 70 67 71 helium= new G4Ions("helium", 3.727417*GeV, 0.0*MeV, +0.0*eplus, … … 83 87 0, 0, 0, 84 88 "nucleus", +1, +1, 0, 85 true, -1.0, 0, false, 89 true, -1.0, 0, false, 90 "", 0, 0.0); 91 92 positronium1s= new G4Ions("Ps-1s", 2*electron_mass_c2, 0.0*MeV, +0.0*eplus, 93 0, 0, 0, 94 0, 0, 0, 95 "nucleus", 0, 0, 0, 96 true, -1.0, 0, false, 97 "", 0, 0.0); 98 99 positronium2s= new G4Ions("Ps-2s", 2*electron_mass_c2, 0.0*MeV, +0.0*eplus, 100 0, 0, 0, 101 0, 0, 0, 102 "nucleus", 0, 0, 0, 103 true, -1.0, 0, false, 86 104 "", 0, 0.0); 87 105 … … 90 108 map["alpha+"]=alphaPlus; 91 109 map["alpha++"]=G4Alpha::Alpha(); 110 map["Ps-1s"]=positronium1s; 111 map["Ps-2s"]=positronium2s; 112 92 113 } 93 114 115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 94 116 95 G4DNAGenericIonsManager * G4DNAGenericIonsManager::theInstance(0);117 G4DNAGenericIonsManager * G4DNAGenericIonsManager::theInstance(0); 96 118 -
trunk/source/processes/electromagnetic/lowenergy/src/G4DummyFinalState.cc
r819 r961 26 26 // 27 27 // $Id: G4DummyFinalState.cc,v 1.2 2007/10/15 08:36:35 pia Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) -
trunk/source/processes/electromagnetic/lowenergy/src/G4EMDataSet.cc
r819 r961 25 25 // 26 26 // 27 // $Id: G4EMDataSet.cc,v 1.1 2 2006/06/29 19:39:44 gunterExp $28 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $27 // $Id: G4EMDataSet.cc,v 1.18 2008/03/17 13:40:53 pia Exp $ 28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) … … 40 40 #include <fstream> 41 41 #include <sstream> 42 43 G4EMDataSet :: G4EMDataSet(G4int argZ, G4VDataSetAlgorithm * argAlgorithm, G4double argUnitEnergies, G4double argUnitData) 44 : 45 z(argZ), 46 energies(0), 47 data(0), 48 algorithm(argAlgorithm), 49 unitEnergies(argUnitEnergies), 50 unitData(argUnitData) 51 { 52 if (algorithm == 0) 53 G4Exception("G4EMDataSet::G4EMDataSet - interpolation == 0"); 54 } 55 56 57 58 G4EMDataSet :: G4EMDataSet(G4int argZ, G4DataVector * argEnergies, G4DataVector * argData, G4VDataSetAlgorithm * argAlgorithm, G4double argUnitEnergies, G4double argUnitData) 59 : 60 z(argZ), 61 energies(argEnergies), 62 data(argData), 63 algorithm(argAlgorithm), 64 unitEnergies(argUnitEnergies), 65 unitData(argUnitData) 66 { 67 if (algorithm==0) 68 G4Exception("G4EMDataSet::G4EMDataSet - interpolation == 0"); 69 70 if ((energies==0) ^ (data==0)) 71 G4Exception("G4EMDataSet::G4EMDataSet - different size for energies and data (zero case)"); 72 73 if (energies==0) 74 return; 75 76 if (energies->size()!=data->size()) 77 G4Exception("G4EMDataSet::G4EMDataSet - different size for energies and data"); 78 } 79 80 81 82 G4EMDataSet :: ~G4EMDataSet() 42 #include "G4Integrator.hh" 43 #include "Randomize.hh" 44 #include "G4LinInterpolation.hh" 45 46 47 G4EMDataSet::G4EMDataSet(G4int Z, 48 G4VDataSetAlgorithm* algo, 49 G4double xUnit, 50 G4double yUnit, 51 G4bool random): 52 z(Z), 53 energies(0), 54 data(0), 55 algorithm(algo), 56 unitEnergies(xUnit), 57 unitData(yUnit), 58 pdf(0), 59 randomSet(random) 60 { 61 if (algorithm == 0) G4Exception("G4EMDataSet::G4EMDataSet - interpolation == 0"); 62 if (randomSet) BuildPdf(); 63 } 64 65 G4EMDataSet::G4EMDataSet(G4int argZ, 66 G4DataVector* dataX, 67 G4DataVector* dataY, 68 G4VDataSetAlgorithm* algo, 69 G4double xUnit, 70 G4double yUnit, 71 G4bool random): 72 z(argZ), 73 energies(dataX), 74 data(dataY), 75 algorithm(algo), 76 unitEnergies(xUnit), 77 unitData(yUnit), 78 pdf(0), 79 randomSet(random) 80 { 81 if (algorithm == 0) G4Exception("G4EMDataSet::G4EMDataSet - interpolation == 0"); 82 83 if ((energies == 0) ^ (data == 0)) 84 G4Exception("G4EMDataSet::G4EMDataSet - different size for energies and data (zero case)"); 85 86 if (energies == 0) return; 87 88 if (energies->size() != data->size()) 89 G4Exception("G4EMDataSet::G4EMDataSet - different size for energies and data"); 90 91 if (randomSet) BuildPdf(); 92 } 93 94 G4EMDataSet::~G4EMDataSet() 83 95 { 84 delete algorithm; 85 86 if (energies) 87 delete energies; 88 89 if (data) 90 delete data; 91 } 92 93 94 95 96 97 G4double G4EMDataSet :: FindValue(G4double argEnergy, G4int /* argComponentId */) const 98 { 99 if (!energies) 100 G4Exception("G4EMDataSet::FindValue - energies == 0"); 101 102 if (energies->empty()) 103 return 0; 104 105 if (argEnergy <= (*energies)[0]) 106 return (*data)[0]; 107 108 size_t i(energies->size()-1); 109 110 if (argEnergy >= (*energies)[i]) 111 return (*data)[i]; 112 113 return algorithm->Calculate(argEnergy, FindLowerBound(argEnergy), *energies, *data); 114 } 115 116 117 118 119 120 void G4EMDataSet :: PrintData(void) const 121 { 122 if (!energies) 123 { 124 G4cout << "Data not available." << G4endl; 125 return; 126 } 127 128 size_t size = energies->size(); 129 130 for (size_t i(0); i<size; i++) 131 G4cout << "Point: " << ((*energies)[i]/unitEnergies) 132 << " - Data value : " << ((*data)[i]/unitData) << G4endl; 133 } 134 135 136 137 138 139 void G4EMDataSet :: SetEnergiesData(G4DataVector * argEnergies, G4DataVector * argData, G4int /* argComponentId */) 140 { 141 if (energies) 142 delete energies; 143 energies=argEnergies; 144 145 if (data) 146 delete data; 147 data=argData; 148 149 if ((energies==0) ^ (data==0)) 150 G4Exception("G4EMDataSet::SetEnergiesData - different size for energies and data (zero case)"); 151 152 if (energies==0) 153 return; 154 155 if (energies->size()!=data->size()) 156 G4Exception("G4EMDataSet::SetEnergiesData - different size for energies and data"); 157 } 158 159 160 161 162 163 G4bool G4EMDataSet :: LoadData(const G4String & argFileName) 164 { 165 // The file is organized into two columns: 166 // 1st column is the energy 167 // 2nd column is the corresponding value 168 // The file terminates with the pattern: -1 -1 169 // -2 -2 170 171 G4String fullFileName(FullFileName(argFileName)); 172 std::ifstream in(fullFileName); 173 174 if (!in.is_open()) 175 { 176 G4String message("G4EMDataSet::LoadData - data file \""); 177 message+=fullFileName; 178 message+="\" not found"; 179 G4Exception(message); 180 } 181 182 G4DataVector * argEnergies=new G4DataVector; 183 G4DataVector * argData=new G4DataVector; 184 185 G4double a; 186 bool energyColumn(true); 187 188 do 189 { 190 in >> a; 191 192 if (a!=-1 && a!=-2) 193 { 194 if (energyColumn) 195 argEnergies->push_back(a*unitEnergies); 196 else 197 argData->push_back(a*unitData); 198 energyColumn=(!energyColumn); 199 } 200 } 201 while (a != -2); 202 203 SetEnergiesData(argEnergies, argData, 0); 204 205 return true; 206 } 207 208 209 210 G4bool G4EMDataSet :: SaveData(const G4String & argFileName) const 211 { 212 // The file is organized into two columns: 213 // 1st column is the energy 214 // 2nd column is the corresponding value 215 // The file terminates with the pattern: -1 -1 216 // -2 -2 217 218 G4String fullFileName(FullFileName(argFileName)); 219 std::ofstream out(fullFileName); 220 221 if (!out.is_open()) 222 { 223 G4String message("G4EMDataSet::SaveData - cannot open \""); 224 message+=fullFileName; 225 message+="\""; 226 G4Exception(message); 227 } 228 229 out.precision(10); 230 out.width(15); 231 out.setf(std::ofstream::left); 232 233 if (energies!=0 && data!=0) 234 { 235 G4DataVector::const_iterator i(energies->begin()); 236 G4DataVector::const_iterator endI(energies->end()); 237 G4DataVector::const_iterator j(data->begin()); 238 239 while (i!=endI) 240 { 241 out.precision(10); 242 out.width(15); 243 out.setf(std::ofstream::left); 244 out << ((*i)/unitEnergies) << ' '; 245 246 out.precision(10); 247 out.width(15); 248 out.setf(std::ofstream::left); 249 out << ((*j)/unitData) << std::endl; 250 251 i++; 252 j++; 253 } 254 } 255 256 out.precision(10); 257 out.width(15); 258 out.setf(std::ofstream::left); 259 out << -1.f << ' '; 260 261 out.precision(10); 262 out.width(15); 263 out.setf(std::ofstream::left); 264 out << -1.f << std::endl; 265 266 out.precision(10); 267 out.width(15); 268 out.setf(std::ofstream::left); 269 out << -2.f << ' '; 270 271 out.precision(10); 272 out.width(15); 273 out.setf(std::ofstream::left); 274 out << -2.f << std::endl; 275 276 return true; 277 } 278 279 280 281 282 283 size_t G4EMDataSet :: FindLowerBound(G4double argEnergy) const 284 { 285 size_t lowerBound(0); 286 size_t upperBound(energies->size() - 1); 287 288 while (lowerBound <= upperBound) 289 { 290 size_t midBin((lowerBound + upperBound)/2); 291 292 if (argEnergy < (*energies)[midBin]) 293 upperBound = midBin-1; 96 delete algorithm; 97 if (energies) delete energies; 98 if (data) delete data; 99 if (pdf) delete pdf; 100 } 101 102 G4double G4EMDataSet::FindValue(G4double energy, G4int /* componentId */) const 103 { 104 if (!energies) G4Exception("G4EMDataSet::FindValue - energies == 0"); 105 if (energies->empty()) return 0; 106 if (energy <= (*energies)[0]) return (*data)[0]; 107 108 size_t i = energies->size()-1; 109 if (energy >= (*energies)[i]) return (*data)[i]; 110 111 return algorithm->Calculate(energy, FindLowerBound(energy), *energies, *data); 112 } 113 114 115 void G4EMDataSet::PrintData(void) const 116 { 117 if (!energies) 118 { 119 G4cout << "Data not available." << G4endl; 120 } 294 121 else 295 lowerBound = midBin+1; 296 } 297 298 return upperBound; 299 } 300 301 302 303 304 305 G4String G4EMDataSet :: FullFileName(const G4String & argFileName) const 306 { 307 char* path = getenv("G4LEDATA"); 308 if (!path) 309 G4Exception("G4EMDataSet::FullFileName - G4LEDATA environment variable not set"); 310 311 std::ostringstream fullFileName; 312 313 fullFileName << path << '/' << argFileName << z << ".dat"; 122 { 123 size_t size = energies->size(); 124 for (size_t i(0); i<size; i++) 125 { 126 G4cout << "Point: " << ((*energies)[i]/unitEnergies) 127 << " - Data value: " << ((*data)[i]/unitData); 128 if (pdf != 0) G4cout << " - PDF : " << (*pdf)[i]; 129 G4cout << G4endl; 130 } 131 } 132 } 133 134 135 void G4EMDataSet::SetEnergiesData(G4DataVector* dataX, 136 G4DataVector* dataY, 137 G4int /* componentId */) 138 { 139 if (energies) delete energies; 140 energies = dataX; 141 142 if (data) delete data; 143 data = dataY; 144 145 if ((energies == 0) ^ (data==0)) 146 G4Exception("G4EMDataSet::SetEnergiesData - different size for energies and data (zero case)"); 147 148 if (energies == 0) return; 149 150 if (energies->size() != data->size()) 151 G4Exception("G4EMDataSet::SetEnergiesData - different size for energies and data"); 152 } 153 154 G4bool G4EMDataSet::LoadData(const G4String& fileName) 155 { 156 // The file is organized into two columns: 157 // 1st column is the energy 158 // 2nd column is the corresponding value 159 // The file terminates with the pattern: -1 -1 160 // -2 -2 161 162 G4String fullFileName(FullFileName(fileName)); 163 std::ifstream in(fullFileName); 164 165 if (!in.is_open()) 166 { 167 G4String message("G4EMDataSet::LoadData - data file \""); 168 message += fullFileName; 169 message += "\" not found"; 170 G4Exception(message); 171 } 172 173 G4DataVector* argEnergies=new G4DataVector; 174 G4DataVector* argData=new G4DataVector; 175 176 G4double a; 177 bool energyColumn(true); 178 179 do 180 { 181 in >> a; 182 183 if (a!=-1 && a!=-2) 184 { 185 if (energyColumn) 186 argEnergies->push_back(a*unitEnergies); 187 else 188 argData->push_back(a*unitData); 189 energyColumn=(!energyColumn); 190 } 191 } 192 while (a != -2); 193 194 SetEnergiesData(argEnergies, argData, 0); 195 if (randomSet) BuildPdf(); 196 197 return true; 198 } 199 200 G4bool G4EMDataSet::SaveData(const G4String& name) const 201 { 202 // The file is organized into two columns: 203 // 1st column is the energy 204 // 2nd column is the corresponding value 205 // The file terminates with the pattern: -1 -1 206 // -2 -2 207 208 G4String fullFileName(FullFileName(name)); 209 std::ofstream out(fullFileName); 210 211 if (!out.is_open()) 212 { 213 G4String message("G4EMDataSet::SaveData - cannot open \""); 214 message+=fullFileName; 215 message+="\""; 216 G4Exception(message); 217 } 218 219 out.precision(10); 220 out.width(15); 221 out.setf(std::ofstream::left); 222 223 if (energies!=0 && data!=0) 224 { 225 G4DataVector::const_iterator i(energies->begin()); 226 G4DataVector::const_iterator endI(energies->end()); 227 G4DataVector::const_iterator j(data->begin()); 228 229 while (i!=endI) 230 { 231 out.precision(10); 232 out.width(15); 233 out.setf(std::ofstream::left); 234 out << ((*i)/unitEnergies) << ' '; 235 236 out.precision(10); 237 out.width(15); 238 out.setf(std::ofstream::left); 239 out << ((*j)/unitData) << std::endl; 240 241 i++; 242 j++; 243 } 244 } 245 246 out.precision(10); 247 out.width(15); 248 out.setf(std::ofstream::left); 249 out << -1.f << ' '; 250 251 out.precision(10); 252 out.width(15); 253 out.setf(std::ofstream::left); 254 out << -1.f << std::endl; 255 256 out.precision(10); 257 out.width(15); 258 out.setf(std::ofstream::left); 259 out << -2.f << ' '; 260 261 out.precision(10); 262 out.width(15); 263 out.setf(std::ofstream::left); 264 out << -2.f << std::endl; 265 266 return true; 267 } 268 269 size_t G4EMDataSet::FindLowerBound(G4double x) const 270 { 271 size_t lowerBound = 0; 272 size_t upperBound(energies->size() - 1); 273 274 while (lowerBound <= upperBound) 275 { 276 size_t midBin((lowerBound + upperBound) / 2); 277 278 if (x < (*energies)[midBin]) upperBound = midBin - 1; 279 else lowerBound = midBin + 1; 280 } 281 282 return upperBound; 283 } 284 285 286 size_t G4EMDataSet::FindLowerBound(G4double x, G4DataVector* values) const 287 { 288 size_t lowerBound = 0;; 289 size_t upperBound(values->size() - 1); 290 291 while (lowerBound <= upperBound) 292 { 293 size_t midBin((lowerBound + upperBound) / 2); 294 295 if (x < (*values)[midBin]) upperBound = midBin - 1; 296 else lowerBound = midBin + 1; 297 } 298 299 return upperBound; 300 } 301 302 303 G4String G4EMDataSet::FullFileName(const G4String& name) const 304 { 305 char* path = getenv("G4LEDATA"); 306 if (!path) 307 G4Exception("G4EMDataSet::FullFileName - G4LEDATA environment variable not set"); 308 309 std::ostringstream fullFileName; 310 fullFileName << path << '/' << name << z << ".dat"; 314 311 315 return G4String(fullFileName.str().c_str()); 316 } 312 return G4String(fullFileName.str().c_str()); 313 } 314 315 316 void G4EMDataSet::BuildPdf() 317 { 318 pdf = new G4DataVector; 319 G4Integrator <G4EMDataSet, G4double(G4EMDataSet::*)(G4double)> integrator; 320 321 G4int nData = data->size(); 322 pdf->push_back(0.); 323 324 // Integrate the data distribution 325 G4int i; 326 G4double totalSum = 0.; 327 for (i=1; i<nData; i++) 328 { 329 G4double xLow = (*energies)[i-1]; 330 G4double xHigh = (*energies)[i]; 331 G4double sum = integrator.Legendre96(this, &G4EMDataSet::IntegrationFunction, xLow, xHigh); 332 totalSum = totalSum + sum; 333 pdf->push_back(totalSum); 334 } 335 336 // Normalize to the last bin 337 G4double tot = 0.; 338 if (totalSum > 0.) tot = 1. / totalSum; 339 for (i=1; i<nData; i++) 340 { 341 (*pdf)[i] = (*pdf)[i] * tot; 342 } 343 } 344 345 346 G4double G4EMDataSet::RandomSelect(G4int /* componentId */) const 347 { 348 // Random select a X value according to the cumulative probability distribution 349 // derived from the data 350 351 if (!pdf) G4Exception("G4EMDataSet::RandomSelect - PDF has not been created for this data set"); 352 353 G4double value = 0.; 354 G4double x = G4UniformRand(); 355 356 // Locate the random value in the X vector based on the PDF 357 size_t bin = FindLowerBound(x,pdf); 358 359 // Interpolate the PDF to calculate the X value: 360 // linear interpolation in the first bin (to avoid problem with 0), 361 // interpolation with associated data set algorithm in other bins 362 363 G4LinInterpolation linearAlgo; 364 if (bin == 0) value = linearAlgo.Calculate(x, bin, *pdf, *energies); 365 else value = algorithm->Calculate(x, bin, *pdf, *energies); 366 367 // G4cout << x << " random bin "<< bin << " - " << value << G4endl; 368 return value; 369 } 370 371 G4double G4EMDataSet::IntegrationFunction(G4double x) 372 { 373 // This function is needed by G4Integrator to calculate the integral of the data distribution 374 375 G4double y = 0; 376 377 // Locate the random value in the X vector based on the PDF 378 size_t bin = FindLowerBound(x); 379 380 // Interpolate to calculate the X value: 381 // linear interpolation in the first bin (to avoid problem with 0), 382 // interpolation with associated algorithm in other bins 383 384 G4LinInterpolation linearAlgo; 385 386 if (bin == 0) y = linearAlgo.Calculate(x, bin, *energies, *data); 387 else y = algorithm->Calculate(x, bin, *energies, *data); 388 389 return y; 390 } 391 -
trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateChargeDecrease.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4FinalStateChargeDecrease.cc,v 1.2 2007/11/09 20:11:04 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 40 // ------------------------------------------------------------------- 41 42 // Class description: 43 // Reference: TNS Geant4-DNA paper 44 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 45 // design foundation and implementation of the first set of models, 46 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 47 // Further documentation available from http://www.ge.infn.it/geant4/dna 48 49 // ------------------------------------------------------------------- 50 26 // $Id: G4FinalStateChargeDecrease.cc,v 1.4 2009/01/20 07:50:28 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 51 28 52 29 #include "G4FinalStateChargeDecrease.hh" 53 #include "G4Track.hh"54 #include "G4Step.hh"55 #include "G4DynamicParticle.hh"56 //#include "Randomize.hh"57 30 58 #include "G4ParticleTypes.hh" 59 #include "G4ParticleDefinition.hh" 60 #include "G4SystemOfUnits.hh" 61 //#include "G4ParticleMomentum.hh" 62 #include "G4DNAGenericIonsManager.hh" 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 63 32 64 33 G4FinalStateChargeDecrease::G4FinalStateChargeDecrease() 65 34 { 66 name = "ChargeDecrease";67 35 lowEnergyLimit = 1 * keV; 68 36 highEnergyLimit = 10 * MeV; 69 37 } 70 38 39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 71 40 72 41 G4FinalStateChargeDecrease::~G4FinalStateChargeDecrease() 73 42 {} 74 43 44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 75 45 76 46 const G4FinalStateProduct& G4FinalStateChargeDecrease::GenerateFinalState(const G4Track& track, const G4Step& /* step */) 77 47 { 78 // Clear previous secondaries, energy deposit and particle kill status79 48 product.Clear(); 80 49 … … 95 64 96 65 if (outK<0) 97 {98 G4String message;99 message="ChargeDecreaseDingfelder::GenerateFinalState - Final kinetic energy is below 0! Process ";100 G4Exception(message);101 }66 { 67 G4String message; 68 message="ChargeDecreaseDingfelder::GenerateFinalState - Final kinetic energy is below 0! Process "; 69 G4Exception(message); 70 } 102 71 103 // Primary particle 72 //SI - Added protection against total energy deposit 73 product.DoNotDepositEnergy(); 74 // 104 75 product.KillPrimaryParticle(); 76 105 77 product.AddEnergyDeposit(waterBindingEnergy); 106 107 //Secondary particle 78 108 79 G4DynamicParticle* aSecondary = new G4DynamicParticle(OutgoingParticleDefinition(definition, finalStateIndex), 109 80 track.GetDynamicParticle()->GetMomentumDirection(), … … 114 85 return product; 115 86 } 87 88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 116 89 117 90 G4int G4FinalStateChargeDecrease::NumberOfFinalStates(G4ParticleDefinition* particleDefinition, … … 125 98 126 99 if (particleDefinition == instance->GetIon("alpha++") ) 127 {128 if (finalStateIndex==0) return 1;129 return 2;130 }100 { 101 if (finalStateIndex==0) return 1; 102 return 2; 103 } 131 104 132 105 if (particleDefinition == instance->GetIon("alpha+") ) return 1; … … 135 108 } 136 109 110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 137 111 138 112 G4ParticleDefinition* G4FinalStateChargeDecrease::OutgoingParticleDefinition (G4ParticleDefinition* particleDefinition, … … 144 118 145 119 if (particleDefinition == instance->GetIon("alpha++") ) 146 { 147 if (finalStateIndex == 0) return instance->GetIon("alpha+"); 148 149 return instance->GetIon("helium"); 150 } 120 { 121 if (finalStateIndex == 0) return instance->GetIon("alpha+"); 122 return instance->GetIon("helium"); 123 } 151 124 152 125 if (particleDefinition == instance->GetIon("alpha+") ) return instance->GetIon("helium"); … … 155 128 } 156 129 130 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 157 131 158 132 G4double G4FinalStateChargeDecrease::WaterBindingEnergyConstant(G4ParticleDefinition* particleDefinition, … … 168 142 169 143 if (particleDefinition == instance->GetIon("alpha++") ) 170 {144 { 171 145 // Binding energy for W+ -> W++ + e- 10.79 eV 172 146 // Binding energy for W -> W+ + e- 10.79 eV … … 178 152 179 153 return 10.79*2*eV; 180 }154 } 181 155 182 156 if (particleDefinition == instance->GetIon("alpha+") ) 183 {157 { 184 158 // Binding energy for W+ -> W++ + e- 10.79 eV 185 159 // Binding energy for W -> W+ + e- 10.79 eV … … 189 163 190 164 return 10.79*eV; 191 }165 } 192 166 193 167 return 0; 194 168 } 195 169 170 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 196 171 197 172 G4double G4FinalStateChargeDecrease::OutgoingParticleBindingEnergyConstant(G4ParticleDefinition* particleDefinition, … … 203 178 204 179 if (particleDefinition == instance->GetIon("alpha++") ) 205 {180 { 206 181 // Binding energy for He+ -> He++ + e- 54.509 eV 207 182 // Binding energy for He -> He+ + e- 24.587 eV … … 210 185 211 186 return (54.509 + 24.587)*eV; 212 }187 } 213 188 214 189 if (particleDefinition == instance->GetIon("alpha+") ) 215 {190 { 216 191 // Binding energy for He+ -> He++ + e- 54.509 eV 217 192 // Binding energy for He -> He+ + e- 24.587 eV 218 193 219 194 return 24.587*eV; 220 }195 } 221 196 222 197 return 0; -
trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateChargeIncrease.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4FinalStateChargeIncrease.cc,v 1.2 2007/11/09 20:11:04 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 40 // ------------------------------------------------------------------- 41 42 // Class description: 43 // Reference: TNS Geant4-DNA paper 44 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 45 // design foundation and implementation of the first set of models, 46 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 47 // Further documentation available from http://www.ge.infn.it/geant4/dna 48 49 // ------------------------------------------------------------------- 50 26 // $Id: G4FinalStateChargeIncrease.cc,v 1.4 2009/01/20 07:50:28 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 51 28 52 29 #include "G4FinalStateChargeIncrease.hh" 53 #include "G4Track.hh" 54 #include "G4Step.hh" 55 #include "G4DynamicParticle.hh" 56 #include "Randomize.hh" 57 #include "G4Electron.hh" 58 #include "G4ParticleTypes.hh" 59 #include "G4ParticleDefinition.hh" 60 #include "G4SystemOfUnits.hh" 61 #include "G4ParticleMomentum.hh" 62 #include "G4DNAGenericIonsManager.hh" 30 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 63 32 64 33 G4FinalStateChargeIncrease::G4FinalStateChargeIncrease() 65 34 { 66 name = "ChargeIncrease";67 35 lowEnergyLimit = 1 * keV; 68 36 highEnergyLimit = 10 * MeV; 69 37 } 70 38 39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 71 40 72 41 G4FinalStateChargeIncrease::~G4FinalStateChargeIncrease() 73 42 {} 74 43 44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 75 45 76 46 const G4FinalStateProduct& G4FinalStateChargeIncrease::GenerateFinalState(const G4Track& track, const G4Step& /* step */) 77 47 { 78 // Clear previous secondaries, energy deposit and particle kill status79 48 product.Clear(); 80 49 81 // Primary particle 50 //SI - Added protection against total energy deposit 51 product.DoNotDepositEnergy(); 52 // 82 53 product.KillPrimaryParticle(); 83 54 product.AddEnergyDeposit(0.); 55 84 56 G4ParticleDefinition* definition = track.GetDefinition(); 85 57 86 // Secondaries87 58 G4double inK = track.GetDynamicParticle()->GetKineticEnergy(); 88 59 … … 100 71 101 72 if (outK<0) 102 {103 G4String message;104 message="G4FinalStateChargeIncrease - Final kinetic energy is below 0! Process ";105 }73 { 74 G4String message; 75 message="G4FinalStateChargeIncrease - Final kinetic energy is below 0! Process "; 76 } 106 77 107 78 product.AddSecondary(new G4DynamicParticle(OutgoingParticleDefinition(definition,finalStateIndex), … … 112 83 113 84 while (n>0) 114 { 115 n--; 116 117 product.AddSecondary 85 { 86 n--; 87 product.AddSecondary 118 88 (new G4DynamicParticle(G4Electron::Electron(), track.GetDynamicParticle()->GetMomentumDirection(), electronK)); 119 }89 } 120 90 121 91 return product; 122 92 } 93 94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 123 95 124 96 G4int G4FinalStateChargeIncrease::NumberOfFinalStates(G4ParticleDefinition* particleDefinition, … … 132 104 133 105 if (particleDefinition == instance->GetIon("helium")) 134 { if (finalStateIndex==0) return 2;135 return 3;136 }106 { if (finalStateIndex==0) return 2; 107 return 3; 108 } 137 109 return 0; 138 110 } 139 111 112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 140 113 141 114 G4ParticleDefinition* G4FinalStateChargeIncrease::OutgoingParticleDefinition (G4ParticleDefinition* particleDefinition, … … 163 136 164 137 if(particleDefinition == instance->GetIon("alpha+")) 165 {138 { 166 139 // Binding energy for He+ -> He++ + e- 54.509 eV 167 140 // Binding energy for He -> He+ + e- 24.587 eV 168 141 return 54.509*eV; 169 }142 } 170 143 171 144 if(particleDefinition == instance->GetIon("helium")) 172 {145 { 173 146 // Binding energy for He+ -> He++ + e- 54.509 eV 174 147 // Binding energy for He -> He+ + e- 24.587 eV … … 176 149 if (finalStateIndex==0) return 24.587*eV; 177 150 return (54.509 + 24.587)*eV; 178 }151 } 179 152 180 153 return 0; 181 154 } 182 183 -
trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateElasticBrennerZaider.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4FinalStateElasticBrennerZaider.cc,v 1.1 2007/10/12 23:11:41 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 40 // ------------------------------------------------------------------- 41 42 // Class description: 43 // Reference: TNS Geant4-DNA paper 44 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 45 // design foundation and implementation of the first set of models, 46 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 47 // Further documentation available from http://www.ge.infn.it/geant4/dna 48 49 // ------------------------------------------------------------------- 50 26 // $Id: G4FinalStateElasticBrennerZaider.cc,v 1.8 2008/12/05 11:58:16 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 51 28 52 29 #include "G4FinalStateElasticBrennerZaider.hh" 53 #include "G4Track.hh"54 #include "G4Step.hh"55 #include "G4DynamicParticle.hh"56 #include "Randomize.hh"57 30 58 #include "G4ParticleTypes.hh" 59 #include "G4ParticleDefinition.hh" 60 #include "G4Electron.hh" 61 #include "G4SystemOfUnits.hh" 62 #include "G4ParticleMomentum.hh" 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 63 32 64 33 G4FinalStateElasticBrennerZaider::G4FinalStateElasticBrennerZaider() 65 34 { 66 // These data members will be used in the next implementation iteration, 67 // when the enriched PhysicsModel policy is implemented 68 name = "FinalStateElasticBrennerZaider"; 69 lowEnergyLimit = 7.4 * eV; 70 highEnergyLimit = 10 * MeV; 35 lowEnergyLimit = 8.23 * eV; // SI : i/o of 7.4 * eV; 36 highEnergyLimit = 200 * eV; 71 37 72 38 betaCoeff.push_back(7.51525); … … 100 66 } 101 67 68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 102 69 103 70 G4FinalStateElasticBrennerZaider::~G4FinalStateElasticBrennerZaider() 104 { 105 // empty 106 // G4DynamicParticle objects produced are owned by client 107 } 108 71 {} 72 73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 109 74 110 75 const G4FinalStateProduct& G4FinalStateElasticBrennerZaider::GenerateFinalState(const G4Track& track, const G4Step& /* step */) 111 76 { 112 // Clear previous secondaries, energy deposit and particle kill status113 77 product.Clear(); 114 78 115 // Kinetic energy of primary particle116 79 G4double k = track.GetDynamicParticle()->GetKineticEnergy(); 80 81 if ( k>= lowEnergyLimit && k<=highEnergyLimit ) 82 { 83 G4double cosTheta = RandomizeCosTheta(k); 84 85 G4double phi = 2. * pi * G4UniformRand(); 117 86 118 // Assume material = water; H2O number of electrons119 // ---- MGP ---- To be generalized later120 // const G4int z = 10;87 G4ThreeVector zVers = track.GetDynamicParticle()->GetMomentumDirection(); 88 G4ThreeVector xVers = zVers.orthogonal(); 89 G4ThreeVector yVers = zVers.cross(xVers); 121 90 122 G4double cosTheta = RandomizeCosTheta(k); 91 G4double xDir = std::sqrt(1. - cosTheta*cosTheta); 92 G4double yDir = xDir; 93 xDir *= std::cos(phi); 94 yDir *= std::sin(phi); 95 96 G4ThreeVector zPrimeVers((xDir*xVers + yDir*yVers + cosTheta*zVers)); 97 98 product.ModifyPrimaryParticle(zPrimeVers,k); 99 } 100 101 if (k<lowEnergyLimit) 102 { 103 product.KillPrimaryParticle(); 104 } 123 105 124 G4double phi = 2. * pi * G4UniformRand();125 126 // G4cout << "cosTheta in GenerateFinalState = " << cosTheta << ", phi = " << phi << G4endl;127 128 G4ThreeVector zVers = track.GetDynamicParticle()->GetMomentumDirection();129 G4ThreeVector xVers = zVers.orthogonal();130 G4ThreeVector yVers = zVers.cross(xVers);131 132 G4double xDir = std::sqrt(1. - cosTheta*cosTheta);133 G4double yDir = xDir;134 xDir *= std::cos(phi);135 yDir *= std::sin(phi);136 137 // G4cout << "xDir, yDir = " << xDir <<", " << yDir << G4endl;138 139 // G4ThreeVector zPrimeVers((xDir*xVers + yDir*yVers + cosTheta*zVers).unit());140 G4ThreeVector zPrimeVers((xDir*xVers + yDir*yVers + cosTheta*zVers));141 142 // G4cout << "zPrimeVers = (" << zPrimeVers.x() << ", "<< zPrimeVers.y() << ", "<< zPrimeVers.z() << ") " << G4endl;143 144 // product.ModifyPrimaryParticle(zPrimeVers.x(),zPrimeVers.y(),zPrimeVers.z(),k);145 product.ModifyPrimaryParticle(zPrimeVers,k);146 147 // this->aParticleChange.ProposeEnergy(k);148 // this->aParticleChange.ProposeMomentumDirection(zPrimeVers);149 // this->aParticleChange.SetNumberOfSecondaries(0);150 151 106 return product; 152 107 } 108 109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 153 110 154 111 G4double G4FinalStateElasticBrennerZaider::RandomizeCosTheta(G4double k) … … 158 115 // d Omega (1 + 2 gamma(K) - cos(theta))^2 (1 + 2 delta(K) + cos(theta))^2 159 116 // 160 // Maximum is < 1/(4 gamma(K)^2) + beta(K)/( 4 delta(K)^2)117 // Maximum is < 1/(4 gamma(K)^2) + beta(K)/((2+2delta(K))^2) 161 118 // 162 119 // Phys. Med. Biol. 29 N.4 (1983) 443-447 163 120 164 121 // gamma(K), beta(K) and delta(K) are polynomials with coefficients for energy measured in eV 122 165 123 k /= eV; 166 124 167 125 G4double beta = std::exp(CalculatePolynomial(k,betaCoeff)); 168 126 G4double delta = std::exp(CalculatePolynomial(k,deltaCoeff)); 127 G4double gamma; 169 128 170 G4double gamma;171 129 if (k > 100.) 172 { 173 gamma = CalculatePolynomial(k, gamma100_200Coeff); // Only in this case it is not the exponent of the polynomial 174 } 130 { 131 gamma = CalculatePolynomial(k, gamma100_200Coeff); 132 // Only in this case it is not the exponent of the polynomial 133 } 175 134 else 176 { 135 { 136 if (k>10) 137 { 138 gamma = std::exp(CalculatePolynomial(k, gamma10_100Coeff)); 139 } 140 else 141 { 142 gamma = std::exp(CalculatePolynomial(k, gamma035_10Coeff)); 143 } 144 } 177 145 178 if (k>10) 179 { 180 gamma = std::exp(CalculatePolynomial(k, gamma10_100Coeff)); 181 } 182 else 183 { 184 gamma = std::exp(CalculatePolynomial(k, gamma035_10Coeff)); 185 } 186 } 187 188 // G4cout << "beta = " << beta << ", gamma = " << gamma << ", delta = " << delta << G4endl; 189 190 G4double oneOverMax = 1. / (1./(4.*gamma*gamma) + beta/(4.*delta*delta)); 146 G4double oneOverMax = 1. / (1./(4.*gamma*gamma) + beta/( (2.+2.*delta)*(2.+2.*delta) )); 191 147 192 148 G4double cosTheta = 0.; … … 196 152 197 153 do 198 {154 { 199 155 cosTheta = 2. * G4UniformRand() - 1.; 200 leftDenominator = (1 + 2.*gamma - cosTheta); 201 rightDenominator = (1 + 2.*delta + cosTheta); 202 fCosTheta = oneOverMax * (1./(leftDenominator*leftDenominator) + beta/(rightDenominator*rightDenominator)); 203 } 156 leftDenominator = (1. + 2.*gamma - cosTheta); 157 rightDenominator = (1. + 2.*delta + cosTheta); 158 if ( (leftDenominator * rightDenominator) != 0. ) 159 { 160 fCosTheta = oneOverMax * (1./(leftDenominator*leftDenominator) + beta/(rightDenominator*rightDenominator)); 161 } 162 } 204 163 while (fCosTheta < G4UniformRand()); 205 164 206 // G4cout << "cosTheta = " << cosTheta << G4endl;207 208 165 return cosTheta; 209 166 } 167 168 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 210 169 211 170 G4double G4FinalStateElasticBrennerZaider::CalculatePolynomial(G4double k, std::vector<G4double>& vec) -
trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateElasticScreenedRutherford.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4FinalStateElasticScreenedRutherford.cc,v 1.2 2007/10/12 23:10:33 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 40 // ------------------------------------------------------------------- 41 42 // Class description: 43 // Reference: TNS Geant4-DNA paper 44 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 45 // design foundation and implementation of the first set of models, 46 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 47 // Further documentation available from http://www.ge.infn.it/geant4/dna 48 49 // ------------------------------------------------------------------- 50 26 // $Id: G4FinalStateElasticScreenedRutherford.cc,v 1.4 2008/07/14 20:47:34 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 51 28 52 29 #include "G4FinalStateElasticScreenedRutherford.hh" 53 #include "G4Track.hh"54 #include "G4Step.hh"55 #include "G4DynamicParticle.hh"56 #include "Randomize.hh"57 30 58 #include "G4ParticleTypes.hh" 59 #include "G4ParticleDefinition.hh" 60 #include "G4Electron.hh" 61 #include "G4SystemOfUnits.hh" 62 #include "G4ParticleMomentum.hh" 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 63 32 64 33 G4FinalStateElasticScreenedRutherford::G4FinalStateElasticScreenedRutherford() 65 34 { 66 // These data members will be used in the next implementation iteration, 67 // when the enriched PhysicsModel policy is implemented 68 name = "FinalStateElasticScreenedRutherford"; 69 lowEnergyLimit = 7.4 * eV; 35 lowEnergyLimit = 200 * eV; 70 36 highEnergyLimit = 10 * MeV; 71 37 } 72 38 39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 73 40 74 41 G4FinalStateElasticScreenedRutherford::~G4FinalStateElasticScreenedRutherford() 75 { 76 // empty 77 // G4DynamicParticle objects produced are owned by client 78 } 42 {} 79 43 44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 80 45 81 const G4FinalStateProduct& G4FinalStateElasticScreenedRutherford::GenerateFinalState(const G4Track& track, const G4Step& step)46 const G4FinalStateProduct& G4FinalStateElasticScreenedRutherford::GenerateFinalState(const G4Track& track, const G4Step& ) 82 47 { 83 // Clear previous secondaries, energy deposit and particle kill status84 48 product.Clear(); 85 49 86 // Kinetic energy of primary particle87 50 G4double k = track.GetDynamicParticle()->GetKineticEnergy(); 88 51 89 // Assume material = water; H2O number of electrons90 // ---- MGP ---- To be generalized later91 52 const G4int z = 10; 92 53 … … 94 55 95 56 G4double phi = 2. * pi * G4UniformRand(); 96 97 // G4cout << "cosTheta in GenerateFinalState = " << cosTheta << ", phi = " << phi << G4endl;98 57 99 58 G4ThreeVector zVers = track.GetDynamicParticle()->GetMomentumDirection(); … … 106 65 yDir *= std::sin(phi); 107 66 108 // G4cout << "xDir, yDir = " << xDir <<", " << yDir << G4endl;109 110 // G4ThreeVector zPrimeVers((xDir*xVers + yDir*yVers + cosTheta*zVers).unit());111 67 G4ThreeVector zPrimeVers((xDir*xVers + yDir*yVers + cosTheta*zVers)); 112 68 113 // G4cout << "zPrimeVers = (" << zPrimeVers.x() << ", "<< zPrimeVers.y() << ", "<< zPrimeVers.z() << ") " << G4endl;114 115 // product.ModifyPrimaryParticle(zPrimeVers.x(),zPrimeVers.y(),zPrimeVers.z(),k);116 69 product.ModifyPrimaryParticle(zPrimeVers,k); 117 118 // this->aParticleChange.ProposeEnergy(k);119 // this->aParticleChange.ProposeMomentumDirection(zPrimeVers);120 // this->aParticleChange.SetNumberOfSecondaries(0);121 70 122 71 return product; 123 72 } 73 74 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 124 75 125 76 G4double G4FinalStateElasticScreenedRutherford::RandomizeCosTheta(G4double k, G4int z) const … … 144 95 145 96 do 146 {147 cosTheta = 2. * G4UniformRand() - 1.;148 fCosTheta = (1 + 2.*n - cosTheta);149 fCosTheta = oneOverMax / (fCosTheta*fCosTheta);150 }97 { 98 cosTheta = 2. * G4UniformRand() - 1.; 99 fCosTheta = (1 + 2.*n - cosTheta); 100 fCosTheta = oneOverMax / (fCosTheta*fCosTheta); 101 } 151 102 while (fCosTheta < G4UniformRand()); 152 103 153 104 return cosTheta; 154 105 } 106 107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 155 108 156 109 G4double G4FinalStateElasticScreenedRutherford::ScreeningFactor(G4double k, G4int z) const … … 180 133 G4double result = 0.; 181 134 if (denominator != 0.) 182 {183 result = numerator / denominator;184 }135 { 136 result = numerator / denominator; 137 } 185 138 else 186 { 187 // Throw an exception 188 G4Exception("G4FinalStateElasticScreenedRutherford::ScreeningFactor - denominator = 0"); 189 } 139 { 140 G4Exception("G4FinalStateElasticScreenedRutherford::ScreeningFactor - denominator = 0"); 141 } 190 142 return result; 191 192 143 } -
trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateExcitationBorn.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4FinalStateExcitationBorn.cc,v 1.2 2007/11/09 20:11:04 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 40 // ------------------------------------------------------------------- 41 42 // Class description: 43 // Reference: TNS Geant4-DNA paper 44 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 45 // design foundation and implementation of the first set of models, 46 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 47 // Further documentation available from http://www.ge.infn.it/geant4/dna 48 49 // ------------------------------------------------------------------- 50 26 // $Id: G4FinalStateExcitationBorn.cc,v 1.3 2008/07/14 20:47:34 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 51 28 52 29 #include "G4FinalStateExcitationBorn.hh" 53 #include "G4Track.hh"54 #include "G4Step.hh"55 #include "G4DynamicParticle.hh"56 #include "Randomize.hh"57 30 58 #include "G4ParticleTypes.hh" 59 #include "G4ParticleDefinition.hh" 60 #include "G4Electron.hh" 61 #include "G4SystemOfUnits.hh" 62 #include "G4ParticleMomentum.hh" 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 63 32 64 33 G4FinalStateExcitationBorn::G4FinalStateExcitationBorn() 65 34 { 66 name = "FinalStateExcitationBorn"; 67 lowEnergyLimit = 7.4 * eV; 35 lowEnergyLimit = 500 * keV; 68 36 highEnergyLimit = 10 * MeV; 69 37 } 70 38 39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 71 40 72 41 G4FinalStateExcitationBorn::~G4FinalStateExcitationBorn() 73 { 74 // empty 75 // G4DynamicParticle objects produced are owned by client 76 } 77 42 {} 43 44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 78 45 79 46 const G4FinalStateProduct& G4FinalStateExcitationBorn::GenerateFinalState(const G4Track& track, const G4Step& /* step */) 80 47 { 81 // Clear previous secondaries, energy deposit and particle kill status82 48 product.Clear(); 83 49 84 50 const G4DynamicParticle* particle = track.GetDynamicParticle(); 85 51 86 // Kinetic energy of primary particle87 52 G4double k = particle->GetKineticEnergy(); 88 53 89 // Select excitation level on the basis of partial excitation cross section90 54 G4int level = cross.RandomSelect(k); 91 // Excitation energy corresponding to the selected level92 55 G4double excitationEnergy = waterStructure.ExcitationEnergy(level); 93 56 G4double newEnergy = k - excitationEnergy; 94 57 95 if (newEnergy > lowEnergyLimit) 96 { 97 // Deposit excitation energy locally, modify primary energy accordingly 98 // Particle direction is unchanged 99 product.ModifyPrimaryParticle(particle->GetMomentumDirection(),newEnergy); 100 product.AddEnergyDeposit(excitationEnergy); 101 } 102 else 103 { 104 // Primary particle is killed 105 product.KillPrimaryParticle(); 106 } 58 if (newEnergy > 0) 59 { 60 product.ModifyPrimaryParticle(particle->GetMomentumDirection(),newEnergy); 61 product.AddEnergyDeposit(excitationEnergy); 62 } 107 63 108 64 return product; 109 65 } 110 66 111 -
trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateExcitationEmfietzoglou.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4FinalStateExcitationEmfietzoglou.cc,v 1.2 2007/11/09 20:11:04 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 40 // ------------------------------------------------------------------- 41 42 // Class description: 43 // Reference: TNS Geant4-DNA paper 44 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 45 // design foundation and implementation of the first set of models, 46 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 47 // Further documentation available from http://www.ge.infn.it/geant4/dna 48 49 // ------------------------------------------------------------------- 50 26 // $Id: G4FinalStateExcitationEmfietzoglou.cc,v 1.5 2008/12/05 11:58:16 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 51 28 52 29 #include "G4FinalStateExcitationEmfietzoglou.hh" 53 #include "G4Track.hh"54 #include "G4Step.hh"55 #include "G4DynamicParticle.hh"56 #include "Randomize.hh"57 30 58 #include "G4ParticleTypes.hh" 59 #include "G4ParticleDefinition.hh" 60 #include "G4Electron.hh" 61 #include "G4SystemOfUnits.hh" 62 #include "G4ParticleMomentum.hh" 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 63 32 64 33 G4FinalStateExcitationEmfietzoglou::G4FinalStateExcitationEmfietzoglou() 65 34 { 66 name = "FinalStateExcitationEmfietzoglou"; 67 lowEnergyLimit = 7.4 * eV; 35 lowEnergyLimit = 8.23 * eV; 68 36 highEnergyLimit = 10 * MeV; 69 37 } 70 38 39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 71 40 72 41 G4FinalStateExcitationEmfietzoglou::~G4FinalStateExcitationEmfietzoglou() 73 { 74 // empty 75 // G4DynamicParticle objects produced are owned by client 76 } 42 {} 77 43 44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 78 45 79 46 const G4FinalStateProduct& G4FinalStateExcitationEmfietzoglou::GenerateFinalState(const G4Track& track, const G4Step& /* step */) 80 47 { 81 // Clear previous secondaries, energy deposit and particle kill status82 48 product.Clear(); 83 49 84 50 const G4DynamicParticle* particle = track.GetDynamicParticle(); 85 51 86 // Kinetic energy of primary particle87 52 G4double k = particle->GetKineticEnergy(); 88 53 89 // Select excitation level on the basis of partial excitation cross section90 54 G4int level = cross.RandomSelect(k); 91 // Excitation energy corresponding to the selected level 55 92 56 G4double excitationEnergy = waterStructure.ExcitationEnergy(level); 93 57 G4double newEnergy = k - excitationEnergy; 94 58 95 if (newEnergy > lowEnergyLimit) 96 { 97 // Deposit excitation energy locally, modify primary energy accordingly 98 // Particle direction is unchanged 59 if (newEnergy >= lowEnergyLimit) 60 { 99 61 product.ModifyPrimaryParticle(particle->GetMomentumDirection(),newEnergy); 100 62 product.AddEnergyDeposit(excitationEnergy); 101 } 102 else 103 { 104 // Primary particle is killed 105 product.KillPrimaryParticle(); 106 } 63 } 64 65 else product.KillPrimaryParticle(); 107 66 108 67 return product; 109 68 } 110 69 111 -
trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateExcitationMillerGreen.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4FinalStateExcitationMillerGreen.cc,v 1.2 2007/11/09 20:11:04 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 32 // Reference: TNS Geant4-DNA paper 33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 34 35 // History: 36 // ----------- 37 // Date Name Modification 38 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 39 // 40 // ------------------------------------------------------------------- 41 42 // Class description: 43 // Reference: TNS Geant4-DNA paper 44 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 45 // design foundation and implementation of the first set of models, 46 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 47 // Further documentation available from http://www.ge.infn.it/geant4/dna 48 49 // ------------------------------------------------------------------- 50 26 // $Id: G4FinalStateExcitationMillerGreen.cc,v 1.3 2008/07/14 20:47:34 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 51 28 52 29 #include "G4FinalStateExcitationMillerGreen.hh" 53 #include "G4Track.hh"54 #include "G4Step.hh"55 #include "G4DynamicParticle.hh"56 #include "Randomize.hh"57 30 58 #include "G4ParticleTypes.hh" 59 #include "G4ParticleDefinition.hh" 60 #include "G4Electron.hh" 61 #include "G4SystemOfUnits.hh" 62 #include "G4ParticleMomentum.hh" 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 63 32 64 33 G4FinalStateExcitationMillerGreen::G4FinalStateExcitationMillerGreen() 65 34 { 66 name = "ExcitationMillerGreen";67 35 lowEnergyLimit = 10 * eV; 68 36 highEnergyLimit = 10 * MeV; 69 37 } 70 38 39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 71 40 72 41 G4FinalStateExcitationMillerGreen::~G4FinalStateExcitationMillerGreen() 73 42 {} 74 43 44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 75 45 76 46 const G4FinalStateProduct& G4FinalStateExcitationMillerGreen::GenerateFinalState(const G4Track& track, const G4Step& /* step */) 77 47 { 78 // Clear previous secondaries, energy deposit and particle kill status79 48 product.Clear(); 80 49 81 50 const G4DynamicParticle* particle = track.GetDynamicParticle(); 82 51 83 // Kinetic energy of primary particle84 52 G4double k = particle->GetKineticEnergy(); 85 53 86 // Select excitation level on the basis of partial excitation cross section87 54 G4int level = cross.RandomSelect(k,track.GetDefinition()); 88 // Excitation energy corresponding to the selected level89 55 G4double excitationEnergy = waterStructure.ExcitationEnergy(level); 90 56 G4double newEnergy = k - excitationEnergy; 91 57 92 // ---- SI ---- Test on newEnergy93 58 if (newEnergy > 0) 94 { 95 // Deposit excitation energy locally, modify primary energy accordingly 96 // Particle direction is unchanged 97 product.ModifyPrimaryParticle(particle->GetMomentumDirection(),newEnergy); 98 product.AddEnergyDeposit(excitationEnergy); 99 } 100 101 // ---- SI ---- Particle is not modified by default otherwise 102 /* 103 else 104 { 105 // Primary particle is killed 106 product.KillPrimaryParticle(); 107 } 108 */ 59 { 60 product.ModifyPrimaryParticle(particle->GetMomentumDirection(),newEnergy); 61 product.AddEnergyDeposit(excitationEnergy); 62 } 109 63 110 64 return product; -
trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateIonisationBorn.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4FinalStateIonisationBorn.cc,v 1.9 2007/11/26 17:27:09 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Sebastien Incerti (incerti@cenbg.in2p3.fr) 31 // Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 32 // 33 // Reference: TNS Geant4-DNA paper 34 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 35 36 // History: 37 // ----------- 38 // Date Name Modification 39 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 40 // Nov 2007 S. Incerti Implementation 41 // 26 Nov 2007 MGP Cleaned up std:: 42 // 43 // ------------------------------------------------------------------- 44 45 // Class description: 46 // Reference: TNS Geant4-DNA paper 47 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 48 // design foundation and implementation of the first set of models, 49 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 50 // Further documentation available from http://www.ge.infn.it/geant4/dna 51 52 // ------------------------------------------------------------------- 53 26 // $Id: G4FinalStateIonisationBorn.cc,v 1.16 2008/12/06 13:47:12 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 54 28 55 29 #include "G4FinalStateIonisationBorn.hh" 56 #include "G4Track.hh" 57 #include "G4Step.hh" 58 #include "G4DynamicParticle.hh" 59 #include "Randomize.hh" 60 61 #include "G4ParticleTypes.hh" 62 #include "G4ParticleDefinition.hh" 63 #include "G4Electron.hh" 64 #include "G4Proton.hh" 65 #include "G4SystemOfUnits.hh" 66 #include "G4ParticleMomentum.hh" 67 30 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 68 32 69 33 G4FinalStateIonisationBorn::G4FinalStateIonisationBorn() 70 34 { 71 72 name = "IonisationBorn";73 74 // NEW75 // Factor to scale microscopic/macroscopic cross section data in water76 77 35 G4double scaleFactor = (1.e-22 / 3.343) * m*m; 78 36 79 // Energy limits80 37 G4ParticleDefinition* electronDef = G4Electron::ElectronDefinition(); 81 38 G4ParticleDefinition* protonDef = G4Proton::ProtonDefinition(); … … 84 41 G4String proton; 85 42 86 // Default energy limits (defined for protection against anomalous behaviour only) 87 lowEnergyLimitDefault = 25 * eV; 43 lowEnergyLimitDefault = 12.61 * eV; // SI: i/o 25 eV 88 44 highEnergyLimitDefault = 10 * MeV; 89 45 … … 93 49 G4Exception("G4DNACrossSectionDataSet::FullFileName - G4LEDATA environment variable not set"); 94 50 95 // Data members for electrons96 97 51 if (electronDef != 0) 98 { 99 electron = electronDef->GetParticleName(); 100 lowEnergyLimit[electron] = 25. * eV; 101 highEnergyLimit[electron] = 30. * keV; 102 103 std::ostringstream eFullFileName; 104 eFullFileName << path << "/dna/sigmadiff_ionisation_e_born.dat"; 105 std::ifstream eDiffCrossSection(eFullFileName.str().c_str()); 106 // eDiffCrossSection(eFullFileName.str().c_str()); 107 if (!eDiffCrossSection) 108 { 109 // G4cout << "ERROR OPENING DATA FILE IN ELECTRON BORN IONIZATION !!! " << G4endl; 110 G4Exception("G4FinalStateIonisationBorn::ERROR OPENING electron DATA FILE"); 111 while(1); // ---- MGP ---- What is this? 112 } 52 { 53 electron = electronDef->GetParticleName(); 54 lowEnergyLimit[electron] = 12.61 * eV; // SI: i/o 25 eV 55 highEnergyLimit[electron] = 30. * keV; 56 57 std::ostringstream eFullFileName; 58 eFullFileName << path << "/dna/sigmadiff_ionisation_e_born.dat"; 59 std::ifstream eDiffCrossSection(eFullFileName.str().c_str()); 60 if (!eDiffCrossSection) 61 { 62 G4Exception("G4FinalStateIonisationBorn::ERROR OPENING electron DATA FILE"); 63 } 113 64 114 eTdummyVec.push_back(0.); 115 while(!eDiffCrossSection.eof()) 116 { 117 double tDummy; 118 double eDummy; 119 eDiffCrossSection>>tDummy>>eDummy; 120 if (tDummy != eTdummyVec.back()) eTdummyVec.push_back(tDummy); 121 for (int j=0; j<5; j++) 122 { 123 eDiffCrossSection>>eDiffCrossSectionData[j][tDummy][eDummy]; 124 eDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor; 125 eVecm[tDummy].push_back(eDummy); 126 } 127 } 128 129 } 65 eTdummyVec.push_back(0.); 66 while(!eDiffCrossSection.eof()) 67 { 68 double tDummy; 69 double eDummy; 70 eDiffCrossSection>>tDummy>>eDummy; 71 if (tDummy != eTdummyVec.back()) eTdummyVec.push_back(tDummy); 72 for (int j=0; j<5; j++) 73 { 74 eDiffCrossSection>>eDiffCrossSectionData[j][tDummy][eDummy]; 75 76 // SI - only if eof is not reached ! 77 if (!eDiffCrossSection.eof()) eDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor; 78 79 eVecm[tDummy].push_back(eDummy); 80 81 } 82 } 83 84 } 130 85 else 131 { 132 G4Exception("G4FinalStateIonisationBorn Constructor: electron is not defined"); 133 } 134 135 // Data members for protons 86 { 87 G4Exception("G4FinalStateIonisationBorn Constructor: electron is not defined"); 88 } 136 89 137 90 if (protonDef != 0) 138 { 139 proton = protonDef->GetParticleName(); 140 lowEnergyLimit[proton] = 500. * keV; 141 highEnergyLimit[proton] = 10. * MeV; 142 143 std::ostringstream pFullFileName; 144 pFullFileName << path << "/dna/sigmadiff_ionisation_p_born.dat"; 145 std::ifstream pDiffCrossSection(pFullFileName.str().c_str()); 146 // pDiffCrossSection(pFullFileName.str().c_str()); 147 if (!pDiffCrossSection) 148 { 149 // G4cout<<"ERROR OPENING DATA FILE IN PROTON BORN IONIZATION !!! "<<G4endl; 150 G4Exception("G4FinalStateIonisationBorn::ERROR OPENING proton DATA FILE"); 151 while(1); // ---- MGP ---- What is this? 152 } 91 { 92 proton = protonDef->GetParticleName(); 93 lowEnergyLimit[proton] = 500. * keV; 94 highEnergyLimit[proton] = 10. * MeV; 95 96 std::ostringstream pFullFileName; 97 pFullFileName << path << "/dna/sigmadiff_ionisation_p_born.dat"; 98 std::ifstream pDiffCrossSection(pFullFileName.str().c_str()); 99 if (!pDiffCrossSection) 100 { 101 G4Exception("G4FinalStateIonisationBorn::ERROR OPENING proton DATA FILE"); 102 } 153 103 154 pTdummyVec.push_back(0.); 155 while(!pDiffCrossSection.eof()) 156 { 157 double tDummy; 158 double eDummy; 159 pDiffCrossSection>>tDummy>>eDummy; 160 if (tDummy != pTdummyVec.back()) pTdummyVec.push_back(tDummy); 161 for (int j=0; j<5; j++) 162 { 163 pDiffCrossSection>>pDiffCrossSectionData[j][tDummy][eDummy]; 164 pDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor; 165 //G4cout << "j=" << j << " Tdum=" << tDummy << " Edum=" << eDummy << " pDiff=" << pDiffCrossSectionData[j][tDummy][eDummy] << G4endl; 166 pVecm[tDummy].push_back(eDummy); 167 } 168 } 169 } 104 pTdummyVec.push_back(0.); 105 while(!pDiffCrossSection.eof()) 106 { 107 double tDummy; 108 double eDummy; 109 pDiffCrossSection>>tDummy>>eDummy; 110 if (tDummy != pTdummyVec.back()) pTdummyVec.push_back(tDummy); 111 for (int j=0; j<5; j++) 112 { 113 pDiffCrossSection>>pDiffCrossSectionData[j][tDummy][eDummy]; 114 115 // SI - only if eof is not reached ! 116 if (!pDiffCrossSection.eof()) pDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor; 117 118 pVecm[tDummy].push_back(eDummy); 119 } 120 } 121 } 170 122 else 171 { 172 G4Exception("G4FinalStateIonisationBorn Constructor: proton is not defined"); 173 } 174 } 175 123 { 124 G4Exception("G4FinalStateIonisationBorn Constructor: proton is not defined"); 125 } 126 } 127 128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 176 129 177 130 G4FinalStateIonisationBorn::~G4FinalStateIonisationBorn() … … 181 134 } 182 135 136 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 183 137 184 138 const G4FinalStateProduct& G4FinalStateIonisationBorn::GenerateFinalState(const G4Track& track, const G4Step& /* step */) 185 139 { 186 // Clear previous secondaries, energy deposit and particle kill status187 140 product.Clear(); 188 141 … … 196 149 const G4String& particleName = particle->GetDefinition()->GetParticleName(); 197 150 198 // Retrieve energy limits for the current particle type199 200 151 std::map< G4String,G4double,std::less<G4String> >::iterator pos1; 201 152 pos1 = lowEnergyLimit.find(particleName); 202 153 203 // Lower limit204 154 if (pos1 != lowEnergyLimit.end()) 205 { 206 lowLim = pos1->second; 207 } 208 209 // Upper limit 155 { 156 lowLim = pos1->second; 157 } 158 210 159 std::map< G4String,G4double,std::less<G4String> >::iterator pos2; 211 160 pos2 = highEnergyLimit.find(particleName); 212 161 213 162 if (pos2 != highEnergyLimit.end()) 214 { 215 highLim = pos2->second; 216 } 217 218 // Verify that the current track is within the energy limits of validity of the cross section model 163 { 164 highLim = pos2->second; 165 } 219 166 220 167 if (k >= lowLim && k <= highLim) 221 { 222 // Kinetic energy of primary particle 223 224 G4ParticleMomentum primaryDirection = particle->GetMomentumDirection(); 225 G4double particleMass = particle->GetDefinition()->GetPDGMass(); 226 G4double totalEnergy = k + particleMass; 227 G4double pSquare = k * (totalEnergy + particleMass); 228 G4double totalMomentum = std::sqrt(pSquare); 229 230 const G4String& particleName = particle->GetDefinition()->GetParticleName(); 231 232 G4int ionizationShell = cross.RandomSelect(k,particleName); 233 234 G4double secondaryKinetic = RandomizeEjectedElectronEnergy(particle->GetDefinition(),k,ionizationShell); 235 236 G4double bindingEnergy = waterStructure.IonisationEnergy(ionizationShell); 237 238 G4double cosTheta = 0.; 239 G4double phi = 0.; 240 RandomizeEjectedElectronDirection(track.GetDefinition(), k,secondaryKinetic, cosTheta, phi); 241 242 G4double sinTheta = std::sqrt(1.-cosTheta*cosTheta); 243 G4double dirX = sinTheta*std::cos(phi); 244 G4double dirY = sinTheta*std::sin(phi); 245 G4double dirZ = cosTheta; 246 G4ThreeVector deltaDirection(dirX,dirY,dirZ); 247 deltaDirection.rotateUz(primaryDirection); 248 249 G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 )); 250 251 //Primary Particle Direction 252 G4double finalPx = totalMomentum*primaryDirection.x() - deltaTotalMomentum*deltaDirection.x(); 253 G4double finalPy = totalMomentum*primaryDirection.y() - deltaTotalMomentum*deltaDirection.y(); 254 G4double finalPz = totalMomentum*primaryDirection.z() - deltaTotalMomentum*deltaDirection.z(); 255 G4double finalMomentum = std::sqrt(finalPx*finalPx + finalPy*finalPy + finalPz*finalPz); 256 finalPx /= finalMomentum; 257 finalPy /= finalMomentum; 258 finalPz /= finalMomentum; 259 260 product.ModifyPrimaryParticle(finalPx,finalPy,finalPz,k-bindingEnergy-secondaryKinetic); 261 product.AddEnergyDeposit(bindingEnergy); 262 263 G4DynamicParticle* aElectron = new G4DynamicParticle(G4Electron::Electron(),deltaDirection,secondaryKinetic); 264 product.AddSecondary(aElectron); 265 } 168 { 169 G4ParticleMomentum primaryDirection = particle->GetMomentumDirection(); 170 G4double particleMass = particle->GetDefinition()->GetPDGMass(); 171 G4double totalEnergy = k + particleMass; 172 G4double pSquare = k * (totalEnergy + particleMass); 173 G4double totalMomentum = std::sqrt(pSquare); 174 175 const G4String& particleName = particle->GetDefinition()->GetParticleName(); 176 177 G4int ionizationShell = cross.RandomSelect(k,particleName); 178 179 G4double secondaryKinetic = RandomizeEjectedElectronEnergy(particle->GetDefinition(),k,ionizationShell); 180 181 G4double bindingEnergy = waterStructure.IonisationEnergy(ionizationShell); 182 183 G4double cosTheta = 0.; 184 G4double phi = 0.; 185 RandomizeEjectedElectronDirection(track.GetDefinition(), k,secondaryKinetic, cosTheta, phi); 186 187 G4double sinTheta = std::sqrt(1.-cosTheta*cosTheta); 188 G4double dirX = sinTheta*std::cos(phi); 189 G4double dirY = sinTheta*std::sin(phi); 190 G4double dirZ = cosTheta; 191 G4ThreeVector deltaDirection(dirX,dirY,dirZ); 192 deltaDirection.rotateUz(primaryDirection); 193 194 G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 )); 195 196 G4double finalPx = totalMomentum*primaryDirection.x() - deltaTotalMomentum*deltaDirection.x(); 197 G4double finalPy = totalMomentum*primaryDirection.y() - deltaTotalMomentum*deltaDirection.y(); 198 G4double finalPz = totalMomentum*primaryDirection.z() - deltaTotalMomentum*deltaDirection.z(); 199 G4double finalMomentum = std::sqrt(finalPx*finalPx + finalPy*finalPy + finalPz*finalPz); 200 finalPx /= finalMomentum; 201 finalPy /= finalMomentum; 202 finalPz /= finalMomentum; 203 204 product.ModifyPrimaryParticle(finalPx,finalPy,finalPz,k-bindingEnergy-secondaryKinetic); 205 product.AddEnergyDeposit(bindingEnergy); 206 207 G4DynamicParticle* aElectron = new G4DynamicParticle(G4Electron::Electron(),deltaDirection,secondaryKinetic); 208 product.AddSecondary(aElectron); 209 } 266 210 267 211 return product; 268 212 } 269 213 214 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 270 215 271 216 G4double G4FinalStateIonisationBorn::RandomizeEjectedElectronEnergy(G4ParticleDefinition* particleDefinition, 272 G4double k, 273 G4int shell) 274 { 275 217 G4double k, G4int shell) 218 { 276 219 if (particleDefinition == G4Electron::ElectronDefinition()) 277 { 278 279 G4double maximumEnergyTransfer=0.; 280 if ((k+waterStructure.IonisationEnergy(shell))/2. > k) maximumEnergyTransfer=k; 281 else maximumEnergyTransfer = (k+waterStructure.IonisationEnergy(shell))/2.; 220 { 221 G4double maximumEnergyTransfer=0.; 222 if ((k+waterStructure.IonisationEnergy(shell))/2. > k) maximumEnergyTransfer=k; 223 else maximumEnergyTransfer = (k+waterStructure.IonisationEnergy(shell))/2.; 282 224 283 G4double crossSectionMaximum = 0.;284 for(G4double value=waterStructure.IonisationEnergy(shell); value<=maximumEnergyTransfer; value+=0.1*eV)285 {286 G4double differentialCrossSection = DifferentialCrossSection(particleDefinition, k/eV, value/eV, shell);287 if(differentialCrossSection >= crossSectionMaximum) crossSectionMaximum = differentialCrossSection;288 }225 G4double crossSectionMaximum = 0.; 226 for(G4double value=waterStructure.IonisationEnergy(shell); value<=maximumEnergyTransfer; value+=0.1*eV) 227 { 228 G4double differentialCrossSection = DifferentialCrossSection(particleDefinition, k/eV, value/eV, shell); 229 if(differentialCrossSection >= crossSectionMaximum) crossSectionMaximum = differentialCrossSection; 230 } 289 231 290 G4double secondaryElectronKineticEnergy=0.; 291 do 292 { 293 secondaryElectronKineticEnergy = G4UniformRand() * (maximumEnergyTransfer-waterStructure.IonisationEnergy(shell)); 294 } while(G4UniformRand()*crossSectionMaximum > 232 G4double secondaryElectronKineticEnergy=0.; 233 do 234 { 235 secondaryElectronKineticEnergy = G4UniformRand() * (maximumEnergyTransfer-waterStructure.IonisationEnergy(shell)); 236 } while(G4UniformRand()*crossSectionMaximum > 237 DifferentialCrossSection(particleDefinition, k/eV,(secondaryElectronKineticEnergy+waterStructure.IonisationEnergy(shell))/eV,shell)); 238 239 return secondaryElectronKineticEnergy; 240 241 } 242 243 if (particleDefinition == G4Proton::ProtonDefinition()) 244 { 245 G4double maximumKineticEnergyTransfer = 4.* (electron_mass_c2 / proton_mass_c2) * k - (waterStructure.IonisationEnergy(shell)); 246 247 G4double crossSectionMaximum = 0.; 248 for (G4double value = waterStructure.IonisationEnergy(shell); 249 value<=4.*waterStructure.IonisationEnergy(shell) ; 250 value+=0.1*eV) 251 { 252 G4double differentialCrossSection = DifferentialCrossSection(particleDefinition, k/eV, value/eV, shell); 253 if (differentialCrossSection >= crossSectionMaximum) crossSectionMaximum = differentialCrossSection; 254 } 255 256 G4double secondaryElectronKineticEnergy = 0.; 257 do 258 { 259 secondaryElectronKineticEnergy = G4UniformRand() * maximumKineticEnergyTransfer; 260 } while(G4UniformRand()*crossSectionMaximum >= 295 261 DifferentialCrossSection(particleDefinition, k/eV,(secondaryElectronKineticEnergy+waterStructure.IonisationEnergy(shell))/eV,shell)); 296 262 297 return secondaryElectronKineticEnergy; 298 299 } 300 301 if (particleDefinition == G4Proton::ProtonDefinition()) 302 { 303 G4double maximumKineticEnergyTransfer = 4.* (electron_mass_c2 / proton_mass_c2) * k - (waterStructure.IonisationEnergy(shell)); 304 305 G4double crossSectionMaximum = 0.; 306 for (G4double value = waterStructure.IonisationEnergy(shell); 307 value<=4.*waterStructure.IonisationEnergy(shell) ; 308 value+=0.1*eV) 309 { 310 G4double differentialCrossSection = DifferentialCrossSection(particleDefinition, k/eV, value/eV, shell); 311 if (differentialCrossSection >= crossSectionMaximum) crossSectionMaximum = differentialCrossSection; 312 } 313 314 G4double secondaryElectronKineticEnergy = 0.; 315 do 316 { 317 secondaryElectronKineticEnergy = G4UniformRand() * maximumKineticEnergyTransfer; 318 } while(G4UniformRand()*crossSectionMaximum >= 319 DifferentialCrossSection(particleDefinition, k/eV,(secondaryElectronKineticEnergy+waterStructure.IonisationEnergy(shell))/eV,shell)); 320 321 return secondaryElectronKineticEnergy; 322 } 263 return secondaryElectronKineticEnergy; 264 } 323 265 324 266 return 0; 325 267 } 326 268 269 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 327 270 328 271 void G4FinalStateIonisationBorn::RandomizeEjectedElectronDirection(G4ParticleDefinition* particleDefinition, … … 333 276 { 334 277 if (particleDefinition == G4Electron::ElectronDefinition()) 335 { 336 337 phi = twopi * G4UniformRand(); 338 if (secKinetic < 50.*eV) cosTheta = (2.*G4UniformRand())-1.; 339 else if (secKinetic <= 200.*eV) 340 { 341 if (G4UniformRand() <= 0.1) cosTheta = (2.*G4UniformRand())-1.; 342 else cosTheta = G4UniformRand()*(std::sqrt(2.)/2); 343 } 344 else 345 { 346 G4double sin2O = (1.-secKinetic/k) / (1.+secKinetic/(2.*electron_mass_c2)); 347 cosTheta = std::sqrt(1.-sin2O); 348 } 349 } 278 { 279 phi = twopi * G4UniformRand(); 280 if (secKinetic < 50.*eV) cosTheta = (2.*G4UniformRand())-1.; 281 else if (secKinetic <= 200.*eV) 282 { 283 if (G4UniformRand() <= 0.1) cosTheta = (2.*G4UniformRand())-1.; 284 else cosTheta = G4UniformRand()*(std::sqrt(2.)/2); 285 } 286 else 287 { 288 G4double sin2O = (1.-secKinetic/k) / (1.+secKinetic/(2.*electron_mass_c2)); 289 cosTheta = std::sqrt(1.-sin2O); 290 } 291 } 350 292 351 293 if (particleDefinition == G4Proton::ProtonDefinition()) 352 { 353 G4double maxSecKinetic = 4.* (electron_mass_c2 / proton_mass_c2) * k; 354 phi = twopi * G4UniformRand(); 355 cosTheta = std::sqrt(secKinetic / maxSecKinetic); 356 } 357 } 358 294 { 295 G4double maxSecKinetic = 4.* (electron_mass_c2 / proton_mass_c2) * k; 296 phi = twopi * G4UniformRand(); 297 cosTheta = std::sqrt(secKinetic / maxSecKinetic); 298 } 299 } 300 301 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 359 302 360 303 double G4FinalStateIonisationBorn::DifferentialCrossSection(G4ParticleDefinition * particleDefinition, … … 366 309 367 310 if (energyTransfer >= waterStructure.IonisationEnergy(ionizationLevelIndex)) 368 { 369 G4double valueT1 = 0; 370 G4double valueT2 = 0; 371 G4double valueE21 = 0; 372 G4double valueE22 = 0; 373 G4double valueE12 = 0; 374 G4double valueE11 = 0; 375 376 G4double xs11 = 0; 377 G4double xs12 = 0; 378 G4double xs21 = 0; 379 G4double xs22 = 0; 380 311 { 312 G4double valueT1 = 0; 313 G4double valueT2 = 0; 314 G4double valueE21 = 0; 315 G4double valueE22 = 0; 316 G4double valueE12 = 0; 317 G4double valueE11 = 0; 318 319 G4double xs11 = 0; 320 G4double xs12 = 0; 321 G4double xs21 = 0; 322 G4double xs22 = 0; 323 324 if (particleDefinition == G4Electron::ElectronDefinition()) 325 { 326 // k should be in eV and energy transfer eV also 327 328 std::vector<double>::iterator t2 = std::upper_bound(eTdummyVec.begin(),eTdummyVec.end(), k); 329 330 std::vector<double>::iterator t1 = t2-1; 331 332 // SI : the following condition avoids situations where energyTransfer >last vector element 333 if (energyTransfer <= eVecm[(*t1)].back()) 334 { 335 std::vector<double>::iterator e12 = std::upper_bound(eVecm[(*t1)].begin(),eVecm[(*t1)].end(), energyTransfer); 336 std::vector<double>::iterator e11 = e12-1; 337 338 std::vector<double>::iterator e22 = std::upper_bound(eVecm[(*t2)].begin(),eVecm[(*t2)].end(), energyTransfer); 339 std::vector<double>::iterator e21 = e22-1; 340 341 valueT1 =*t1; 342 valueT2 =*t2; 343 valueE21 =*e21; 344 valueE22 =*e22; 345 valueE12 =*e12; 346 valueE11 =*e11; 347 348 xs11 = eDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE11]; 349 xs12 = eDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE12]; 350 xs21 = eDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE21]; 351 xs22 = eDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE22]; 352 } 353 354 } 355 356 if (particleDefinition == G4Proton::ProtonDefinition()) 357 { 358 // k should be in eV and energy transfer eV also 359 std::vector<double>::iterator t2 = std::upper_bound(pTdummyVec.begin(),pTdummyVec.end(), k); 360 std::vector<double>::iterator t1 = t2-1; 361 362 std::vector<double>::iterator e12 = std::upper_bound(pVecm[(*t1)].begin(),pVecm[(*t1)].end(), energyTransfer); 363 std::vector<double>::iterator e11 = e12-1; 364 365 std::vector<double>::iterator e22 = std::upper_bound(pVecm[(*t2)].begin(),pVecm[(*t2)].end(), energyTransfer); 366 std::vector<double>::iterator e21 = e22-1; 381 367 382 if (particleDefinition == G4Electron::ElectronDefinition()) 383 { 384 // k should be in eV and energy transfer eV also 385 std::vector<double>::iterator t2 = std::upper_bound(eTdummyVec.begin(),eTdummyVec.end(), k); 386 std::vector<double>::iterator t1 = t2-1; 387 std::vector<double>::iterator e12 = std::upper_bound(eVecm[(*t1)].begin(),eVecm[(*t1)].end(), energyTransfer); 388 std::vector<double>::iterator e11 = e12-1; 389 390 std::vector<double>::iterator e22 = std::upper_bound(eVecm[(*t2)].begin(),eVecm[(*t2)].end(), energyTransfer); 391 std::vector<double>::iterator e21 = e22-1; 392 393 valueT1 =*t1; 394 valueT2 =*t2; 395 valueE21 =*e21; 396 valueE22 =*e22; 397 valueE12 =*e12; 398 valueE11 =*e11; 399 400 xs11 = eDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE11]; 401 xs12 = eDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE12]; 402 xs21 = eDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE21]; 403 xs22 = eDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE22]; 404 405 } 406 407 if (particleDefinition == G4Proton::ProtonDefinition()) 408 { 409 // k should be in eV and energy transfer eV also 410 std::vector<double>::iterator t2 = std::upper_bound(pTdummyVec.begin(),pTdummyVec.end(), k); 411 std::vector<double>::iterator t1 = t2-1; 412 std::vector<double>::iterator e12 = std::upper_bound(pVecm[(*t1)].begin(),pVecm[(*t1)].end(), energyTransfer); 413 std::vector<double>::iterator e11 = e12-1; 414 415 std::vector<double>::iterator e22 = std::upper_bound(pVecm[(*t2)].begin(),pVecm[(*t2)].end(), energyTransfer); 416 std::vector<double>::iterator e21 = e22-1; 417 418 valueT1 =*t1; 419 valueT2 =*t2; 420 valueE21 =*e21; 421 valueE22 =*e22; 422 valueE12 =*e12; 423 valueE11 =*e11; 424 425 xs11 = pDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE11]; 426 xs12 = pDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE12]; 427 xs21 = pDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE21]; 428 xs22 = pDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE22]; 429 } 430 431 G4double xsProduct = xs11 * xs12 * xs21 * xs22; 432 // if (xs11==0 || xs12==0 ||xs21==0 ||xs22==0) return (0.); 433 if (xsProduct != 0.) 434 { 435 sigma = QuadInterpolator(valueE11, valueE12, 368 valueT1 =*t1; 369 valueT2 =*t2; 370 valueE21 =*e21; 371 valueE22 =*e22; 372 valueE12 =*e12; 373 valueE11 =*e11; 374 375 xs11 = pDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE11]; 376 xs12 = pDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE12]; 377 xs21 = pDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE21]; 378 xs22 = pDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE22]; 379 380 } 381 382 G4double xsProduct = xs11 * xs12 * xs21 * xs22; 383 if (xsProduct != 0.) 384 { 385 sigma = QuadInterpolator( valueE11, valueE12, 436 386 valueE21, valueE22, 437 387 xs11, xs12, … … 439 389 valueT1, valueT2, 440 390 k, energyTransfer); 441 } 442 } 391 } 392 393 } 394 443 395 return sigma; 444 396 } 445 397 398 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 446 399 447 400 G4double G4FinalStateIonisationBorn::LogLogInterpolate(G4double e1, … … 458 411 } 459 412 413 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 460 414 461 415 G4double G4FinalStateIonisationBorn::QuadInterpolator(G4double e11, G4double e12, -
trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateIonisationRudd.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // 27 // $Id: G4FinalStateIonisationRudd.cc,v 1.5 2007/11/26 17:27:09 pia Exp $ 28 // GEANT4 tag $Name: $ 29 // 30 // Contact Author: Sebastien Incerti (incerti@cenbg.in2p3.fr) 31 // Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 32 // 33 /// 34 // Reference: TNS Geant4-DNA paper 35 // Reference for implementation model: NIM. 155, pp. 145-156, 1978 36 // 37 // History: 38 // ----------- 39 // Date Name Modification 40 // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper 41 // Nov 2007 S. Incerti Implementation 42 // 26 Nov 2007 MGP Cleaned up std:: 43 // 44 // ------------------------------------------------------------------- 45 46 // Class description: 47 // Reference: TNS Geant4-DNA paper 48 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: 49 // design foundation and implementation of the first set of models, 50 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007. 51 // Further documentation available from http://www.ge.infn.it/geant4/dna 52 53 // ------------------------------------------------------------------- 54 26 // $Id: G4FinalStateIonisationRudd.cc,v 1.8 2008/08/20 14:51:48 sincerti Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 55 28 56 29 #include "G4FinalStateIonisationRudd.hh" 57 #include "G4Track.hh" 58 #include "G4Step.hh" 59 #include "G4DynamicParticle.hh" 60 #include "Randomize.hh" 61 62 #include "G4ParticleTypes.hh" 63 #include "G4ParticleDefinition.hh" 64 #include "G4Electron.hh" 65 #include "G4Proton.hh" 66 #include "G4SystemOfUnits.hh" 67 #include "G4ParticleMomentum.hh" 68 #include "G4DNAGenericIonsManager.hh" 69 30 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 70 32 71 33 G4FinalStateIonisationRudd::G4FinalStateIonisationRudd() 72 34 { 73 name = "IonisationBorn";74 // Default energy limits (defined for protection against anomalous behaviour only)75 35 lowEnergyLimitDefault = 100 * eV; 76 36 highEnergyLimitDefault = 100 * MeV; … … 112 72 } 113 73 74 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 114 75 115 76 G4FinalStateIonisationRudd::~G4FinalStateIonisationRudd() 116 { }117 118 77 {} 78 79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 119 80 120 81 const G4FinalStateProduct& G4FinalStateIonisationRudd::GenerateFinalState(const G4Track& track, const G4Step& /* step */) 121 82 { 122 // Clear previous secondaries, energy deposit and particle kill status123 83 product.Clear(); 124 84 … … 132 92 const G4String& particleName = particle->GetDefinition()->GetParticleName(); 133 93 134 // Retrieve energy limits for the current particle type135 136 94 std::map< G4String,G4double,std::less<G4String> >::iterator pos1; 137 95 pos1 = lowEnergyLimit.find(particleName); 138 96 139 // Lower limit140 97 if (pos1 != lowEnergyLimit.end()) 141 { 142 lowLim = pos1->second; 143 } 144 145 // Upper limit 98 { 99 lowLim = pos1->second; 100 } 101 146 102 std::map< G4String,G4double,std::less<G4String> >::iterator pos2; 147 103 pos2 = highEnergyLimit.find(particleName); 148 104 149 105 if (pos2 != highEnergyLimit.end()) 150 { 151 highLim = pos2->second; 152 } 153 154 // Verify that the current track is within the energy limits of validity of the cross section model 106 { 107 highLim = pos2->second; 108 } 155 109 156 110 if (k >= lowLim && k <= highLim) 157 { 158 // Kinetic energy of primary particle 159 111 { 160 112 G4ParticleDefinition* definition = particle->GetDefinition(); 161 113 G4ParticleMomentum primaryDirection = particle->GetMomentumDirection(); … … 186 138 G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 )); 187 139 188 // Primary Particle Direction189 140 G4double finalPx = totalMomentum*primaryDirection.x() - deltaTotalMomentum*deltaDirection.x(); 190 141 G4double finalPy = totalMomentum*primaryDirection.y() - deltaTotalMomentum*deltaDirection.y(); … … 200 151 G4DynamicParticle* aElectron = new G4DynamicParticle(G4Electron::Electron(),deltaDirection,secondaryKinetic); 201 152 product.AddSecondary(aElectron); 202 } 203 204 if (k < lowLim) {product.KillPrimaryParticle();product.AddEnergyDeposit(k);} 153 } 154 155 if (k < lowLim) 156 { 157 product.KillPrimaryParticle(); 158 } 205 159 206 160 return product; 207 161 } 208 162 209 163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 210 164 211 165 G4double G4FinalStateIonisationRudd::RandomizeEjectedElectronEnergy(G4ParticleDefinition* particleDefinition, … … 220 174 if (particleDefinition == G4Proton::ProtonDefinition() 221 175 || particleDefinition == instance->GetIon("hydrogen")) 222 223 { 176 { 224 177 maximumKineticEnergyTransfer= 4.* (electron_mass_c2 / proton_mass_c2) * k; 225 }178 } 226 179 227 180 if (particleDefinition == instance->GetIon("helium") 228 181 || particleDefinition == instance->GetIon("alpha+") 229 182 || particleDefinition == instance->GetIon("alpha++")) 230 {183 { 231 184 maximumKineticEnergyTransfer= 4.* (0.511 / 3728) * k; 232 }185 } 233 186 234 187 G4double crossSectionMaximum = 0.; 188 235 189 for(G4double value=waterStructure.IonisationEnergy(shell); value<=4.*waterStructure.IonisationEnergy(shell) ; value+=0.1*eV) 236 {190 { 237 191 G4double differentialCrossSection = DifferentialCrossSection(particleDefinition, k, value, shell); 238 192 if(differentialCrossSection >= crossSectionMaximum) crossSectionMaximum = differentialCrossSection; 239 } 193 } 194 240 195 G4double secElecKinetic = 0.; 241 do{ 196 197 do 198 { 242 199 secElecKinetic = G4UniformRand() * maximumKineticEnergyTransfer; 243 200 } while(G4UniformRand()*crossSectionMaximum > DifferentialCrossSection(particleDefinition, … … 249 206 } 250 207 208 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 209 251 210 252 211 void G4FinalStateIonisationRudd::RandomizeEjectedElectronDirection(G4ParticleDefinition* particleDefinition, 253 212 G4double k, 254 213 G4double secKinetic, 255 G4double cosTheta,256 G4double phi )214 G4double & cosTheta, 215 G4double & phi ) 257 216 { 258 217 G4DNAGenericIonsManager *instance; … … 263 222 if (particleDefinition == G4Proton::ProtonDefinition() 264 223 || particleDefinition == instance->GetIon("hydrogen")) 265 {224 { 266 225 maxSecKinetic = 4.* (electron_mass_c2 / proton_mass_c2) * k; 267 }226 } 268 227 269 228 if (particleDefinition == instance->GetIon("helium") 270 229 || particleDefinition == instance->GetIon("alpha+") 271 230 || particleDefinition == instance->GetIon("alpha++")) 272 {231 { 273 232 maxSecKinetic = 4.* (0.511 / 3728) * k; 274 }233 } 275 234 276 235 phi = twopi * G4UniformRand(); 277 236 cosTheta = std::sqrt(secKinetic / maxSecKinetic); 278 237 } 238 239 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 279 240 280 241 … … 314 275 315 276 if (j == 4) 316 {277 { 317 278 //Data For Liquid Water K SHELL from Dingfelder (Protons in Water) 318 279 A1 = 1.25; … … 326 287 D2 = 0.00; 327 288 alphaConst = 0.66; 328 }289 } 329 290 else 330 {291 { 331 292 //Data For Liquid Water from Dingfelder (Protons in Water) 332 293 A1 = 1.02; … … 340 301 D2 = 0.04; 341 302 alphaConst = 0.64; 342 }303 } 343 304 344 305 const G4double n = 2.; 345 306 const G4double Gj[5] = {0.99, 1.11, 1.11, 0.52, 1.}; 346 347 //const G4double I[5]={12.61*eV, 14.73*eV, 18.55*eV, 32.2*eV, 539.7*eV}; // for water Vapor348 //const G4double energyConstant[]={10.79*eV, 13.39*eV, 16.05*eV, 32.30*eV, 539.*eV};349 307 350 308 G4DNAGenericIonsManager* instance; … … 359 317 if (particleDefinition == G4Proton::ProtonDefinition() 360 318 || particleDefinition == instance->GetIon("hydrogen")) 361 {319 { 362 320 tau = (electron_mass_c2/proton_mass_c2) * k ; 363 }321 } 364 322 365 323 if ( particleDefinition == instance->GetIon("helium") 366 324 || particleDefinition == instance->GetIon("alpha+") 367 325 || particleDefinition == instance->GetIon("alpha++")) 368 {326 { 369 327 tau = (0.511/3728.) * k ; 370 }328 } 371 329 372 330 G4double S = 4.*pi * Bohr_radius*Bohr_radius * n * std::pow((Ry/waterStructure.IonisationEnergy(ionizationLevelIndex)),2); … … 390 348 || particleDefinition == instance->GetIon("hydrogen") 391 349 ) 392 {350 { 393 351 return(sigma); 394 } 395 396 // ------------ 397 352 } 353 398 354 if (particleDefinition == instance->GetIon("alpha++") ) 399 {355 { 400 356 slaterEffectiveCharge[0]=0.; 401 357 slaterEffectiveCharge[1]=0.; … … 404 360 sCoefficient[1]=0.; 405 361 sCoefficient[2]=0.; 406 }362 } 407 363 408 364 if (particleDefinition == instance->GetIon("alpha+") ) 409 {365 { 410 366 slaterEffectiveCharge[0]=2.0; 411 367 slaterEffectiveCharge[1]=1.15; … … 414 370 sCoefficient[1]=0.15; 415 371 sCoefficient[2]=0.15; 416 }372 } 417 373 418 374 if (particleDefinition == instance->GetIon("helium") ) 419 {375 { 420 376 slaterEffectiveCharge[0]=1.7; 421 377 slaterEffectiveCharge[1]=1.15; … … 424 380 sCoefficient[1]=0.25; 425 381 sCoefficient[2]=0.25; 426 }382 } 427 383 428 384 if ( particleDefinition == instance->GetIon("helium") … … 430 386 || particleDefinition == instance->GetIon("alpha++") 431 387 ) 432 {388 { 433 389 sigma = Gj[j] * (S/waterStructure.IonisationEnergy(ionizationLevelIndex)) * ( (F1+w*F2) / ( std::pow((1.+w),3) * ( 1.+std::exp(alphaConst*(w-wc)/v))) ); 434 390 … … 440 396 441 397 return zEff * zEff * sigma ; 442 }398 } 443 399 444 400 return 0; 445 401 } 402 403 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 446 404 447 405 G4double G4FinalStateIonisationRudd::S_1s(G4double t, … … 459 417 } 460 418 461 419 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 462 420 463 421 G4double G4FinalStateIonisationRudd::S_2s(G4double t, … … 476 434 } 477 435 478 436 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 479 437 480 438 G4double G4FinalStateIonisationRudd::S_2p(G4double t, … … 492 450 } 493 451 494 452 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 495 453 496 454 G4double G4FinalStateIonisationRudd::R(G4double t, … … 500 458 { 501 459 // tElectron = m_electron / m_alpha * t 502 // Hardcoded in Riccardo's implementation; to be corrected503 460 // Dingfelder, in Chattanooga 2005 proceedings, p 4 504 461 … … 509 466 } 510 467 511 468 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 512 469 513 470 G4double G4FinalStateIonisationRudd::CorrectionFactor(G4ParticleDefinition* particleDefinition, G4double k) … … 517 474 518 475 if (particleDefinition == G4Proton::Proton()) 519 {476 { 520 477 return(1.); 521 }478 } 522 479 else 523 480 if (particleDefinition == instance->GetIon("hydrogen")) 524 {481 { 525 482 G4double value = (std::log(k/eV)-4.2)/0.5; 526 483 return((0.8/(1+std::exp(value))) + 0.9); 527 }484 } 528 485 else 529 {486 { 530 487 return(1.); 531 }532 } 488 } 489 } -
trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateKill.cc
r819 r961 26 26 // 27 27 // $Id: G4FinalStateKill.cc,v 1.1 2007/11/09 20:26:12 pia Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) -
trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateProduct.cc
r819 r961 25 25 // 26 26 // 27 // $Id: G4FinalStateProduct.cc,v 1. 5 2007/11/09 20:11:04 piaExp $28 // GEANT4 tag $Name: $27 // $Id: G4FinalStateProduct.cc,v 1.6 2009/01/20 07:50:28 sincerti Exp $ 28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) … … 53 53 #include "G4ThreeVector.hh" 54 54 55 G4FinalStateProduct::G4FinalStateProduct() : killStatus(false), isModified(false), localEnergyDeposit(0.), modifiedEnergy(0)55 G4FinalStateProduct::G4FinalStateProduct() : killStatus(false), doNotDepositStatus(false), isModified(false), localEnergyDeposit(0.), modifiedEnergy(0) 56 56 { 57 57 // empty … … 68 68 // Reset object status 69 69 killStatus = false; 70 doNotDepositStatus = false; 70 71 isModified = false; 71 72 localEnergyDeposit = 0.; … … 98 99 } 99 100 101 void G4FinalStateProduct::DoNotDepositEnergy() 102 { 103 doNotDepositStatus = true; 104 } 105 100 106 void G4FinalStateProduct::KillPrimaryParticle() 101 107 { 108 102 109 // ---- MGP ---- To be added: Handle local energy deposit here 103 110 killStatus = true; -
trunk/source/processes/electromagnetic/lowenergy/src/G4FluoTransition.cc
r819 r961 26 26 // 27 27 // $Id: G4FluoTransition.cc,v 1.2 ???? 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it) -
trunk/source/processes/electromagnetic/lowenergy/src/G4LinInterpolation.cc
r819 r961 26 26 // 27 27 // $Id: G4LinInterpolation.cc,v 1.3 2006/06/29 19:40:03 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) -
trunk/source/processes/electromagnetic/lowenergy/src/G4LogLogInterpolation.cc
r819 r961 25 25 // 26 26 // 27 // $Id: G4LogLogInterpolation.cc,v 1. 7 2006/06/29 19:40:09 gunterExp $28 // GEANT4 tag $Name: $27 // $Id: G4LogLogInterpolation.cc,v 1.14 2008/12/12 08:50:59 sincerti Exp $ 28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) 31 // 31 // Sebastian Incerti (incerti@cenbg.in2p3.fr) 32 // Nicolas A. Karakatsanis (knicolas@mail.ntua.gr) 32 33 // History: 33 34 // ----------- 34 35 // 31 Jul 2001 MGP Created 35 // 36 // 27 Jun 2008 SI Add check to avoid FPE errors 37 // 08 Dec 2008 NAK Log-Log interpolation math formula streamlined, self-test function 36 38 // ------------------------------------------------------------------- 37 39 … … 57 59 { 58 60 G4int nBins = data.size() - 1; 61 //G4double oldresult = 0.; 59 62 G4double value = 0.; 60 63 if (x < points[0]) … … 68 71 G4double d1 = data[bin]; 69 72 G4double d2 = data[bin+1]; 70 value = (std::log10(d1)*std::log10(e2/x) + std::log10(d2)*std::log10(x/e1)) / std::log10(e2/e1); 71 value = std::pow(10.,value); 73 // Check of e1, e2, d1 and d2 values to avoid floating-point errors when estimating the interpolated value below -- S.I., Jun. 2008 74 if ((d1 > 0.) && (d2 > 0.) && (e1 > 0.) && (e2 > 0.)) 75 { 76 // Streamline the Log-Log Interpolation formula in order to reduce the required number of log10() function calls 77 // Variable oldresult contains the result of old implementation of Log-Log interpolation -- M.G.P. Jun. 2001 78 // oldresult = (std::log10(d1)*std::log10(e2/x) + std::log10(d2)*std::log10(x/e1)) / std::log10(e2/e1); 79 // oldresult = std::pow(10.,oldresult); 80 // Variable value contains the result of new implementation, after streamlining the math operation -- N.A.K. Oct. 2008 81 value = std::log10(d1)+(std::log10(d2/d1)/std::log10(e2/e1)*std::log10(x/e1)); 82 value = std::pow(10.,value); 83 // Test of the new implementation result (value variable) against the old one (oldresult) -- N.A.K. Dec. 2008 84 // G4double diffResult = value - oldresult; 85 // G4double relativeDiff = 1e-11; 86 // Comparison of the two values based on a max allowable relative difference 87 // if ( std::fabs(diffResult) > relativeDiff*std::fabs(oldresult) ) 88 // { 89 // Abort comparison when at least one of two results is infinite 90 // if ((!std::isinf(oldresult)) && (!std::isinf(value))) 91 // { 92 // G4cout << "G4LogLogInterpolation> Old Interpolated Value is:" << oldresult << G4endl; 93 // G4cout << "G4LogLogInterpolation> New Interpolated Value is:" << value << G4endl << G4endl; 94 // G4cerr << "G4LogLogInterpolation> Error in Interpolation:" << G4endl; 95 // G4cerr << "The difference between new and old interpolated value is:" << diffResult << G4endl << G4endl; 96 // } 97 // } 98 } 99 else value = 0.; 72 100 } 73 101 else … … 75 103 value = data[nBins]; 76 104 } 77 78 105 return value; 79 106 } -
trunk/source/processes/electromagnetic/lowenergy/src/G4LowEnergyBremsstrahlung.cc
r819 r961 25 25 // 26 26 // $Id: G4LowEnergyBremsstrahlung.cc,v 1.71 2006/06/29 19:40:13 gunter Exp $ 27 // GEANT4 tag $Name: $27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // -------------------------------------------------------------- -
trunk/source/processes/electromagnetic/lowenergy/src/G4LowEnergyCompton.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4LowEnergyCompton.cc,v 1.4 1 2006/06/29 19:40:15gunter Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4LowEnergyCompton.cc,v 1.47 2008/12/18 13:01:28 gunter Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // Author: A. Forti … … 65 65 #include "G4VRangeTest.hh" 66 66 #include "G4RangeTest.hh" 67 #include "G4RangeNoTest.hh" 67 68 #include "G4MaterialCutsCouple.hh" 68 69 … … 90 91 meanFreePathTable = 0; 91 92 92 rangeTest = new G4RangeTest; 93 rangeTest = new G4RangeNoTest; 94 95 // For Doppler broadening 96 shellData.SetOccupancyData(); 93 97 94 98 if (verboseLevel > 0) … … 119 123 delete meanFreePathTable; 120 124 meanFreePathTable = crossSectionHandler->BuildMeanFreePathForMaterials(); 125 126 // For Doppler broadening 127 G4String file = "/doppler/shell-doppler"; 128 shellData.LoadData(file); 121 129 } 122 130 … … 154 162 G4double e0m = photonEnergy0 / electron_mass_c2 ; 155 163 G4ParticleMomentum photonDirection0 = incidentPhoton->GetMomentumDirection(); 156 157 // Select randomly one element in the current material158 const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple();159 G4int Z = crossSectionHandler->SelectRandomAtom(couple,photonEnergy0);160 161 164 G4double epsilon0 = 1. / (1. + 2. * e0m); 162 165 G4double epsilon0Sq = epsilon0 * epsilon0; 163 166 G4double alpha1 = -std::log(epsilon0); 164 167 G4double alpha2 = 0.5 * (1. - epsilon0Sq); 165 166 168 G4double wlPhoton = h_Planck*c_light/photonEnergy0; 169 170 // Select randomly one element in the current material 171 const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple(); 172 G4int Z = crossSectionHandler->SelectRandomAtom(couple,photonEnergy0); 167 173 168 174 // Sample the energy of the scattered photon … … 196 202 G4double sinTheta = std::sqrt (sinT2); 197 203 G4double phi = twopi * G4UniformRand() ; 198 G4double dirx = sinTheta * std::cos(phi); 199 G4double diry = sinTheta * std::sin(phi); 200 G4double dirz = cosTheta ; 204 G4double dirX = sinTheta * std::cos(phi); 205 G4double dirY = sinTheta * std::sin(phi); 206 G4double dirZ = cosTheta ; 207 208 // Doppler broadening - Method based on: 209 // Y. Namito, S. Ban and H. Hirayama, 210 // "Implementation of the Doppler Broadening of a Compton-Scattered Photon Into the EGS4 Code" 211 // NIM A 349, pp. 489-494, 1994 212 213 // Maximum number of sampling iterations 214 G4int maxDopplerIterations = 1000; 215 G4double bindingE = 0.; 216 G4double photonEoriginal = epsilon * photonEnergy0; 217 G4double photonE = -1.; 218 G4int iteration = 0; 219 G4double eMax = photonEnergy0; 220 do 221 { 222 iteration++; 223 // Select shell based on shell occupancy 224 G4int shell = shellData.SelectRandomShell(Z); 225 bindingE = shellData.BindingEnergy(Z,shell); 226 227 eMax = photonEnergy0 - bindingE; 228 229 // Randomly sample bound electron momentum (memento: the data set is in Atomic Units) 230 G4double pSample = profileData.RandomSelectMomentum(Z,shell); 231 // Rescale from atomic units 232 G4double pDoppler = pSample * fine_structure_const; 233 G4double pDoppler2 = pDoppler * pDoppler; 234 G4double var2 = 1. + oneCosT * e0m; 235 G4double var3 = var2*var2 - pDoppler2; 236 G4double var4 = var2 - pDoppler2 * cosTheta; 237 G4double var = var4*var4 - var3 + pDoppler2 * var3; 238 if (var > 0.) 239 { 240 G4double varSqrt = std::sqrt(var); 241 G4double scale = photonEnergy0 / var3; 242 // Random select either root 243 if (G4UniformRand() < 0.5) photonE = (var4 - varSqrt) * scale; 244 else photonE = (var4 + varSqrt) * scale; 245 } 246 else 247 { 248 photonE = -1.; 249 } 250 } while ( iteration <= maxDopplerIterations && 251 (photonE < 0. || photonE > eMax || photonE < eMax*G4UniformRand()) ); 252 253 // End of recalculation of photon energy with Doppler broadening 254 // Revert to original if maximum number of iterations threshold has been reached 255 if (iteration >= maxDopplerIterations) 256 { 257 photonE = photonEoriginal; 258 bindingE = 0.; 259 } 201 260 202 261 // Update G4VParticleChange for the scattered photon 203 262 204 G4ThreeVector photonDirection1(dir x,diry,dirz);263 G4ThreeVector photonDirection1(dirX,dirY,dirZ); 205 264 photonDirection1.rotateUz(photonDirection0); 206 aParticleChange.ProposeMomentumDirection(photonDirection1) ; 207 G4double photonEnergy1 = epsilon * photonEnergy0; 265 aParticleChange.ProposeMomentumDirection(photonDirection1); 266 267 G4double photonEnergy1 = photonE; 268 //G4cout << "--> PHOTONENERGY1 = " << photonE/keV << G4endl; 208 269 209 270 if (photonEnergy1 > 0.) … … 218 279 219 280 // Kinematics of the scattered electron 220 G4double eKineticEnergy = photonEnergy0 - photonEnergy1; 281 G4double eKineticEnergy = photonEnergy0 - photonEnergy1 - bindingE; 282 G4double eTotalEnergy = eKineticEnergy + electron_mass_c2; 283 284 G4double electronE = photonEnergy0 * (1. - epsilon) + electron_mass_c2; 285 G4double electronP2 = electronE*electronE - electron_mass_c2*electron_mass_c2; 286 G4double sinThetaE = -1.; 287 G4double cosThetaE = 0.; 288 if (electronP2 > 0.) 289 { 290 cosThetaE = (eTotalEnergy + photonEnergy1 )* (1. - epsilon) / std::sqrt(electronP2); 291 sinThetaE = -1. * std::sqrt(1. - cosThetaE * cosThetaE); 292 } 293 294 G4double eDirX = sinThetaE * std::cos(phi); 295 G4double eDirY = sinThetaE * std::sin(phi); 296 G4double eDirZ = cosThetaE; 221 297 222 298 // Generate the electron only if with large enough range w.r.t. cuts and safety … … 226 302 if (rangeTest->Escape(G4Electron::Electron(),couple,eKineticEnergy,safety)) 227 303 { 228 G4double eMomentum = std::sqrt(eKineticEnergy*(eKineticEnergy+2.*electron_mass_c2)); 229 G4ThreeVector eDirection((photonEnergy0 * photonDirection0 - 230 photonEnergy1 * photonDirection1) * (1./eMomentum)); 231 G4DynamicParticle* electron = new G4DynamicParticle (G4Electron::Electron(), 232 eDirection,eKineticEnergy) ; 304 G4ThreeVector eDirection(eDirX,eDirY,eDirZ); 305 eDirection.rotateUz(photonDirection0); 306 307 G4DynamicParticle* electron = new G4DynamicParticle (G4Electron::Electron(),eDirection,eKineticEnergy) ; 233 308 aParticleChange.SetNumberOfSecondaries(1); 234 309 aParticleChange.AddSecondary(electron); 235 aParticleChange.ProposeLocalEnergyDeposit(0.); 310 // Binding energy deposited locally 311 aParticleChange.ProposeLocalEnergyDeposit(bindingE); 236 312 } 237 313 else 238 314 { 239 315 aParticleChange.SetNumberOfSecondaries(0); 240 aParticleChange.ProposeLocalEnergyDeposit(eKineticEnergy );316 aParticleChange.ProposeLocalEnergyDeposit(eKineticEnergy + bindingE); 241 317 } 242 318 -
trunk/source/processes/electromagnetic/lowenergy/src/G4LowEnergyGammaConversion.cc
r819 r961 27 27 /// 28 28 // $Id: G4LowEnergyGammaConversion.cc,v 1.36 2006/06/29 19:40:17 gunter Exp $ 29 // GEANT4 tag $Name: $29 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 30 30 // 31 31 // -
trunk/source/processes/electromagnetic/lowenergy/src/G4LowEnergyIonisation.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4LowEnergyIonisation.cc,v 1.10 2 2006/06/29 19:40:19 gunterExp $27 // GEANT4 tag $Name: $26 // $Id: G4LowEnergyIonisation.cc,v 1.103 2008/05/02 19:23:38 pia Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // -------------------------------------------------------------- … … 663 663 type = aSecondary->GetDefinition(); 664 664 if ( eTot + e <= eLoss && 665 ( type == G4Gamma::Gamma() && e>cutForPhotons ) ||666 (type == G4Electron::Electron() && e>cutForElectrons)) {665 ((type == G4Gamma::Gamma() && e>cutForPhotons ) || 666 (type == G4Electron::Electron() && e>cutForElectrons))) { 667 667 668 668 eTot += e; -
trunk/source/processes/electromagnetic/lowenergy/src/G4LowEnergyPhotoElectric.cc
r819 r961 26 26 // 27 27 // $Id: G4LowEnergyPhotoElectric.cc,v 1.56 2006/06/29 19:40:23 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Author: A. Forti -
trunk/source/processes/electromagnetic/lowenergy/src/G4LowEnergyPolarizedCompton.cc
r819 r961 25 25 // 26 26 // 27 // $Id: G4LowEnergyPolarizedCompton.cc,v 1.2 2 2006/06/29 19:40:25 gunterExp $28 // GEANT4 tag $Name: $27 // $Id: G4LowEnergyPolarizedCompton.cc,v 1.25 2008/05/02 19:23:38 pia Exp $ 28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // ------------------------------------------------------------ … … 110 110 rangeTest = new G4RangeTest; 111 111 112 // For Doppler broadening 113 shellData.SetOccupancyData(); 114 115 112 116 if (verboseLevel > 0) 113 117 { … … 139 143 delete meanFreePathTable; 140 144 meanFreePathTable = crossSectionHandler->BuildMeanFreePathForMaterials(); 145 146 // For Doppler broadening 147 G4String file = "/doppler/shell-doppler"; 148 shellData.LoadData(file); 149 141 150 } 142 151 … … 327 336 G4double dirz = cosTheta ; 328 337 338 339 // oneCosT , eom 340 341 342 343 // Doppler broadening - Method based on: 344 // Y. Namito, S. Ban and H. Hirayama, 345 // "Implementation of the Doppler Broadening of a Compton-Scattered Photon Into the EGS4 Code" 346 // NIM A 349, pp. 489-494, 1994 347 348 // Maximum number of sampling iterations 349 350 G4int maxDopplerIterations = 1000; 351 G4double bindingE = 0.; 352 G4double photonEoriginal = epsilon * gammaEnergy0; 353 G4double photonE = -1.; 354 G4int iteration = 0; 355 G4double eMax = gammaEnergy0; 356 357 do 358 { 359 iteration++; 360 // Select shell based on shell occupancy 361 G4int shell = shellData.SelectRandomShell(Z); 362 bindingE = shellData.BindingEnergy(Z,shell); 363 364 eMax = gammaEnergy0 - bindingE; 365 366 // Randomly sample bound electron momentum (memento: the data set is in Atomic Units) 367 G4double pSample = profileData.RandomSelectMomentum(Z,shell); 368 // Rescale from atomic units 369 G4double pDoppler = pSample * fine_structure_const; 370 G4double pDoppler2 = pDoppler * pDoppler; 371 G4double var2 = 1. + onecost * E0_m; 372 G4double var3 = var2*var2 - pDoppler2; 373 G4double var4 = var2 - pDoppler2 * cosTheta; 374 G4double var = var4*var4 - var3 + pDoppler2 * var3; 375 if (var > 0.) 376 { 377 G4double varSqrt = std::sqrt(var); 378 G4double scale = gammaEnergy0 / var3; 379 // Random select either root 380 if (G4UniformRand() < 0.5) photonE = (var4 - varSqrt) * scale; 381 else photonE = (var4 + varSqrt) * scale; 382 } 383 else 384 { 385 photonE = -1.; 386 } 387 } while ( iteration <= maxDopplerIterations && 388 (photonE < 0. || photonE > eMax || photonE < eMax*G4UniformRand()) ); 389 390 // End of recalculation of photon energy with Doppler broadening 391 // Revert to original if maximum number of iterations threshold has been reached 392 if (iteration >= maxDopplerIterations) 393 { 394 photonE = photonEoriginal; 395 bindingE = 0.; 396 } 397 398 gammaEnergy1 = photonE; 399 400 // G4cout << "--> PHOTONENERGY1 = " << photonE/keV << G4endl; 401 402 403 /// Doppler Broadeing 404 405 406 407 329 408 // 330 409 // update G4VParticleChange for the scattered photon 331 410 // 332 411 333 gammaEnergy1 = epsilon*gammaEnergy0; 412 // gammaEnergy1 = epsilon*gammaEnergy0; 413 334 414 335 415 // New polarization … … 365 445 // 366 446 367 G4double ElecKineEnergy = gammaEnergy0 - gammaEnergy1 ; 447 G4double ElecKineEnergy = gammaEnergy0 - gammaEnergy1 -bindingE; 448 368 449 369 450 // Generate the electron only if with large enough range w.r.t. cuts and safety 370 451 371 452 G4double safety = aStep.GetPostStepPoint()->GetSafety(); 453 372 454 373 455 if (rangeTest->Escape(G4Electron::Electron(),couple,ElecKineEnergy,safety)) … … 379 461 aParticleChange.SetNumberOfSecondaries(1); 380 462 aParticleChange.AddSecondary(electron); 381 aParticleChange.ProposeLocalEnergyDeposit(0.); 463 // aParticleChange.ProposeLocalEnergyDeposit(0.); 464 aParticleChange.ProposeLocalEnergyDeposit(bindingE); 382 465 } 383 466 else 384 467 { 385 468 aParticleChange.SetNumberOfSecondaries(0); 386 aParticleChange.ProposeLocalEnergyDeposit(ElecKineEnergy );469 aParticleChange.ProposeLocalEnergyDeposit(ElecKineEnergy+bindingE); 387 470 } 388 471 … … 492 575 // G4double sinsqrphi = sinPhi*sinPhi; 493 576 G4double normalisation = std::sqrt(1. - cosSqrPhi*sinSqrTh); 494 577 495 578 496 579 // Determination of Theta 497 580 498 G4double thetaProbability; 581 // ---- MGP ---- Commented out the following 3 lines to avoid compilation 582 // warnings (unused variables) 583 // G4double thetaProbability; 499 584 G4double theta; 500 G4double a, b; 501 G4double cosTheta; 502 585 // G4double a, b; 586 // G4double cosTheta; 587 588 /* 589 590 depaola method 591 503 592 do 504 {593 { 505 594 rand1 = G4UniformRand(); 506 595 rand2 = G4UniformRand(); … … 515 604 516 605 G4double cosBeta = cosTheta; 606 607 */ 608 609 610 // Dan Xu method (IEEE TNS, 52, 1160 (2005)) 611 612 rand1 = G4UniformRand(); 613 rand2 = G4UniformRand(); 614 615 if (rand1<(epsilon+1.0/epsilon-2)/(2.0*(epsilon+1.0/epsilon)-4.0*sinSqrTh*cosSqrPhi)) 616 { 617 if (rand2<0.5) 618 theta = pi/2.0; 619 else 620 theta = 3.0*pi/2.0; 621 } 622 else 623 { 624 if (rand2<0.5) 625 theta = 0; 626 else 627 theta = pi; 628 } 629 G4double cosBeta = std::cos(theta); 517 630 G4double sinBeta = std::sqrt(1-cosBeta*cosBeta); 518 631 -
trunk/source/processes/electromagnetic/lowenergy/src/G4LowEnergyPolarizedRayleigh.cc
r819 r961 25 25 // 26 26 // $Id: G4LowEnergyPolarizedRayleigh.cc,v 1.7 2006/06/29 19:40:27 gunter Exp $ 27 // GEANT4 tag $Name: $27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // -------------------------------------------------------------- -
trunk/source/processes/electromagnetic/lowenergy/src/G4LowEnergyRayleigh.cc
r819 r961 27 27 // 28 28 // $Id: G4LowEnergyRayleigh.cc,v 1.37 2006/06/29 19:40:29 gunter Exp $ 29 // GEANT4 tag $Name: $29 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 30 30 // 31 31 // Author: A. Forti -
trunk/source/processes/electromagnetic/lowenergy/src/G4PenelopeBremsstrahlung.cc
r819 r961 25 25 // 26 26 // $Id: G4PenelopeBremsstrahlung.cc,v 1.18 2006/06/29 19:40:35 gunter Exp $ 27 // GEANT4 tag $Name: $27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // -------------------------------------------------------------- -
trunk/source/processes/electromagnetic/lowenergy/src/G4PenelopeBremsstrahlungAngular.cc
r819 r961 25 25 // 26 26 // $Id: G4PenelopeBremsstrahlungAngular.cc,v 1.7 2006/06/29 19:40:37 gunter Exp $ 27 // GEANT4 tag $Name: $27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // -------------------------------------------------------------- -
trunk/source/processes/electromagnetic/lowenergy/src/G4PenelopeBremsstrahlungContinuous.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4PenelopeBremsstrahlungContinuous.cc,v 1. 9 2006/06/29 19:40:39 gunterExp $27 // GEANT4 tag $Name: $26 // $Id: G4PenelopeBremsstrahlungContinuous.cc,v 1.11 2008/12/15 09:23:06 pandola Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // -------------------------------------------------------------- … … 40 40 // 19 Mar 2003 L. Pandola Bugs fixed 41 41 // 17 Mar 2004 L. Pandola Removed unnecessary calls to std::pow(a,b) 42 // 09 Dec 2008 L. Pandola Update ReadFile() in a way to make explicit use of the units of 43 // measurement. Also some cosmetics to improve readibility. 42 44 //---------------------------------------------------------------- 43 45 … … 51 53 #include <sstream> 52 54 53 G4PenelopeBremsstrahlungContinuous::G4PenelopeBremsstrahlungContinuous (G4int Zed,G4double taglio,G4double e1, 55 G4PenelopeBremsstrahlungContinuous::G4PenelopeBremsstrahlungContinuous (G4int Zed,G4double cut, 56 G4double e1, 54 57 G4double e2, 55 58 const G4String name) : 56 Zmat(Zed),tCut( taglio),MinE(e1),MaxE(e2),partName(name)59 Zmat(Zed),tCut(cut),MinE(e1),MaxE(e2),partName(name) 57 60 { 58 61 //Construct extended energy table … … 71 74 } 72 75 76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 73 77 74 78 G4PenelopeBremsstrahlungContinuous::~G4PenelopeBremsstrahlungContinuous() 75 { 76 } 79 {;} 80 81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 77 82 78 83 void G4PenelopeBremsstrahlungContinuous::LoadFromFile() … … 92 97 G4String dirFile = pathString + "/penelope/" + name; 93 98 std::ifstream file(dirFile); 94 std::filebuf* lsdp = file.rdbuf(); 95 if (!(lsdp->is_open())) 99 if (!file.is_open()) 96 100 { 97 101 G4String excep = "G4PenelopeBremsstrahlungContinuous - data file " + name + " not found!"; 98 102 G4Exception(excep); 99 103 } 100 G4double a1; 101 for (size_t i=0;i<NumberofEPoints;i++){ 102 file >> a1; 103 Energies[i]=a1; 104 for (size_t j=0;j<NumberofKPoints;j++){ 104 G4double a1 = -1.; 105 for (size_t i=0;i<NumberofEPoints;i++) 106 { 105 107 file >> a1; 106 ReducedCS[i][j]=a1/millibarn; //coversion present in Penelope source 108 //1) reads energy in MeV 109 Energies[i]=a1*MeV; 110 //2) read 32 cross sections in cm2 111 for (size_t j=0;j<NumberofKPoints;j++){ 112 file >> a1; 113 ReducedCS[i][j]=a1*cm2; 114 } 115 //3) read the total cross section, in cm2 116 file >> a1; 117 TotalCS[i]=a1*cm2; 118 // Check closing item 119 file >> a1; 120 if (a1 != ((G4double) -1)) 121 { 122 G4String excep = "G4PenelopeBremsstrahlungContinuous - Check the bremms data file " 123 + name; 124 G4Exception(excep); 125 } 107 126 } 108 file >> a1;109 TotalCS[i]=a1/millibarn; //conversion present in Penelope source110 file >> a1;111 if (a1 != ((G4double) -1)){112 G4String excep = "G4PenelopeBremsstrahlungContinuous - Check the bremms data file "+ name;113 G4Exception(excep);114 }115 }116 117 127 file.close(); 118 128 } 129 130 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 119 131 120 132 void G4PenelopeBremsstrahlungContinuous::PrepareInterpolationTable() … … 138 150 139 151 delete interpolator; 140 G4double Fact = ( millibarn/cm2)*(Energies[i]+electron_mass_c2)*(1.0/fine_structure_const)/152 G4double Fact = (Energies[i]+electron_mass_c2)*(1.0/fine_structure_const)*millibarn/ 141 153 (classic_electr_radius*classic_electr_radius*(Energies[i]+2.0*electron_mass_c2)); 142 154 G4double Normalization = TotalCS[i]/(Rsum*Fact); 143 G4double TST = std::abs(Normalization-1 00.0);155 G4double TST = std::abs(Normalization-1.0); 144 156 if (TST > 1.0) { 145 157 G4String excep = "G4PenelopeBremsstrahlungContinuous - Check the bremms data file"; … … 181 193 } 182 194 183 //Forse questa roba (e Pbcut come membro privato) non serve 184 // G4double PDF[NumberofKPoints]; 185 186 // for (i=0;i<NumberofExtendedEGrid;i++){ 187 // for (j=0;j<NumberofKPoints;j++){ 188 // PDF[j]=p0[i][j]; 189 // } 190 // G4double Xc=0; 191 // if (i<(NumberofExtendedEGrid-1)){ 192 // Xc=tCut/std::exp(ExtendedLogEnergy[i+1]); 193 // } 194 // else 195 // { 196 // Xc=tCut/std::exp(ExtendedLogEnergy[NumberofExtendedEGrid-1]); 197 // } 195 //All this stuff might be useful later on 196 /* 197 G4double PDF[NumberofKPoints]; 198 199 for (i=0;i<NumberofExtendedEGrid;i++){ 200 for (j=0;j<NumberofKPoints;j++){ 201 PDF[j]=p0[i][j]; 202 } 203 G4double Xc=0; 204 if (i<(NumberofExtendedEGrid-1)){ 205 Xc=tCut/std::exp(ExtendedLogEnergy[i+1]); 206 } 207 else 208 { 209 Xc=tCut/std::exp(ExtendedLogEnergy[NumberofExtendedEGrid-1]); 210 } 198 211 199 // G4PenelopeInterpolator* interpolator3 = new G4PenelopeInterpolator(pK,PDF,NumberofKPoints); 200 // Pbcut[i]=interpolator3->CalculateMomentum(Xc,-1); 201 // delete interpolator3; 202 // } 203 204 } 212 G4PenelopeInterpolator* interpolator3 = new G4PenelopeInterpolator(pK,PDF,NumberofKPoints); 213 Pbcut[i]=interpolator3->CalculateMomentum(Xc,-1); 214 delete interpolator3; 215 } 216 */ 217 218 } 219 220 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 205 221 206 G4double G4PenelopeBremsstrahlungContinuous::CalculateStopping(G4double e 1)222 G4double G4PenelopeBremsstrahlungContinuous::CalculateStopping(G4double energy) 207 223 //Stopping power expressed in MeV/mm*2 208 224 { 209 G4double Xel=std::max(std::log(e 1),ExtendedLogEnergy[0]);225 G4double Xel=std::max(std::log(energy),ExtendedLogEnergy[0]); 210 226 G4double Xe=1.0+(Xel-ExtendedLogEnergy[0])*DLFC; 211 227 G4int Ke = (G4int) Xe; … … 213 229 214 230 //Global x-section factor 215 G4double Fact=Zmat*Zmat*(e 1+electron_mass_c2)*(e1+electron_mass_c2)/(e1*(e1+2.0*electron_mass_c2))216 *(millibarn/cm2);217 Fact =Fact*PositronCorrection(e1);231 G4double Fact=Zmat*Zmat*(energy+electron_mass_c2)*(energy+electron_mass_c2)/ 232 (energy*(energy+2.0*electron_mass_c2)); 233 Fact *= PositronCorrection(energy); 218 234 219 235 //Moments of the scaled bremss x-section 220 G4double wcre = tCut/e 1;236 G4double wcre = tCut/energy; 221 237 G4double pY[NumberofKPoints]; 222 238 G4double pK[NumberofKPoints] = {1.0e-12,0.05,0.075,0.1,0.125,0.15,0.2,0.25, … … 230 246 G4PenelopeInterpolator* interpolator1 = new G4PenelopeInterpolator(pK,pY,NumberofKPoints); 231 247 G4double XS1A = interpolator1->CalculateMomentum(wcre,0); 232 G4double XS2A = interpolator1->CalculateMomentum(wcre,1);233 delete interpolator1;234 248 for (size_t k=0;k<NumberofKPoints;k++){ 235 249 pY[k] = p0[std::min(Ke+1,(G4int) NumberofExtendedEGrid-1)][k]; … … 237 251 G4PenelopeInterpolator* interpolator2 = new G4PenelopeInterpolator (pK,pY,NumberofKPoints); 238 252 G4double XS1B = interpolator2->CalculateMomentum(wcre,0); 239 G4double XS2B = interpolator2->CalculateMomentum(wcre,1); 253 254 G4double XS1 = ((1.0-Xek)*XS1A+Xek*XS1B)*Fact*energy; //weighted mean between the energy bin of the grid 255 256 //This is the 2nd momentum (straggling cross section). It might be useful later on 257 /* 258 G4double XS2A = interpolator1->CalculateMomentum(wcre,1); 259 G4double XS2 = ((1.0-Xek)*XS2A+Xek*XS2B)*Fact*energy*energy; 260 G4double XS2B = interpolator2->CalculateMomentum(wcre,1); 261 */ 262 263 delete interpolator1; 240 264 delete interpolator2; 241 242 G4double XS1 = ((1.0-Xek)*XS1A+Xek*XS1B)*Fact*e1; //weighted mean between the energy bin of the grid 243 G4double XS2 = ((1.0-Xek)*XS2A+Xek*XS2B)*Fact*e1*e1; //straggling cross section (2nd momentum); 244 //Il secondo momento XS2 potrebbe tornare utile in seguito 245 246 //XS1 is given in MeV*cm2, as in Penelope, but it must be converted in MeV*mm2 247 XS1=XS1*cm2/mm2; 248 //XS2 is given in MeV2*cm2, as in Penelope, but it must be converted in MeV2*mm2 249 XS2=XS2*cm2/mm2; 250 251 //Deve includere anche le famose correzioni per tenere conto 252 //che la sezione d'urto varia sullo step! 253 //Il valore che tira fuori va nella tabella e non viene piu' modificato 265 254 266 return XS1; 255 267 } 256 268 257 G4double G4PenelopeBremsstrahlungContinuous::PositronCorrection(G4double en) 269 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 270 271 G4double G4PenelopeBremsstrahlungContinuous::PositronCorrection(G4double energy) 258 272 { 259 273 const G4double Coeff[7]={-1.2359e-01,6.1274e-2,-3.1516e-2,7.7446e-3,-1.0595e-3, 260 274 7.0568e-5,-1.8080e-6}; 261 G4double T=0;262 275 G4double correct=0; 263 276 if (partName == "e-") { … … 265 278 } 266 279 else if (partName == "e+"){ 267 T=std::log(1+((1e6*en)/(Zmat*Zmat*electron_mass_c2)));280 G4double T=std::log(1+((1e6*energy)/(Zmat*Zmat*electron_mass_c2))); 268 281 for (G4int i=0;i<7;i++){ 269 282 correct += Coeff[i]*std::pow(T,i+1); … … 272 285 return correct; 273 286 } 274 else //ne ' elettroni ne' positroni...exception287 else //neither electrons nor positrons...exception 275 288 { 276 289 G4String excep = "G4PenelopeBremmstrahlungContinuous: the particle is not e- nor e+!"; -
trunk/source/processes/electromagnetic/lowenergy/src/G4PenelopeCompton.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4PenelopeCompton.cc,v 1. 26 2006/06/29 19:40:41 gunterExp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4PenelopeCompton.cc,v 1.33 2008/06/03 15:44:25 pandola Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // Author: Luciano Pandola … … 45 45 // 17 Mar 2004 L.Pandola Removed unnecessary calls to std::pow(a,b) 46 46 // 18 Mar 2004 L.Pandola Use of std::map (code review) 47 // 26 Mar 2008 L.Pandola Add boolean flag to control atomic de-excitation 48 // 27 Mar 2008 L.Pandola Re-named some variables to improve readability, 49 // and check for strict energy conservation 50 // 03 Jun 2008 L.Pandola Added further protection against non-conservation 51 // of energy: it may happen because ionization energy 52 // from de-excitation manager and from Penelope internal 53 // database do not match (difference is <10 eV, but may 54 // give a e- with negative kinetic energy). 47 55 // 48 56 // ------------------------------------------------------------------- … … 86 94 ZForIntegration(1), 87 95 nBins(200), 88 cutForLowEnergySecondaryPhotons(250.0*eV) 96 cutForLowEnergySecondaryPhotons(250.0*eV), 97 fUseAtomicDeexcitation(true) 89 98 { 90 99 if (lowEnergyLimit < intrinsicLowEnergyLimit || … … 118 127 delete rangeTest; 119 128 120 for (size_t i 1=0;i1<matCrossSections->size();i1++)121 { 122 delete (*matCrossSections)[i 1];129 for (size_t i=0;i<matCrossSections->size();i++) 130 { 131 delete (*matCrossSections)[i]; 123 132 } 124 133 … … 140 149 G4DataVector energyVector; 141 150 G4double dBin = std::log10(highEnergyLimit/lowEnergyLimit)/nBins; 142 G4int i; 143 for (i=0;i<nBins;i++) 151 for (G4int i=0;i<nBins;i++) 144 152 { 145 153 energyVector.push_back(std::pow(10.,std::log10(lowEnergyLimit)+i*dBin)); … … 150 158 G4VDataSetAlgorithm* algo = new G4LogLogInterpolation(); 151 159 152 size_t nOfBins = energyVector.size();153 size_t bin=0;160 //size_t nOfBins = energyVector.size(); 161 //size_t bin=0; 154 162 155 163 G4DataVector* energies; … … 158 166 matCrossSections = new std::vector<G4VEMDataSet*>; 159 167 160 161 G4int m; 162 for (m=0; m<nMaterials; m++) 168 for (G4int m=0; m<nMaterials; m++) 163 169 { 164 170 const G4Material* material= (*materialTable)[m]; … … 169 175 G4VEMDataSet* setForMat = new G4CompositeEMDataSet(algo,1.,1.); 170 176 171 for ( i=0; i<nElements; i++) {177 for (G4int i=0; i<nElements; i++) { 172 178 173 179 G4int Z = (G4int) (*elementVector)[i]->GetZ(); … … 178 184 179 185 180 for ( bin=0; bin<nOfBins; bin++)186 for (size_t bin=0; bin<energyVector.size(); bin++) 181 187 { 182 188 G4double e = energyVector[bin]; … … 200 206 201 207 202 for ( m=0; m<nMaterials; m++)208 for (G4int m=0; m<nMaterials; m++) 203 209 { 204 210 energies = new G4DataVector; … … 206 212 const G4Material* material= (*materialTable)[m]; 207 213 material= (*materialTable)[m]; 208 for ( bin=0; bin<nOfBins; bin++)214 for (size_t bin=0; bin<energyVector.size(); bin++) 209 215 { 210 216 G4double energy = energyVector[bin]; … … 254 260 const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple(); 255 261 const G4Material* material = couple->GetMaterial(); 262 256 263 G4int Z = SelectRandomAtomForCompton(material,photonEnergy0); 257 264 const G4int nmax = 64; … … 274 281 a1 = std::log(ki2); 275 282 a2 = a1+2.0*ki*(1.0+ki)/(ki2*ki2); 283 //If the incoming photon is above 5 MeV, the quicker approach based on the 284 //pure Klein-Nishina formula is used 276 285 if (photonEnergy0 > 5*MeV) 277 286 { … … 305 314 }while((epsilon*photonEnergy0-photonEnergy0+ionEnergy) >0); 306 315 } 307 308 316 else //photonEnergy0<5 MeV 309 317 { … … 359 367 if (pzomc > 0) 360 368 { 361 rn[i] = 1.0-0.5*std::exp(0.5-(std::sqrt(0.5)+std::sqrt(2.0)*pzomc)*(std::sqrt(0.5)+std::sqrt(2.0)*pzomc)); 369 rn[i] = 1.0-0.5*std::exp(0.5-(std::sqrt(0.5)+std::sqrt(2.0)*pzomc)* 370 (std::sqrt(0.5)+std::sqrt(2.0)*pzomc)); 362 371 } 363 372 else 364 373 { 365 rn[i] = 0.5*std::exp(0.5-(std::sqrt(0.5)-std::sqrt(2.0)*pzomc)*(std::sqrt(0.5)-std::sqrt(2.0)*pzomc)); 374 rn[i] = 0.5*std::exp(0.5-(std::sqrt(0.5)-std::sqrt(2.0)*pzomc)* 375 (std::sqrt(0.5)-std::sqrt(2.0)*pzomc)); 366 376 } 367 377 S = S + occupNb*rn[i]; … … 431 441 } 432 442 433 434 443 G4double sinTheta = std::sqrt(1-cosTheta*cosTheta); 435 444 G4double phi = twopi * G4UniformRand() ; … … 456 465 457 466 458 // Kinematics of the scattered electron 459 460 467 // Kinematics of the scattered electron 461 468 G4double diffEnergy = photonEnergy0*(1-epsilon); 462 469 ionEnergy = (*(ionizationEnergy->find(Z)->second))[iosc]; 463 //G4double eKineticEnergy = diffEnergy - ionEnergy;464 470 G4double Q2 = photonEnergy0*photonEnergy0+photonEnergy1*(photonEnergy1-2.0*photonEnergy0*cosTheta); 465 471 G4double cosThetaE; //scattering angle for the electron … … 473 479 } 474 480 G4double sinThetaE = std::sqrt(1-cosThetaE*cosThetaE); 475 476 477 481 //initialize here, then check photons created by Atomic-Deexcitation, and the final state e- 482 G4int nbOfSecondaries = 0; 483 484 std::vector<G4DynamicParticle*>* photonVector=0; 485 478 486 const G4AtomicTransitionManager* transitionManager = G4AtomicTransitionManager::Instance(); 479 487 const G4AtomicShell* shell = transitionManager->Shell(Z,iosc); 480 488 G4double bindingEnergy = shell->BindingEnergy(); 481 489 G4int shellId = shell->ShellId(); 482 //G4cout << bindingEnergy/keV << " " << ionEnergy/keV << " keV" << G4endl; 483 ionEnergy = std::max(bindingEnergy,ionEnergy); //protection against energy non-conservation 484 G4double eKineticEnergy = diffEnergy - ionEnergy; 485 486 size_t nTotPhotons=0; 487 G4int nPhotons=0; 488 489 const G4ProductionCutsTable* theCoupleTable= 490 G4ProductionCutsTable::GetProductionCutsTable(); 491 size_t indx = couple->GetIndex(); 492 G4double cutg = (*(theCoupleTable->GetEnergyCutsVector(0)))[indx]; 493 cutg = std::min(cutForLowEnergySecondaryPhotons,cutg); 494 495 G4double cute = (*(theCoupleTable->GetEnergyCutsVector(1)))[indx]; 496 cute = std::min(cutForLowEnergySecondaryPhotons,cute); 497 498 std::vector<G4DynamicParticle*>* photonVector=0; 499 G4DynamicParticle* aPhoton; 500 G4AtomicDeexcitation deexcitationManager; 501 502 if (Z>5 && (ionEnergy > cutg || ionEnergy > cute)) 503 { 504 photonVector = deexcitationManager.GenerateParticles(Z,shellId); 505 nTotPhotons = photonVector->size(); 506 for (size_t k=0;k<nTotPhotons;k++){ 507 aPhoton = (*photonVector)[k]; 508 if (aPhoton) 509 { 510 G4double itsCut = cutg; 511 if (aPhoton->GetDefinition() == G4Electron::Electron()) itsCut = cute; 512 G4double itsEnergy = aPhoton->GetKineticEnergy(); 513 if (itsEnergy > itsCut && itsEnergy <= ionEnergy) 490 G4double ionEnergyInPenelopeDatabase = ionEnergy; 491 ionEnergy = std::max(bindingEnergy,ionEnergyInPenelopeDatabase); //protection against energy non-conservation 492 493 G4double eKineticEnergy = diffEnergy - ionEnergy; //subtract the excitation energy. If not emitted by fluorescence, 494 //the ionization energy is deposited as local energy deposition 495 G4double localEnergyDeposit = ionEnergy; 496 G4double energyInFluorescence = 0.; //testing purposes only 497 498 if (eKineticEnergy < 0) 499 { 500 //It means that there was some problem/mismatch between the two databases. Try to make it work 501 //In this case available Energy (diffEnergy) < ionEnergy 502 //Full residual energy is deposited locally 503 localEnergyDeposit = diffEnergy; 504 eKineticEnergy = 0.0; 505 } 506 507 //the local energy deposit is what remains: part of this may be spent for fluorescence. 508 509 if (fUseAtomicDeexcitation) 510 { 511 G4int nPhotons=0; 512 513 const G4ProductionCutsTable* theCoupleTable= 514 G4ProductionCutsTable::GetProductionCutsTable(); 515 size_t indx = couple->GetIndex(); 516 517 G4double cutg = (*(theCoupleTable->GetEnergyCutsVector(0)))[indx]; 518 cutg = std::max(cutForLowEnergySecondaryPhotons,cutg); 519 520 G4double cute = (*(theCoupleTable->GetEnergyCutsVector(1)))[indx]; 521 cute = std::max(cutForLowEnergySecondaryPhotons,cute); 522 523 G4DynamicParticle* aPhoton; 524 G4AtomicDeexcitation deexcitationManager; 525 526 if (Z>5 && (localEnergyDeposit > cutg || localEnergyDeposit > cute)) 527 { 528 photonVector = deexcitationManager.GenerateParticles(Z,shellId); 529 for (size_t k=0;k<photonVector->size();k++){ 530 aPhoton = (*photonVector)[k]; 531 if (aPhoton) 514 532 { 515 nPhotons++; 516 ionEnergy -= itsEnergy; 517 } 518 else 519 { 520 delete aPhoton; 521 (*photonVector)[k]=0; 533 G4double itsCut = cutg; 534 if (aPhoton->GetDefinition() == G4Electron::Electron()) itsCut = cute; 535 G4double itsEnergy = aPhoton->GetKineticEnergy(); 536 if (itsEnergy > itsCut && itsEnergy <= localEnergyDeposit) 537 { 538 nPhotons++; 539 localEnergyDeposit -= itsEnergy; 540 energyInFluorescence += itsEnergy; 541 } 542 else 543 { 544 delete aPhoton; 545 (*photonVector)[k]=0; 546 } 522 547 } 523 548 } 524 }525 }526 G4double energyDeposit =ionEnergy; //il deposito locale e' quello che rimane527 G4int nbOfSecondaries=nPhotons; 528 549 } 550 nbOfSecondaries=nPhotons; 551 } 552 553 529 554 // Generate the electron only if with large enough range w.r.t. cuts and safety 530 555 G4double safety = aStep.GetPostStepPoint()->GetSafety(); 531 556 G4DynamicParticle* electron = 0; 532 if (rangeTest->Escape(G4Electron::Electron(),couple,eKineticEnergy,safety)) 557 if (rangeTest->Escape(G4Electron::Electron(),couple,eKineticEnergy,safety) && 558 eKineticEnergy>cutForLowEnergySecondaryPhotons) 533 559 { 534 560 G4double xEl = sinThetaE * std::cos(phi+pi); … … 543 569 else 544 570 { 545 546 energyDeposit += eKineticEnergy; 571 localEnergyDeposit += eKineticEnergy; 547 572 } 548 573 549 574 aParticleChange.SetNumberOfSecondaries(nbOfSecondaries); 550 575 if (electron) aParticleChange.AddSecondary(electron); 551 for (size_t ll=0;ll<nTotPhotons;ll++) 552 { 553 aPhoton = (*photonVector)[ll]; 554 if (aPhoton) aParticleChange.AddSecondary(aPhoton); 576 577 //This block below is executed only if there is at least one secondary photon produced by 578 //AtomicDeexcitation 579 if (photonVector) 580 { 581 for (size_t ll=0;ll<photonVector->size();ll++) 582 { 583 if ((*photonVector)[ll]) aParticleChange.AddSecondary((*photonVector)[ll]); 584 } 555 585 } 556 586 delete photonVector; 557 if ( energyDeposit < 0)587 if (localEnergyDeposit < 0) 558 588 { 559 589 G4cout << "WARNING-" 560 590 << "G4PenelopeCompton::PostStepDoIt - Negative energy deposit" 561 591 << G4endl; 562 energyDeposit=0; 563 } 564 aParticleChange.ProposeLocalEnergyDeposit(energyDeposit); 565 592 localEnergyDeposit=0.; 593 } 594 aParticleChange.ProposeLocalEnergyDeposit(localEnergyDeposit); 595 596 597 if (verboseLevel > 1) 598 { 599 G4cout << "-----------------------------------------------------------" << G4endl; 600 G4cout << "Energy balance from G4PenelopeCompton" << G4endl; 601 G4cout << "Incoming photon energy: " << photonEnergy0/keV << " keV" << G4endl; 602 G4cout << "-----------------------------------------------------------" << G4endl; 603 G4cout << "Scattered photon: " << photonEnergy1/keV << " keV" << G4endl; 604 G4double electronEnergy = 0.; 605 if (electron) 606 electronEnergy = eKineticEnergy; 607 G4cout << "Scattered electron " << electronEnergy/keV << " keV" << G4endl; 608 G4cout << "Fluorescence: " << energyInFluorescence/keV << " keV" << G4endl; 609 G4cout << "Local energy deposit " << localEnergyDeposit/keV << " keV" << G4endl; 610 G4cout << "Total final state: " << (photonEnergy1+electronEnergy+energyInFluorescence+localEnergyDeposit)/keV << 611 " keV" << G4endl; 612 G4cout << "-----------------------------------------------------------" << G4endl; 613 } 566 614 567 615 return G4VDiscreteProcess::PostStepDoIt( aTrack, aStep); -
trunk/source/processes/electromagnetic/lowenergy/src/G4PenelopeIonisation.cc
r819 r961 25 25 // 26 26 // $Id: G4PenelopeIonisation.cc,v 1.19 2006/06/29 19:40:49 gunter Exp $ 27 // GEANT4 tag $Name: $27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // -------------------------------------------------------------- -
trunk/source/processes/electromagnetic/lowenergy/src/G4PenelopePhotoElectric.cc
r819 r961 25 25 // 26 26 // 27 // $Id: G4PenelopePhotoElectric.cc,v 1.1 2 2006/06/29 19:40:51 gunterExp $28 // GEANT4 tag $Name: $27 // $Id: G4PenelopePhotoElectric.cc,v 1.13 2009/01/08 09:42:54 pandola Exp $ 28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Author: L. Pandola … … 37 37 // 31 May 2005 L. Pandola Added Sauter formula for the sampling of 38 38 // the electron direction 39 // 08 Jan 2009 L. Pandola Check shell index to avoid mismatch between 40 // the Penelope cross section database and the 41 // G4AtomicTransitionManager database. It suppresses 42 // a warning from G4AtomicTransitionManager only. 43 // Results are unchanged. 39 44 // -------------------------------------------------------------- 40 45 … … 146 151 // Retrieve the corresponding identifier and binding energy of the selected shell 147 152 const G4AtomicTransitionManager* transitionManager = G4AtomicTransitionManager::Instance(); 153 154 //The number of shell cross section possibly reported in the Penelope database 155 //might be different from the number of shells in the G4AtomicTransitionManager 156 //(namely, Penelope may contain more shell, especially for very light elements). 157 //In order to avoid a warning message from the G4AtomicTransitionManager, I 158 //add this protection. Results are anyway changed, because when G4AtomicTransitionManager 159 //has a shellID>maxID, it sets the shellID to the last valid shell. 160 size_t numberOfShells = (size_t) transitionManager->NumberOfShells(Z); 161 if (shellIndex >= numberOfShells) 162 shellIndex = numberOfShells-1; 163 148 164 const G4AtomicShell* shell = transitionManager->Shell(Z,shellIndex); 149 165 G4double bindingEnergy = shell->BindingEnergy(); -
trunk/source/processes/electromagnetic/lowenergy/src/G4PenelopeRayleigh.cc
r819 r961 27 27 // 28 28 // $Id: G4PenelopeRayleigh.cc,v 1.15 2007/09/03 09:43:14 pandola Exp $ 29 // GEANT4 tag $Name: $29 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 30 30 // 31 31 // Author: L. Pandola (luciano.pandola@cern.ch) -
trunk/source/processes/electromagnetic/lowenergy/src/G4RangeTest.cc
r819 r961 26 26 // 27 27 // $Id: G4RangeTest.cc,v 1.8 2006/06/29 19:41:03 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) -
trunk/source/processes/electromagnetic/lowenergy/src/G4SemiLogInterpolation.cc
r819 r961 26 26 // 27 27 // $Id: G4SemiLogInterpolation.cc,v 1.6 2006/06/29 19:41:18 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) -
trunk/source/processes/electromagnetic/lowenergy/src/G4ShellData.cc
r819 r961 25 25 // 26 26 // 27 // $Id: G4ShellData.cc,v 1. 8 2006/06/29 19:41:21 gunterExp $28 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $27 // $Id: G4ShellData.cc,v 1.10 2008/03/17 13:40:53 pia Exp $ 28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) … … 38 38 #include "G4ShellData.hh" 39 39 #include "G4DataVector.hh" 40 #include "G4SystemOfUnits.hh" 40 41 #include <fstream> 41 42 #include <sstream> 43 #include <numeric> 44 #include <algorithm> 45 #include <valarray> 46 #include <functional> 47 #include "Randomize.hh" 48 49 // The following deprecated header is included because <functional> seems not to be found on MGP's laptop 50 //#include "function.h" 42 51 43 52 // Constructor 44 53 45 G4ShellData::G4ShellData(G4int minZ, G4int maxZ )46 : zMin(minZ), zMax(maxZ) 47 { }54 G4ShellData::G4ShellData(G4int minZ, G4int maxZ, G4bool isOccupancy) 55 : zMin(minZ), zMax(maxZ), occupancyData(isOccupancy) 56 { } 48 57 49 58 // Destructor 50 59 G4ShellData::~G4ShellData() 51 60 { 52 std::map<G4int,G4DataVector*,std::less<G4int> >::iterator pos; 53 61 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::iterator pos; 54 62 for (pos = idMap.begin(); pos != idMap.end(); ++pos) 55 63 { 56 G4DataVector* dataSet = (*pos).second;64 std::vector<G4double>* dataSet = (*pos).second; 57 65 delete dataSet; 58 66 } 59 for (pos = bindingMap.begin(); pos != bindingMap.end(); ++pos) 60 { 61 G4DataVector* dataSet = (*pos).second; 67 68 std::map<G4int,G4DataVector*,std::less<G4int> >::iterator pos2; 69 for (pos2 = bindingMap.begin(); pos2 != bindingMap.end(); ++pos2) 70 { 71 G4DataVector* dataSet = (*pos2).second; 62 72 delete dataSet; 73 } 74 75 if (occupancyData) 76 { 77 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::iterator pos3; 78 for (pos3 = occupancyPdfMap.begin(); pos3 != occupancyPdfMap.end(); ++pos3) 79 { 80 std::vector<G4double>* dataSet = (*pos3).second; 81 delete dataSet; 82 } 63 83 } 64 84 } … … 78 98 79 99 80 const G4DataVector& G4ShellData::ShellIdVector(G4int Z) const 81 { 82 std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator pos; 83 if (Z < zMin || Z > zMax) 84 G4Exception("G4ShellData::ShellIdVector - Z outside boundaries"); 100 const std::vector<G4double>& G4ShellData::ShellIdVector(G4int Z) const 101 { 102 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator pos; 103 if (Z < zMin || Z > zMax) G4Exception("G4ShellData::ShellIdVector - Z outside boundaries"); 85 104 pos = idMap.find(Z); 86 G4DataVector* dataSet = (*pos).second;105 std::vector<G4double>* dataSet = (*pos).second; 87 106 return *dataSet; 88 107 } 89 108 109 110 const std::vector<G4double>& G4ShellData::ShellVector(G4int Z) const 111 { 112 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator pos; 113 if (Z < zMin || Z > zMax) G4Exception("G4ShellData::ShellVector - Z outside boundaries"); 114 pos = occupancyPdfMap.find(Z); 115 std::vector<G4double>* dataSet = (*pos).second; 116 return *dataSet; 117 } 118 119 90 120 G4int G4ShellData::ShellId(G4int Z, G4int shellIndex) const 91 121 { … … 94 124 if (Z >= zMin && Z <= zMax) 95 125 { 96 std::map<G4int, G4DataVector*,std::less<G4int> >::const_iterator pos;126 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator pos; 97 127 pos = idMap.find(Z); 98 128 if (pos!= idMap.end()) 99 129 { 100 G4DataVectordataSet = *((*pos).second);130 std::vector<G4double> dataSet = *((*pos).second); 101 131 G4int nData = dataSet.size(); 102 132 if (shellIndex >= 0 && shellIndex < nData) … … 108 138 return n; 109 139 } 140 141 142 G4double G4ShellData::ShellOccupancyProbability(G4int Z, G4int shellIndex) const 143 { 144 G4double prob = -1.; 145 146 if (Z >= zMin && Z <= zMax) 147 { 148 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator pos; 149 pos = idMap.find(Z); 150 if (pos!= idMap.end()) 151 { 152 std::vector<G4double> dataSet = *((*pos).second); 153 G4int nData = dataSet.size(); 154 if (shellIndex >= 0 && shellIndex < nData) 155 { 156 prob = dataSet[shellIndex]; 157 } 158 } 159 } 160 return prob; 161 } 162 110 163 111 164 … … 140 193 << G4endl; 141 194 G4int nSh = nShells[Z-1]; 142 std::map<G4int, G4DataVector*,std::less<G4int> >::const_iterator posId;195 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator posId; 143 196 posId = idMap.find(Z); 144 G4DataVector* ids = (*posId).second;197 std::vector<G4double>* ids = (*posId).second; 145 198 std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator posE; 146 199 posE = bindingMap.find(Z); … … 149 202 { 150 203 G4int id = (G4int) (*ids)[i]; 151 G4double e = (*energies)[i] / MeV; 152 G4cout << i <<") Shell id: " << id 153 << " - Binding energy = " 154 << e << " MeV " << G4endl; 204 G4double e = (*energies)[i] / keV; 205 G4cout << i << ") "; 206 207 if (occupancyData) 208 { 209 G4cout << " Occupancy: "; 210 } 211 else 212 { 213 G4cout << " Shell id: "; 214 } 215 G4cout << id << " - Binding energy = " 216 << e << " keV "; 217 if (occupancyData) 218 { 219 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator posOcc; 220 posOcc = occupancyPdfMap.find(Z); 221 std::vector<G4double> probs = *((*posOcc).second); 222 G4double prob = probs[i]; 223 G4cout << "- Probability = " << prob; 224 } 225 G4cout << G4endl; 155 226 } 156 227 G4cout << "-------------------------------------------------" … … 196 267 G4int Z = 1; 197 268 G4DataVector* energies = new G4DataVector; 198 G4DataVector* ids = new G4DataVector;269 std::vector<G4double>* ids = new std::vector<G4double>; 199 270 200 271 do { … … 211 282 nShells.push_back(n); 212 283 // Start of new shell data set 213 ids = new G4DataVector;284 ids = new std::vector<G4double>; 214 285 energies = new G4DataVector; 215 286 Z++; … … 246 317 } while (a != -2); // end of file 247 318 file.close(); 248 } 249 319 320 // For Doppler broadening: the data set contains shell occupancy and binding energy for each shell 321 // Build additional map with probability for each shell based on its occupancy 322 323 if (occupancyData) 324 { 325 // Build cumulative from raw shell occupancy 326 327 for (G4int Z=zMin; Z <= zMax; Z++) 328 { 329 std::vector<G4double> occupancy = ShellIdVector(Z); 330 331 std::vector<G4double>* prob = new std::vector<G4double>; 332 G4double scale = 1. / G4double(Z); 333 334 prob->push_back(occupancy[0] * scale); 335 for (size_t i=1; i<occupancy.size(); i++) 336 { 337 prob->push_back(occupancy[i]*scale + (*prob)[i-1]); 338 } 339 occupancyPdfMap[Z] = prob; 340 341 /* 342 G4double scale = 1. / G4double(Z); 343 // transform((*prob).begin(),(*prob).end(),(*prob).begin(),bind2nd(multiplies<G4double>(),scale)); 344 345 for (size_t i=0; i<occupancy.size(); i++) 346 { 347 (*prob)[i] *= scale; 348 } 349 */ 350 } 351 } 352 } 353 354 355 G4int G4ShellData::SelectRandomShell(G4int Z) const 356 { 357 if (Z < zMin || Z > zMax) G4Exception("G4ShellData::RandomSelect - Z outside boundaries"); 358 359 G4int shellIndex = 0; 360 std::vector<G4double> prob = ShellVector(Z); 361 G4double random = G4UniformRand(); 362 363 // std::vector<G4double>::const_iterator pos; 364 // pos = lower_bound(prob.begin(),prob.end(),random); 365 366 // Binary search the shell with probability less or equal random 367 368 G4int nShells = NumberOfShells(Z); 369 G4int upperBound = nShells; 370 371 while (shellIndex <= upperBound) 372 { 373 G4int midShell = (shellIndex + upperBound) / 2; 374 if ( random < prob[midShell] ) 375 upperBound = midShell - 1; 376 else 377 shellIndex = midShell + 1; 378 } 379 if (shellIndex >= nShells) shellIndex = nShells - 1; 380 381 return shellIndex; 382 } -
trunk/source/processes/electromagnetic/lowenergy/src/G4ShellEMDataSet.cc
r819 r961 25 25 // 26 26 // 27 // $Id: G4ShellEMDataSet.cc,v 1.1 5 2007/10/15 08:36:35pia Exp $28 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $27 // $Id: G4ShellEMDataSet.cc,v 1.16 2008/03/10 15:07:41 pia Exp $ 28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) … … 32 32 // History: 33 33 // ----------- 34 // 1 Aug 2001 MGP Created34 // 1 Aug 2001 MGP Created 35 35 // 09.10.01 V.Ivanchenko Add case z=0 36 // 9 Mar 2008 MGP Cleaned up unreadable code modified by former developer 37 // (Further clean-up needed) 36 38 // 37 39 // ------------------------------------------------------------------- … … 44 46 45 47 46 G4ShellEMDataSet::G4ShellEMDataSet(G4int argZ, G4VDataSetAlgorithm* argAlgorithm,47 G4double argUnitEnergies,48 G4double argUnitData)48 G4ShellEMDataSet::G4ShellEMDataSet(G4int zeta, G4VDataSetAlgorithm* algo, 49 G4double eUnit, 50 G4double dataUnit) 49 51 : 50 z(argZ), 51 algorithm(argAlgorithm), 52 unitEnergies(argUnitEnergies), 53 unitData(argUnitData) 54 { 55 if (algorithm == 0) 56 G4Exception("G4ShellEMDataSet::G4ShellEMDataSet - interpolation == 0"); 52 z(zeta), 53 algorithm(algo), 54 unitEnergies(eUnit), 55 unitData(dataUnit) 56 { 57 if (algorithm == 0) G4Exception("G4ShellEMDataSet::G4ShellEMDataSet - interpolation == 0"); 57 58 } 58 59 … … 61 62 { 62 63 CleanUpComponents(); 63 64 if (algorithm) 65 delete algorithm; 66 } 67 68 69 G4double G4ShellEMDataSet::FindValue(G4double argEnergy, G4int /* argComponentId */) const 64 if (algorithm) delete algorithm; 65 } 66 67 68 G4double G4ShellEMDataSet::FindValue(G4double energy, G4int /* componentId */) const 70 69 { 71 70 // Returns the sum over the shells corresponding to e … … 75 74 std::vector<G4VEMDataSet *>::const_iterator end(components.end()); 76 75 77 while (i !=end)78 { 79 value +=(*i)->FindValue(argEnergy);76 while (i != end) 77 { 78 value += (*i)->FindValue(energy); 80 79 i++; 81 80 } … … 87 86 void G4ShellEMDataSet::PrintData(void) const 88 87 { 89 const size_t n (NumberOfComponents());88 const size_t n = NumberOfComponents(); 90 89 91 90 G4cout << "The data set has " << n << " components" << G4endl; 92 91 G4cout << G4endl; 93 92 94 size_t i (0);95 96 while (i <n)93 size_t i = 0; 94 95 while (i < n) 97 96 { 98 97 G4cout << "--- Component " << i << " ---" << G4endl; … … 103 102 104 103 105 void G4ShellEMDataSet :: SetEnergiesData(G4DataVector* argEnergies,106 G4DataVector* argData,107 G4int argComponentId)108 { 109 G4VEMDataSet * component(components[argComponentId]);104 void G4ShellEMDataSet::SetEnergiesData(G4DataVector* energies, 105 G4DataVector* data, 106 G4int componentId) 107 { 108 G4VEMDataSet* component = components[componentId]; 110 109 111 110 if (component) 112 111 { 113 component->SetEnergiesData( argEnergies, argData, 0);112 component->SetEnergiesData(energies, data, 0); 114 113 return; 115 114 } 116 115 117 116 std::ostringstream message; 118 message << "G4ShellEMDataSet::SetEnergiesData - component " << argComponentId << " not found";117 message << "G4ShellEMDataSet::SetEnergiesData - component " << componentId << " not found"; 119 118 120 119 G4Exception(message.str().c_str()); … … 122 121 123 122 124 G4bool G4ShellEMDataSet::LoadData(const G4String& argFileName)123 G4bool G4ShellEMDataSet::LoadData(const G4String& file) 125 124 { 126 125 CleanUpComponents(); 127 126 128 G4String fullFileName (FullFileName(argFileName));127 G4String fullFileName = FullFileName(file); 129 128 std::ifstream in(fullFileName); 130 129 … … 132 131 { 133 132 G4String message("G4ShellEMDataSet::LoadData - data file \""); 134 message +=fullFileName;135 message +="\" not found";133 message += fullFileName; 134 message += "\" not found"; 136 135 G4Exception(message); 137 136 } 138 137 139 G4DataVector* argEnergies(0);140 G4DataVector* argData(0);141 142 G4double a ;143 G4int shellIndex (0);144 bool energyColumn (true);138 G4DataVector* energies = 0; 139 G4DataVector* data = 0; 140 141 G4double a = 0.; 142 G4int shellIndex = 0; 143 bool energyColumn = true; 145 144 146 145 do … … 150 149 if (a == -1) 151 150 { 152 if (energyColumn && argEnergies!=0)151 if (energyColumn && energies!=0) 153 152 { 154 AddComponent(new G4EMDataSet(shellIndex, argEnergies, argData, algorithm->Clone(), unitEnergies, unitData));155 argEnergies=0;156 argData=0;153 AddComponent(new G4EMDataSet(shellIndex, energies, data, algorithm->Clone(), unitEnergies, unitData)); 154 energies = 0; 155 data = 0; 157 156 } 158 157 159 energyColumn =(!energyColumn);158 energyColumn = (!energyColumn); 160 159 } 161 else if (a !=-2)160 else if (a != -2) 162 161 { 163 if ( argEnergies==0)162 if (energies == 0) 164 163 { 165 argEnergies=new G4DataVector;166 argData=new G4DataVector;164 energies = new G4DataVector; 165 data = new G4DataVector; 167 166 } 168 167 169 168 if (energyColumn) 170 argEnergies->push_back(a*unitEnergies);169 energies->push_back(a * unitEnergies); 171 170 else 172 argData->push_back(a*unitData);173 174 energyColumn =(!energyColumn);171 data->push_back(a * unitData); 172 173 energyColumn = (!energyColumn); 175 174 } 176 175 } … … 181 180 182 181 183 G4bool G4ShellEMDataSet::SaveData(const G4String& argFileName) const184 { 185 G4String fullFileName (FullFileName(argFileName));182 G4bool G4ShellEMDataSet::SaveData(const G4String& file) const 183 { 184 G4String fullFileName = FullFileName(file); 186 185 std::ofstream out(fullFileName); 187 186 … … 189 188 { 190 189 G4String message("G4EMDataSet::SaveData - cannot open \""); 191 message +=fullFileName;192 message +="\"";190 message += fullFileName; 191 message += "\""; 193 192 G4Exception(message); 194 193 } 195 194 196 const size_t n (NumberOfComponents());197 size_t k (0);198 199 while (k <n)200 { 201 const G4VEMDataSet * component=GetComponent(k);195 const size_t n = NumberOfComponents(); 196 size_t k = 0; 197 198 while (k < n) 199 { 200 const G4VEMDataSet* component = GetComponent(k); 202 201 203 202 if (component) 204 203 { 205 const G4DataVector & energies(component->GetEnergies(0));206 const G4DataVector & data(component->GetData(0));207 208 G4DataVector::const_iterator i (energies.begin());209 G4DataVector::const_iterator endI (energies.end());210 G4DataVector::const_iterator j (data.begin());211 212 while (i !=endI)204 const G4DataVector& energies = component->GetEnergies(0); 205 const G4DataVector& data = component->GetData(0); 206 207 G4DataVector::const_iterator i = energies.begin(); 208 G4DataVector::const_iterator endI = energies.end(); 209 G4DataVector::const_iterator j = data.begin(); 210 211 while (i != endI) 213 212 { 214 213 out.precision(10); … … 253 252 254 253 255 256 257 258 254 void G4ShellEMDataSet::CleanUpComponents(void) 259 255 { 260 256 while (!components.empty()) 261 257 { 262 if (components.back()) 263 delete components.back(); 264 258 if (components.back()) delete components.back(); 265 259 components.pop_back(); 266 260 } … … 268 262 269 263 270 271 272 273 G4String G4ShellEMDataSet::FullFileName(const G4String & argFileName) const 264 G4String G4ShellEMDataSet::FullFileName(const G4String& fileName) const 274 265 { 275 266 char* path = getenv("G4LEDATA"); … … 279 270 std::ostringstream fullFileName; 280 271 281 fullFileName << path << '/' << argFileName << z << ".dat";272 fullFileName << path << '/' << fileName << z << ".dat"; 282 273 283 274 return G4String(fullFileName.str().c_str()); -
trunk/source/processes/electromagnetic/lowenergy/src/G4VCrossSectionHandler.cc
r819 r961 26 26 // 27 27 // $Id: G4VCrossSectionHandler.cc,v 1.17 2006/06/29 19:41:42 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) -
trunk/source/processes/electromagnetic/lowenergy/src/G4VLowEnergyDiscretePhotonProcess.cc
r819 r961 25 25 // 26 26 // $Id: G4VLowEnergyDiscretePhotonProcess.cc,v 1.5 2006/06/29 19:41:44 gunter Exp $ 27 // GEANT4 tag $Name: $27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // -------------------------------------------------------------- -
trunk/source/processes/electromagnetic/lowenergy/src/G4VeLowEnergyLoss.cc
r819 r961 26 26 // 27 27 // $Id: G4VeLowEnergyLoss.cc,v 1.25 2006/06/29 19:41:50 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // -
trunk/source/processes/electromagnetic/lowenergy/src/G4WaterExcitationStructure.cc
r819 r961 26 26 // 27 27 // $Id: G4WaterExcitationStructure.cc,v 1.1 2007/10/15 08:57:54 pia Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) -
trunk/source/processes/electromagnetic/lowenergy/src/G4WaterIonisationStructure.cc
r819 r961 26 26 // 27 27 // $Id: G4WaterIonisationStructure.cc,v 1.1 2007/11/08 20:39:35 pia Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) -
trunk/source/processes/electromagnetic/lowenergy/src/G4eBremsstrahlungSpectrum.cc
r819 r961 25 25 // 26 26 // $Id: G4eBremsstrahlungSpectrum.cc,v 1.15 2006/06/29 19:41:58 gunter Exp $ 27 // GEANT4 tag $Name: $27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- -
trunk/source/processes/electromagnetic/lowenergy/src/G4eCrossSectionExcitationEmfietzoglou.cc
r819 r961 26 26 // 27 27 // $Id: G4eCrossSectionExcitationEmfietzoglou.cc,v 1.1 2007/05/04 10:16:06 pia Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 31 31 // $Id: G4eCrossSectionExcitationEmfietzoglou.cc,v 1.1 2007/05/04 10:16:06 pia Exp $ 32 // GEANT4 tag $Name: $32 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 33 33 // 34 34 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) -
trunk/source/processes/electromagnetic/lowenergy/src/G4eCrossSectionScreenedRutherford.cc
r819 r961 26 26 // 27 27 // $Id: G4eCrossSectionScreenedRutherford.cc,v 1.3 2007/10/12 12:27:19 pia Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) -
trunk/source/processes/electromagnetic/lowenergy/src/G4eIonisationCrossSectionHandler.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4eIonisationCrossSectionHandler.cc,v 1.1 1 2006/06/29 19:42:00 gunterExp $27 // GEANT4 tag $Name: $26 // $Id: G4eIonisationCrossSectionHandler.cc,v 1.12 2009/01/29 08:13:34 pandola Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 42 42 // 19 Jul 2002 VI Create composite data set for material 43 43 // 21 Jan 2003 V.Ivanchenko Cut per region 44 // 28 Jan 2009 L.Pandola Added public method to make a easier migration of 45 // G4LowEnergyIonisation to G4LivermoreIonisationModel 44 46 // 45 47 // ------------------------------------------------------------------- … … 98 100 G4int nElements = material->GetNumberOfElements(); 99 101 100 if(verbose > 0) { 101 G4cout << "eIonisation CS for " << m << "th material " 102 << material->GetName() 103 << " eEl= " << nElements << G4endl; 104 } 102 if(verbose > 0) 103 { 104 G4cout << "eIonisation CS for " << m << "th material " 105 << material->GetName() 106 << " eEl= " << nElements << G4endl; 107 } 105 108 106 109 G4double tcut = (*energyCuts)[m]; … … 129 132 value += cross * p * density; 130 133 131 if(verbose>0 && m == 0 && e>=1. && e<=0.) { 134 if(verbose>0 && m == 0 && e>=1. && e<=0.) 135 { 132 136 G4cout << "G4eIonCrossSH: e(MeV)= " << e/MeV 133 137 << " n= " << n … … 139 143 << " Z= " << Z 140 144 << G4endl; 141 }145 } 142 146 143 147 } … … 155 159 } 156 160 157 161 G4double G4eIonisationCrossSectionHandler::GetCrossSectionAboveThresholdForElement(G4double energy, 162 G4double cutEnergy, 163 G4int Z) 164 { 165 G4int nShells = NumberOfComponents(Z); 166 G4double value = 0.; 167 if(energy > cutEnergy) 168 { 169 for (G4int n=0; n<nShells; n++) { 170 G4double cross = FindValue(Z, energy, n); 171 G4double p = theParam->Probability(Z, cutEnergy, energy, energy, n); 172 value += cross * p; 173 } 174 } 175 return value; 176 } -
trunk/source/processes/electromagnetic/lowenergy/src/G4eIonisationParameters.cc
r819 r961 26 26 // 27 27 // $Id: G4eIonisationParameters.cc,v 1.23 2006/06/29 19:42:02 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) -
trunk/source/processes/electromagnetic/lowenergy/src/G4eIonisationSpectrum.cc
r819 r961 25 25 // 26 26 // $Id: G4eIonisationSpectrum.cc,v 1.25 2006/06/29 19:42:04 gunter Exp $ 27 // GEANT4 tag $Name: $27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- -
trunk/source/processes/electromagnetic/lowenergy/src/G4eLowEnergyLoss.cc
r819 r961 26 26 // 27 27 // $Id: G4eLowEnergyLoss.cc,v 1.35 2006/06/29 19:42:06 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // ----------------------------------------------------------- -
trunk/source/processes/electromagnetic/lowenergy/src/G4hLowEnergyIonisation.cc
r819 r961 1501 1501 type = aSecondary->GetDefinition(); 1502 1502 if ( etot + e <= eLoss && 1503 ( type == G4Gamma::Gamma() && e > minGammaEnergy ) ||1504 (type == G4Electron::Electron() && e > minElectronEnergy) ) {1503 ( (type == G4Gamma::Gamma() && e > minGammaEnergy ) || 1504 (type == G4Electron::Electron() && e > minElectronEnergy) ) ) { 1505 1505 1506 1506 etot += e; -
trunk/source/processes/electromagnetic/lowenergy/src/G4hLowEnergyLoss.cc
r819 r961 25 25 // 26 26 // 27 // $Id: G4hLowEnergyLoss.cc,v 1.2 3 2006/06/29 19:42:23 gunterExp $28 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $27 // $Id: G4hLowEnergyLoss.cc,v 1.28 2009/02/20 10:49:54 sincerti Exp $ 28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // ----------------------------------------------------------- … … 145 145 G4double G4hLowEnergyLoss::HighestKineticEnergy= 100.*GeV; 146 146 G4int G4hLowEnergyLoss::TotBin = 360; 147 G4double G4hLowEnergyLoss::RTable,G4hLowEnergyLoss::LOGRTable; 147 G4double G4hLowEnergyLoss::RTable =1.1; 148 G4double G4hLowEnergyLoss::LOGRTable = 1.1; 148 149 149 150 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... … … 772 773 theRangeTable = theRangepbarTable ; 773 774 } 774 775 775 G4double R2 = RTable*RTable ; 776 776 G4double R1 = RTable+1.; … … 796 796 else 797 797 { 798 Tim = Ti/RTable ; 798 // ---- MGP ---- Modified to avoid a floating point exception 799 // The correction is just a temporary patch, the whole class should be redesigned 800 // Original: Tim = Ti/RTable results in 0./0. 801 if (RTable != 0.) 802 { 803 Tim = Ti/RTable ; 804 } 805 else 806 { 807 Tim = 0.; 808 } 799 809 Rim = rangeVector->GetValue(Tim,isOut); 800 810 } … … 806 816 Rip = rangeVector->GetValue(Tip,isOut); 807 817 } 808 Value = (w1*Rip + w2*Ri + w3*Rim)/(Ti*Ti);818 if (Ti!=0) Value = (w1*Rip + w2*Ri + w3*Rim)/(Ti*Ti); else Value=0; 809 819 810 820 aVector->PutValue(i,Value); … … 868 878 else 869 879 { 870 Tim = Ti/RTable;880 if (RTable!=0) Tim = Ti/RTable ; else Tim =0; 871 881 Rim = rangeVector->GetValue(Tim,isOut); 872 882 } … … 878 888 Rip = rangeVector->GetValue(Tip,isOut); 879 889 } 880 Value = (w1*Rip + w2*Ri + w3*Rim)/Ti;890 if (Ti!=0) Value = (w1*Rip + w2*Ri + w3*Rim)/Ti; else Value=0; 881 891 882 892 aVector->PutValue(i,Value); … … 939 949 else 940 950 { 941 Tim = Ti/RTable;951 if (RTable!=0) Tim = Ti/RTable ; else Tim=0; 942 952 Rim = rangeVector->GetValue(Tim,isOut); 943 953 } … … 1052 1062 { 1053 1063 G4double LowEdgeRange,A,B,C,discr,KineticEnergy ; 1054 G4double Tbin = LowestKineticEnergy/RTable ; 1064 G4double Tbin = 0; 1065 if (RTable !=0.) Tbin = LowestKineticEnergy/RTable ; 1055 1066 G4double rangebin = 0.0 ; 1056 1067 G4int binnumber = -1 ; -
trunk/source/processes/electromagnetic/lowenergy/src/G4hShellCrossSectionDoubleExp.cc
r819 r961 41 41 // Empiric Model for shell cross sections in proton ionisation 42 42 // ------------------------------------------------------------------- 43 // $Id: G4hShellCrossSectionDoubleExp.cc,v 1. 8 2006/06/29 19:42:35 gunterExp $44 // GEANT4 tag $Name: $43 // $Id: G4hShellCrossSectionDoubleExp.cc,v 1.9 2008/06/26 18:19:10 sincerti Exp $ 44 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 45 45 46 46 #include "globals.hh" … … 187 187 188 188 std::vector<G4double> kProbability;//(0); 189 kProbability.push_back(GetCrossSectionDoubleExp(Z,incidentEnergy)/atomTotalCrossSection); 190 // ---- MGP ---- Next line corrected to kProbability[0] instead of [1], which is not initialized! 191 kProbability.push_back(1 - kProbability[0]); 189 190 191 if (atomTotalCrossSection!=0.) // SI - 26 june 2008 192 193 { 194 kProbability.push_back(GetCrossSectionDoubleExp(Z,incidentEnergy)/atomTotalCrossSection); 195 // ---- MGP ---- Next line corrected to kProbability[0] instead of [1], which is not initialized! 196 kProbability.push_back(1 - kProbability[0]); 197 } 192 198 193 199 return kProbability; -
trunk/source/processes/electromagnetic/lowenergy/src/G4hShellCrossSectionDoubleExpData.cc
r819 r961 34 34 // ------------------------------------------------------------------- 35 35 // $Id: G4hShellCrossSectionDoubleExpData.cc,v 1.4 2006/06/29 19:42:38 gunter Exp $ 36 // GEANT4 tag $Name: $36 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 37 37 38 38 #include "G4hShellCrossSectionDoubleExpData.hh" -
trunk/source/processes/electromagnetic/lowenergy/src/G4hShellCrossSectionExp.cc
r819 r961 41 41 // Empiric Model for shell cross sections in proton ionisation 42 42 // ------------------------------------------------------------------- 43 // $Id: G4hShellCrossSectionExp.cc,v 1. 5 2006/06/29 19:42:40 gunterExp $44 // GEANT4 tag $Name: $43 // $Id: G4hShellCrossSectionExp.cc,v 1.6 2008/05/02 19:23:38 pia Exp $ 44 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 45 45 46 46 #include "globals.hh" … … 104 104 crossSectionsInBarn = a*(std::pow(b,(1./incidentEnergyInMeV)))*(std::pow(incidentEnergyInMeV,c)); 105 105 } 106 else if( Z<66 && Z>=26|| Z==17)106 else if((Z<66 && Z>=26) || Z==17) 107 107 { 108 108 crossSectionsInBarn = std::exp(a+(b/incidentEnergyInMeV)+(c*std::log(incidentEnergyInMeV))); -
trunk/source/processes/electromagnetic/lowenergy/src/G4hShellCrossSectionExpData.cc
r819 r961 34 34 // ------------------------------------------------------------------- 35 35 // $Id: G4hShellCrossSectionExpData.cc,v 1.3 2006/06/29 19:42:42 gunter Exp $ 36 // GEANT4 tag $Name: $36 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 37 37 38 38 #include "G4hShellCrossSectionExpData.hh"
Note:
See TracChangeset
for help on using the changeset viewer.
