00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "G4PiData.hh"
00032 #include "G4SystemOfUnits.hh"
00033 #include "G4HadronicException.hh"
00034
00036
00037 G4PiData::G4PiData(const G4double * aT, const G4double * aIn,
00038 const G4double * anE, G4int nP)
00039 {
00040 G4int i=0;
00041
00042 for( i = 0; i < nP; i++ )
00043 {
00044 std::pair<G4double, G4double> x;
00045 x.first=aT[i]*millibarn;
00046 x.second=aIn[i]*millibarn;
00047 std::pair<G4double, std::pair<G4double, G4double > > aP;
00048 aP.first=anE[i]*GeV;
00049 aP.second=x;
00050 push_back(aP);
00051 }
00052 }
00053
00055
00056 G4bool G4PiData::AppliesTo(G4double kineticEnergy)
00057 {
00058 G4bool result = true;
00059 if(kineticEnergy>back().first) result = false;
00060 return result;
00061 }
00062
00064
00065 G4double G4PiData::ReactionXSection(G4double kineticEnergy)
00066 {
00067 G4double result = 0;
00068 G4PiData::iterator it=begin();
00069 while(it!=end()&&kineticEnergy>(*it).first) {it++;}
00070 if(it==end())
00071 {
00072 throw G4HadronicException(__FILE__, __LINE__,
00073 "G4PiData::ReactionXSection: used outside validity range");
00074 }
00075 if(it==begin()) it++;
00076 G4double x1,x2,e1,e2;
00077 e1=(*(it-1)).first;
00078 x1=(*(it-1)).second.second;
00079 e2=(*(it)).first;
00080 x2=(*(it)).second.second;
00081 result = std::max(0., x1 + (kineticEnergy-e1)*(x2-x1)/(e2-e1));
00082 return result;
00083 }
00084
00086
00087 G4double G4PiData::ElasticXSection(G4double kineticEnergy)
00088 {
00089 G4double result = 0;
00090 G4PiData::iterator it=begin();
00091 while(it!=end()&&kineticEnergy>(*it).first) {it++;}
00092 if(it==end())
00093 {
00094 throw G4HadronicException(__FILE__, __LINE__,
00095 "G4PiData::ElasticXSection: used outside validity range");
00096 }
00097 if(it==begin()) it++;
00098 G4double x1,x2,e1,e2;
00099 e1=(*(it-1)).first;
00100 x1=(*(it-1)).second.first - (*(it-1)).second.second;
00101 e2=(*(it)).first;
00102 x2=(*(it)).second.first - (*(it)).second.second;
00103 result = std::max(0., x1 + (kineticEnergy-e1)*(x2-x1)/(e2-e1));
00104 return result;
00105 }
00106
00108
00109 G4double G4PiData::TotalXSection(G4double kineticEnergy)
00110 {
00111 G4double result = 0;
00112 G4PiData::iterator it=begin();
00113 while(it!=end()&&kineticEnergy>(*it).first) {it++;}
00114 if(it==end())
00115 {
00116 throw G4HadronicException(__FILE__, __LINE__,
00117 "G4PiData::TotalXSection: used outside validity range");
00118 }
00119 if(it==begin()) it++;
00120 G4double x1,x2,e1,e2;
00121 e1=(*(it-1)).first;
00122 x1=(*(it-1)).second.first;
00123 e2=(*(it)).first;
00124 x2=(*(it)).second.first;
00125 result = std::max(0., x1 + (kineticEnergy-e1)*(x2-x1)/(e2-e1));
00126 return result;
00127 }