Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // 23 // 27 // ------------------------------------------- 24 // ------------------------------------------------------------------- 28 // GEANT4 Class file 25 // GEANT4 Class file 29 // 26 // 30 // For information related to this code c 27 // For information related to this code contact: 31 // 28 // 32 // File name: G4XnpTotalLowE 29 // File name: G4XnpTotalLowE 33 // 30 // 34 // Author: 31 // Author: 35 // 32 // 36 // Creation date: 15 April 1999 33 // Creation date: 15 April 1999 37 // 34 // 38 // Modifications: 35 // Modifications: 39 // 36 // 40 // Neutron-Proton total cross section 37 // Neutron-Proton total cross section 41 // Linear interpolation from data table 38 // Linear interpolation from data table 42 // 39 // 43 // ------------------------------------------- 40 // ------------------------------------------------------------------- 44 41 45 #include "globals.hh" 42 #include "globals.hh" 46 #include "G4ios.hh" 43 #include "G4ios.hh" 47 #include "G4Exp.hh" << 48 #include "G4Log.hh" << 49 #include "G4SystemOfUnits.hh" << 50 #include "G4XnpTotalLowE.hh" 44 #include "G4XnpTotalLowE.hh" 51 #include "G4KineticTrack.hh" 45 #include "G4KineticTrack.hh" 52 #include "G4ParticleDefinition.hh" 46 #include "G4ParticleDefinition.hh" 53 #include "G4PhysicsVector.hh" 47 #include "G4PhysicsVector.hh" 54 #include "G4PhysicsLogVector.hh" << 48 #include "G4PhysicsLnVector.hh" >> 49 #include "G4ParticleDefinition.hh" 55 #include "G4Proton.hh" 50 #include "G4Proton.hh" 56 #include "G4Neutron.hh" 51 #include "G4Neutron.hh" 57 52 58 const G4double G4XnpTotalLowE::_lowLimit = 0.; 53 const G4double G4XnpTotalLowE::_lowLimit = 0.; 59 const G4double G4XnpTotalLowE::_highLimit = 3. 54 const G4double G4XnpTotalLowE::_highLimit = 3.*GeV; 60 55 61 // Low energy limit of the cross-section table 56 // Low energy limit of the cross-section table (in GeV) 62 // Units are assigned when filling the Physics << 57 // Units are assigned while filling the PhysicsVector 63 const G4double G4XnpTotalLowE::_eMinTable = 1. 58 const G4double G4XnpTotalLowE::_eMinTable = 1.8964808; 64 const G4double G4XnpTotalLowE::_eStepLog = 0.0 59 const G4double G4XnpTotalLowE::_eStepLog = 0.01; 65 60 66 // Cross-sections in mb 61 // Cross-sections in mb 67 // Units are assigned when filling the Physics << 62 // Units are assigned while filling the PhysicsVector 68 const G4int G4XnpTotalLowE::_tableSize = 101; 63 const G4int G4XnpTotalLowE::_tableSize = 101; 69 const G4double G4XnpTotalLowE::_sigmaTable[101 64 const G4double G4XnpTotalLowE::_sigmaTable[101] = 70 { 65 { 71 1500.0, 66 1500.0, 72 248.20, 93.38, 55.26, 44.50, 41.33, 38.48, 3 67 248.20, 93.38, 55.26, 44.50, 41.33, 38.48, 37.20, 35.98, 73 35.02, 34.47, 34.37, 34.67, 35.23, 35.97, 36 68 35.02, 34.47, 34.37, 34.67, 35.23, 35.97, 36.75, 37.37, 74 37.77, 38.03, 38.40, 38.83, 39.26, 39.67, 40 69 37.77, 38.03, 38.40, 38.83, 39.26, 39.67, 40.06, 40.45, 75 40.79, 41.06, 41.31, 41.52, 41.70, 41.81, 41 70 40.79, 41.06, 41.31, 41.52, 41.70, 41.81, 41.87, 41.98, 76 42.12, 42.29, 42.55, 42.82, 43.01, 43.12, 43 71 42.12, 42.29, 42.55, 42.82, 43.01, 43.12, 43.16, 43.14, 77 43.06, 42.95, 42.81, 42.67, 42.54, 42.45, 42 72 43.06, 42.95, 42.81, 42.67, 42.54, 42.45, 42.38, 42.33, 78 42.30, 42.29, 42.28, 42.26, 42.24, 42.21, 42 73 42.30, 42.29, 42.28, 42.26, 42.24, 42.21, 42.17, 42.14, 79 42.10, 42.07, 42.06, 42.05, 42.04, 42.03, 42 74 42.10, 42.07, 42.06, 42.05, 42.04, 42.03, 42.02, 42.00, 80 41.97, 41.94, 41.89, 41.84, 41.79, 41.73, 41 75 41.97, 41.94, 41.89, 41.84, 41.79, 41.73, 41.67, 41.61, 81 41.55, 41.49, 41.44, 41.38, 41.34, 41.31, 41 76 41.55, 41.49, 41.44, 41.38, 41.34, 41.31, 41.29, 41.28, 82 41.27, 41.28, 41.30, 41.33, 41.36, 41.40, 41 77 41.27, 41.28, 41.30, 41.33, 41.36, 41.40, 41.44, 41.49, 83 41.50, 41.51, 41.51, 41.51, 41.52, 41.51, 41 78 41.50, 41.51, 41.51, 41.51, 41.52, 41.51, 41.51, 41.50, 84 41.50, 41.49, 41.47, 41.46 79 41.50, 41.49, 41.47, 41.46 85 }; 80 }; 86 81 87 82 88 G4XnpTotalLowE::G4XnpTotalLowE() 83 G4XnpTotalLowE::G4XnpTotalLowE() 89 { 84 { 90 // Cross-sections are available in the range 85 // Cross-sections are available in the range (_eMin,_eMax) 91 86 92 _eMin = _eMinTable * GeV; 87 _eMin = _eMinTable * GeV; 93 _eMin = G4Exp(G4Log(_eMinTable)-_eStepLog)*G << 88 _eMin = std::exp(std::log(_eMinTable)-_eStepLog)*GeV; 94 _eMax = G4Exp(G4Log(_eMinTable) + _tableSize << 89 _eMax = std::exp(std::log(_eMinTable) + _tableSize * _eStepLog) * GeV; 95 90 96 // Protections: validity limits must be comp 91 // Protections: validity limits must be compatible with available data 97 // @@GF this ought to be _lowLimit < _eMin << 92 98 if (_eMin < _lowLimit) 93 if (_eMin < _lowLimit) 99 throw G4HadronicException(__FILE__, __LINE 94 throw G4HadronicException(__FILE__, __LINE__, "G4XnpTotalLowE::G4XnpTotalLowE - Low energy limit not valid"); 100 95 101 if (_highLimit > _eMax) 96 if (_highLimit > _eMax) 102 throw G4HadronicException(__FILE__, __LINE 97 throw G4HadronicException(__FILE__, __LINE__, "G4XnpTotalLowE::G4XnpTotalLowE - High energy limit not valid"); 103 98 104 _sigma = new G4PhysicsLogVector(_eMin,_eMax, << 99 _sigma = new G4PhysicsLnVector(_eMin,_eMax,_tableSize); 105 G4int i; 100 G4int i; 106 for (i=0; i<_tableSize; i++) 101 for (i=0; i<_tableSize; i++) 107 { 102 { 108 G4double value = _sigmaTable[i] * millib 103 G4double value = _sigmaTable[i] * millibarn; 109 _sigma->PutValue(i,value); 104 _sigma->PutValue(i,value); 110 } 105 } 111 } 106 } 112 107 113 108 114 G4XnpTotalLowE::~G4XnpTotalLowE() 109 G4XnpTotalLowE::~G4XnpTotalLowE() 115 { 110 { 116 if (_sigma) delete _sigma; << 111 delete _sigma; 117 _sigma=0; << 118 } 112 } 119 113 120 114 121 G4bool G4XnpTotalLowE::operator==(const G4XnpT 115 G4bool G4XnpTotalLowE::operator==(const G4XnpTotalLowE &right) const 122 { 116 { 123 return (this == (G4XnpTotalLowE *) &right); 117 return (this == (G4XnpTotalLowE *) &right); 124 } 118 } 125 119 126 120 127 G4bool G4XnpTotalLowE::operator!=(const G4XnpT 121 G4bool G4XnpTotalLowE::operator!=(const G4XnpTotalLowE &right) const 128 { 122 { 129 return (this != (G4XnpTotalLowE *) &right); 123 return (this != (G4XnpTotalLowE *) &right); 130 } 124 } 131 125 132 126 133 G4double G4XnpTotalLowE::CrossSection(const G4 127 G4double G4XnpTotalLowE::CrossSection(const G4KineticTrack& trk1, const G4KineticTrack& trk2) const 134 { 128 { 135 G4double sigma = 0.; 129 G4double sigma = 0.; 136 G4double sqrtS = (trk1.Get4Momentum() + trk2 130 G4double sqrtS = (trk1.Get4Momentum() + trk2.Get4Momentum()).mag(); 137 G4bool dummy = false; 131 G4bool dummy = false; 138 132 139 const G4ParticleDefinition* proton = G4Proto << 133 G4ParticleDefinition* proton = G4Proton::ProtonDefinition(); 140 const G4ParticleDefinition* neutron = G4Neut << 134 G4ParticleDefinition* neutron = G4Neutron::NeutronDefinition(); 141 135 142 const G4ParticleDefinition* def1 = trk1.GetD << 136 G4ParticleDefinition* def1 = trk1.GetDefinition(); 143 const G4ParticleDefinition* def2 = trk2.GetD << 137 G4ParticleDefinition* def2 = trk2.GetDefinition(); 144 if ( (def1 == proton && def2 == neutron) || 138 if ( (def1 == proton && def2 == neutron) || 145 (def1 == neutron && def2 == proton) ) 139 (def1 == neutron && def2 == proton) ) 146 { 140 { 147 if (sqrtS >= _eMin && sqrtS <= _eMax) 141 if (sqrtS >= _eMin && sqrtS <= _eMax) 148 { 142 { 149 sigma = _sigma->GetValue(sqrtS,dummy); 143 sigma = _sigma->GetValue(sqrtS,dummy); 150 } else if ( sqrtS < _eMin ) 144 } else if ( sqrtS < _eMin ) 151 { 145 { 152 sigma = _sigma->GetValue(_eMin,dummy 146 sigma = _sigma->GetValue(_eMin,dummy); 153 } 147 } 154 } 148 } 155 149 156 return sigma; 150 return sigma; 157 } 151 } 158 152 159 void G4XnpTotalLowE::Print() const 153 void G4XnpTotalLowE::Print() const 160 { 154 { 161 // Dump the cross-section table 155 // Dump the cross-section table 162 156 163 G4cout << Name() << "Cross-section table: " 157 G4cout << Name() << "Cross-section table: " << G4endl; 164 G4bool dummy = false; 158 G4bool dummy = false; 165 G4int i; 159 G4int i; 166 160 167 for (i=0; i<_tableSize; i++) 161 for (i=0; i<_tableSize; i++) 168 { 162 { 169 G4double e = _sigma->GetLowEdgeEnergy(i) 163 G4double e = _sigma->GetLowEdgeEnergy(i) / GeV; 170 G4double sigma = _sigma->GetValue(e,dumm 164 G4double sigma = _sigma->GetValue(e,dummy) / millibarn; 171 G4cout << i << ") e = " << e << " GeV -- 165 G4cout << i << ") e = " << e << " GeV ---- Cross section = " << sigma << " mb " << G4endl; 172 } 166 } 173 167 174 G4VCrossSectionSource::Print(); 168 G4VCrossSectionSource::Print(); 175 } 169 } 176 170 177 171 178 G4String G4XnpTotalLowE::Name() const 172 G4String G4XnpTotalLowE::Name() const 179 { 173 { 180 G4String name("NNTotalLowE"); 174 G4String name("NNTotalLowE"); 181 return name; 175 return name; 182 } 176 } 183 177 184 178 185 G4bool G4XnpTotalLowE::IsValid(G4double e) con 179 G4bool G4XnpTotalLowE::IsValid(G4double e) const 186 { 180 { 187 G4bool answer = InLimits(e,_lowLimit,_highLi 181 G4bool answer = InLimits(e,_lowLimit,_highLimit); 188 182 189 return answer; 183 return answer; 190 } 184 } 191 185 192 186 193 187