Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 // The lust update: M.V. Kossov, CERN/ITEP(Mos 27 // The lust update: M.V. Kossov, CERN/ITEP(Moscow) 17-June-02 28 // 28 // 29 // 29 // 30 // G4 Physics class: G4ChipsKaonMinusInelastic 30 // G4 Physics class: G4ChipsKaonMinusInelasticXS for gamma+A cross sections 31 // Created: M.V. Kossov, CERN/ITEP(Moscow), 20 31 // Created: M.V. Kossov, CERN/ITEP(Moscow), 20-Dec-03 32 // The last update: M.V. Kossov, CERN/ITEP (Mo 32 // The last update: M.V. Kossov, CERN/ITEP (Moscow) 15-Feb-04 33 // ------------------------------------------- 33 // -------------------------------------------------------------------------------- 34 // Short description: Cross-sections extracted 34 // Short description: Cross-sections extracted from the CHIPS package for 35 // kaon(minus)-nuclear interactions. Author: M 35 // kaon(minus)-nuclear interactions. Author: M. Kossov 36 // ------------------------------------------- 36 // ------------------------------------------------------------------------------------- 37 // 37 // 38 38 39 #include "G4ChipsKaonMinusInelasticXS.hh" 39 #include "G4ChipsKaonMinusInelasticXS.hh" 40 #include "G4SystemOfUnits.hh" 40 #include "G4SystemOfUnits.hh" 41 #include "G4DynamicParticle.hh" 41 #include "G4DynamicParticle.hh" 42 #include "G4ParticleDefinition.hh" 42 #include "G4ParticleDefinition.hh" 43 #include "G4KaonMinus.hh" 43 #include "G4KaonMinus.hh" 44 44 45 // factory 45 // factory 46 #include "G4CrossSectionFactory.hh" 46 #include "G4CrossSectionFactory.hh" 47 // 47 // 48 G4_DECLARE_XS_FACTORY(G4ChipsKaonMinusInelasti 48 G4_DECLARE_XS_FACTORY(G4ChipsKaonMinusInelasticXS); 49 49 50 namespace { 50 namespace { 51 const G4double THmin=27.; // default m 51 const G4double THmin=27.; // default minimum Momentum (MeV/c) Threshold 52 const G4double THmiG=THmin*.001; // minimu 52 const G4double THmiG=THmin*.001; // minimum Momentum (GeV/c) Threshold 53 const G4double dP=10.; // step for 53 const G4double dP=10.; // step for the LEN (Low ENergy) table MeV/c 54 const G4double dPG=dP*.001; // step for 54 const G4double dPG=dP*.001; // step for the LEN (Low ENergy) table GeV/c 55 const G4int nL=105; // A#of LEN 55 const G4int nL=105; // A#of LEN points in E (step 10 MeV/c) 56 const G4double Pmin=THmin+(nL-1)*dP; // mi 56 const G4double Pmin=THmin+(nL-1)*dP; // minP for the HighE part with safety 57 const G4double Pmax=227000.; // maxP for 57 const G4double Pmax=227000.; // maxP for the HEN (High ENergy) part 227 GeV 58 const G4int nH=224; // A#of HEN 58 const G4int nH=224; // A#of HEN points in lnE 59 const G4double milP=std::log(Pmin);// Low 59 const G4double milP=std::log(Pmin);// Low logarithm energy for the HEN part 60 const G4double malP=std::log(Pmax);// High 60 const G4double malP=std::log(Pmax);// High logarithm energy (each 2.75 percent) 61 const G4double dlP=(malP-milP)/(nH-1); // 61 const G4double dlP=(malP-milP)/(nH-1); // Step in log energy in the HEN part 62 const G4double milPG=std::log(.001*Pmin);/ 62 const G4double milPG=std::log(.001*Pmin);// Low logarithmEnergy for HEN part GeV/c 63 } 63 } 64 // Initialization of the 64 // Initialization of the 65 65 66 G4ChipsKaonMinusInelasticXS::G4ChipsKaonMinusI 66 G4ChipsKaonMinusInelasticXS::G4ChipsKaonMinusInelasticXS():G4VCrossSectionDataSet(Default_Name()) 67 { 67 { 68 lastLEN=0; // Pointer to lastArray of LowEn 68 lastLEN=0; // Pointer to lastArray of LowEn CS 69 lastHEN=0; // Pointer to lastArray of HighEn 69 lastHEN=0; // Pointer to lastArray of HighEn CS 70 lastN=0; // The last N of calculated nucle 70 lastN=0; // The last N of calculated nucleus 71 lastZ=0; // The last Z of calculated nucle 71 lastZ=0; // The last Z of calculated nucleus 72 lastP=0.; // Last used in CrossSection Mome 72 lastP=0.; // Last used in CrossSection Momentum 73 lastTH=0.; // Last threshold momentum 73 lastTH=0.; // Last threshold momentum 74 lastCS=0.; // Last value of the Cross Sectio 74 lastCS=0.; // Last value of the Cross Section 75 lastI=0; // The last position in the DAMDB 75 lastI=0; // The last position in the DAMDB 76 LEN = new std::vector<G4double*>; 76 LEN = new std::vector<G4double*>; 77 HEN = new std::vector<G4double*>; 77 HEN = new std::vector<G4double*>; 78 } 78 } 79 79 80 G4ChipsKaonMinusInelasticXS::~G4ChipsKaonMinus 80 G4ChipsKaonMinusInelasticXS::~G4ChipsKaonMinusInelasticXS() 81 { 81 { 82 std::size_t lens=LEN->size(); << 82 G4int lens=LEN->size(); 83 for(std::size_t i=0; i<lens; ++i) delete[] ( << 83 for(G4int i=0; i<lens; ++i) delete[] (*LEN)[i]; 84 delete LEN; 84 delete LEN; 85 85 86 std::size_t hens=HEN->size(); << 86 G4int hens=HEN->size(); 87 for(std::size_t i=0; i<hens; ++i) delete[] ( << 87 for(G4int i=0; i<hens; ++i) delete[] (*HEN)[i]; 88 delete HEN; 88 delete HEN; 89 } 89 } 90 90 91 void << 91 G4bool G4ChipsKaonMinusInelasticXS::IsIsoApplicable(const G4DynamicParticle* Pt, G4int, G4int, 92 G4ChipsKaonMinusInelasticXS::CrossSectionDescr << 93 { << 94 outFile << "G4ChipsKaonMinusInelasticXS pr << 95 << "section for K- nucleus scatter << 96 << "momentum. The cross section is << 97 << "CHIPS parameterization of cros << 98 } << 99 << 100 G4bool G4ChipsKaonMinusInelasticXS::IsIsoAppli << 101 const G4Element*, 92 const G4Element*, 102 const G4Material*) 93 const G4Material*) 103 { 94 { 104 return true; << 95 G4ParticleDefinition* particle = Pt->GetDefinition(); >> 96 if (particle == G4KaonMinus::KaonMinus() ) return true; >> 97 return false; 105 } 98 } 106 99 107 100 108 // The main member function giving the collisi 101 // The main member function giving the collision cross section (P is in IU, CS is in mb) 109 // Make pMom in independent units ! (Now it is 102 // Make pMom in independent units ! (Now it is MeV) 110 G4double G4ChipsKaonMinusInelasticXS::GetIsoCr 103 G4double G4ChipsKaonMinusInelasticXS::GetIsoCrossSection(const G4DynamicParticle* Pt, G4int tgZ, G4int A, 111 const G4Isotope*, 104 const G4Isotope*, 112 const G4Element*, 105 const G4Element*, 113 const G4Material*) 106 const G4Material*) 114 { 107 { 115 G4double pMom=Pt->GetTotalMomentum(); 108 G4double pMom=Pt->GetTotalMomentum(); 116 G4int tgN = A - tgZ; 109 G4int tgN = A - tgZ; 117 110 118 return GetChipsCrossSection(pMom, tgZ, tgN, 111 return GetChipsCrossSection(pMom, tgZ, tgN, -321); 119 } 112 } 120 113 121 G4double G4ChipsKaonMinusInelasticXS::GetChips 114 G4double G4ChipsKaonMinusInelasticXS::GetChipsCrossSection(G4double pMom, G4int tgZ, G4int tgN, G4int) 122 { 115 { >> 116 static G4ThreadLocal G4int j; // A#0f Z/N-records already tested in AMDB >> 117 static G4ThreadLocal std::vector <G4int> *colN_G4MT_TLS_ = 0 ; if (!colN_G4MT_TLS_) colN_G4MT_TLS_ = new std::vector <G4int> ; std::vector <G4int> &colN = *colN_G4MT_TLS_; // Vector of N for calculated nuclei (isotops) >> 118 static G4ThreadLocal std::vector <G4int> *colZ_G4MT_TLS_ = 0 ; if (!colZ_G4MT_TLS_) colZ_G4MT_TLS_ = new std::vector <G4int> ; std::vector <G4int> &colZ = *colZ_G4MT_TLS_; // Vector of Z for calculated nuclei (isotops) >> 119 static G4ThreadLocal std::vector <G4double> *colP_G4MT_TLS_ = 0 ; if (!colP_G4MT_TLS_) colP_G4MT_TLS_ = new std::vector <G4double> ; std::vector <G4double> &colP = *colP_G4MT_TLS_; // Vector of last momenta for the reaction >> 120 static G4ThreadLocal std::vector <G4double> *colTH_G4MT_TLS_ = 0 ; if (!colTH_G4MT_TLS_) colTH_G4MT_TLS_ = new std::vector <G4double> ; std::vector <G4double> &colTH = *colTH_G4MT_TLS_; // Vector of energy thresholds for the reaction >> 121 static G4ThreadLocal std::vector <G4double> *colCS_G4MT_TLS_ = 0 ; if (!colCS_G4MT_TLS_) colCS_G4MT_TLS_ = new std::vector <G4double> ; std::vector <G4double> &colCS = *colCS_G4MT_TLS_; // Vector of last cross sections for the reaction >> 122 // ***---*** End of the mandatory Static Definitions of the Associative Memory ***---*** >> 123 123 G4bool in=false; // By d 124 G4bool in=false; // By default the isotope must be found in the AMDB 124 if(tgN!=lastN || tgZ!=lastZ) // The 125 if(tgN!=lastN || tgZ!=lastZ) // The nucleus was not the last used isotope 125 { 126 { 126 in = false; // By d 127 in = false; // By default the isotope haven't be found in AMDB 127 lastP = 0.; // New 128 lastP = 0.; // New momentum history (nothing to compare with) 128 lastN = tgN; // The 129 lastN = tgN; // The last N of the calculated nucleus 129 lastZ = tgZ; // The 130 lastZ = tgZ; // The last Z of the calculated nucleus 130 lastI = (G4int)colN.size(); // Size << 131 lastI = colN.size(); // Size of the Associative Memory DB in the heap 131 j = 0; // A#0f 132 j = 0; // A#0f records found in DB for this projectile 132 if(lastI) for(G4int i=0; i<lastI; ++i) // << 133 if(lastI) for(G4int i=0; i<lastI; i++) // AMDB exists, try to find the (Z,N) isotope 133 { 134 { 134 if(colN[i]==tgN && colZ[i]==tgZ) // Try 135 if(colN[i]==tgN && colZ[i]==tgZ) // Try the record "i" in the AMDB 135 { 136 { 136 lastI=i; // Reme 137 lastI=i; // Remember the index for future fast/last use 137 lastTH =colTH[i]; // The 138 lastTH =colTH[i]; // The last THreshold (A-dependent) 138 if(pMom<=lastTH) 139 if(pMom<=lastTH) 139 { 140 { 140 return 0.; // Ener 141 return 0.; // Energy is below the Threshold value 141 } 142 } 142 lastP =colP [i]; // Last 143 lastP =colP [i]; // Last Momentum (A-dependent) 143 lastCS =colCS[i]; // Last 144 lastCS =colCS[i]; // Last CrossSect (A-dependent) 144 in = true; // This 145 in = true; // This is the case when the isotop is found in DB 145 // Momentum pMom is in IU ! @@ Units 146 // Momentum pMom is in IU ! @@ Units 146 lastCS=CalculateCrossSection(-1,j,-321 147 lastCS=CalculateCrossSection(-1,j,-321,lastZ,lastN,pMom); // read & update 147 if(lastCS<=0. && pMom>lastTH) // Corr 148 if(lastCS<=0. && pMom>lastTH) // Correct the threshold (@@ No intermediate Zeros) 148 { 149 { 149 lastCS=0.; 150 lastCS=0.; 150 lastTH=pMom; 151 lastTH=pMom; 151 } 152 } 152 break; // Go o 153 break; // Go out of the LOOP 153 } 154 } 154 j++; // Incr 155 j++; // Increment a#0f records found in DB 155 } 156 } 156 if(!in) // This 157 if(!in) // This isotope has not been calculated previously 157 { 158 { 158 //!!The slave functions must provide cro 159 //!!The slave functions must provide cross-sections in millibarns (mb) !! (not in IU) 159 lastCS=CalculateCrossSection(0,j,-321,la 160 lastCS=CalculateCrossSection(0,j,-321,lastZ,lastN,pMom); //calculate & create 160 //if(lastCS>0.) // It 161 //if(lastCS>0.) // It means that the AMBD was initialized 161 //{ 162 //{ 162 163 163 // lastTH = ThresholdEnergy(tgZ, 164 // lastTH = ThresholdEnergy(tgZ, tgN); // The Threshold Energy which is now the last 164 165 165 lastTH = 0; // WP - to be checked!!! 166 lastTH = 0; // WP - to be checked!!! 166 colN.push_back(tgN); 167 colN.push_back(tgN); 167 colZ.push_back(tgZ); 168 colZ.push_back(tgZ); 168 colP.push_back(pMom); 169 colP.push_back(pMom); 169 colTH.push_back(lastTH); 170 colTH.push_back(lastTH); 170 colCS.push_back(lastCS); 171 colCS.push_back(lastCS); 171 //} // M.K. Presence of H1 with high thr 172 //} // M.K. Presence of H1 with high threshold breaks the syncronization 172 return lastCS*millibarn; 173 return lastCS*millibarn; 173 } // End of creation of the new set of par 174 } // End of creation of the new set of parameters 174 else 175 else 175 { 176 { 176 colP[lastI]=pMom; 177 colP[lastI]=pMom; 177 colCS[lastI]=lastCS; 178 colCS[lastI]=lastCS; 178 } 179 } 179 } // End of parameters udate 180 } // End of parameters udate 180 else if(pMom<=lastTH) 181 else if(pMom<=lastTH) 181 { 182 { 182 return 0.; // Mome 183 return 0.; // Momentum is below the Threshold Value -> CS=0 183 } 184 } 184 else // It i 185 else // It is the last used -> use the current tables 185 { 186 { 186 lastCS=CalculateCrossSection(1,j,-321,last 187 lastCS=CalculateCrossSection(1,j,-321,lastZ,lastN,pMom); // Only read and UpdateDB 187 lastP=pMom; 188 lastP=pMom; 188 } 189 } 189 return lastCS*millibarn; 190 return lastCS*millibarn; 190 } 191 } 191 192 192 // The main member function giving the gamma-A 193 // The main member function giving the gamma-A cross section (E in GeV, CS in mb) 193 G4double G4ChipsKaonMinusInelasticXS::Calculat 194 G4double G4ChipsKaonMinusInelasticXS::CalculateCrossSection(G4int F, G4int I, 194 G4int, 195 G4int, G4int targZ, G4int targN, G4double Momentum) 195 { 196 { >> 197 G4double sigma=0.; >> 198 if(F&&I) sigma=0.; // @@ *!* Fake line *!* to use F & I !!!Temporary!!! >> 199 //G4double A=targN+targZ; // A of the target 196 if(F<=0) // This 200 if(F<=0) // This isotope was not the last used isotop 197 { 201 { 198 if(F<0) // This 202 if(F<0) // This isotope was found in DAMDB =-----=> RETRIEVE 199 { 203 { 200 G4int sync=(G4int)LEN->size(); << 204 G4int sync=LEN->size(); 201 if(sync<=I) G4cerr<<"*!*G4QPiMinusNuclCS 205 if(sync<=I) G4cerr<<"*!*G4QPiMinusNuclCS::CalcCrosSect:Sync="<<sync<<"<="<<I<<G4endl; 202 lastLEN=(*LEN)[I]; // Poi 206 lastLEN=(*LEN)[I]; // Pointer to prepared LowEnergy cross sections 203 lastHEN=(*HEN)[I]; // Poi 207 lastHEN=(*HEN)[I]; // Pointer to prepared High Energy cross sections 204 } 208 } 205 else // This 209 else // This isotope wasn't calculated before => CREATE 206 { 210 { 207 lastLEN = new G4double[nL]; // Allo 211 lastLEN = new G4double[nL]; // Allocate memory for the new LEN cross sections 208 lastHEN = new G4double[nH]; // Allo 212 lastHEN = new G4double[nH]; // Allocate memory for the new HEN cross sections 209 // --- Instead of making a separate func 213 // --- Instead of making a separate function --- 210 G4double P=THmiG; // Tabl 214 G4double P=THmiG; // Table threshold in GeV/c 211 for(G4int k=0; k<nL; k++) 215 for(G4int k=0; k<nL; k++) 212 { 216 { 213 lastLEN[k] = CrossSectionLin(targZ, ta 217 lastLEN[k] = CrossSectionLin(targZ, targN, P); 214 P+=dPG; 218 P+=dPG; 215 } 219 } 216 G4double lP=milPG; 220 G4double lP=milPG; 217 for(G4int n=0; n<nH; n++) 221 for(G4int n=0; n<nH; n++) 218 { 222 { 219 lastHEN[n] = CrossSectionLog(targZ, ta 223 lastHEN[n] = CrossSectionLog(targZ, targN, lP); 220 lP+=dlP; 224 lP+=dlP; 221 } 225 } 222 // --- End of possible separate function 226 // --- End of possible separate function 223 // *** The synchronization check *** 227 // *** The synchronization check *** 224 G4int sync=(G4int)LEN->size(); << 228 G4int sync=LEN->size(); 225 if(sync!=I) 229 if(sync!=I) 226 { 230 { 227 G4cerr<<"***G4ChipsKaonMinusCS::CalcCr 231 G4cerr<<"***G4ChipsKaonMinusCS::CalcCrossSect: Sinc="<<sync<<"#"<<I<<", Z=" <<targZ 228 <<", N="<<targN<<", F="<<F<<G4en 232 <<", N="<<targN<<", F="<<F<<G4endl; 229 //G4Exception("G4PiMinusNuclearCS::Cal 233 //G4Exception("G4PiMinusNuclearCS::CalculateCS:","39",FatalException,"DBoverflow"); 230 } 234 } 231 LEN->push_back(lastLEN); // reme 235 LEN->push_back(lastLEN); // remember the Low Energy Table 232 HEN->push_back(lastHEN); // reme 236 HEN->push_back(lastHEN); // remember the High Energy Table 233 } // End of creation of the new set of par 237 } // End of creation of the new set of parameters 234 } // End of parameters update << 238 } // End of parameters udate 235 // =------------------= NOW the Magic Formul 239 // =------------------= NOW the Magic Formula =--------------------------= 236 G4double sigma; << 237 if (Momentum<lastTH) return 0.; // It m 240 if (Momentum<lastTH) return 0.; // It must be already checked in the interface class 238 else if (Momentum<Pmin) // High 241 else if (Momentum<Pmin) // High Energy region 239 { 242 { 240 sigma=EquLinearFit(Momentum,nL,THmin,dP,la 243 sigma=EquLinearFit(Momentum,nL,THmin,dP,lastLEN); 241 } 244 } 242 else if (Momentum<Pmax) // High 245 else if (Momentum<Pmax) // High Energy region 243 { 246 { 244 G4double lP=std::log(Momentum); 247 G4double lP=std::log(Momentum); 245 sigma=EquLinearFit(lP,nH,milP,dlP,lastHEN) 248 sigma=EquLinearFit(lP,nH,milP,dlP,lastHEN); 246 } 249 } 247 else // UHE 250 else // UHE region (calculation, not frequent) 248 { 251 { 249 G4double P=0.001*Momentum; // Appr 252 G4double P=0.001*Momentum; // Approximation formula is for P in GeV/c 250 sigma=CrossSectionFormula(targZ, targN, P, 253 sigma=CrossSectionFormula(targZ, targN, P, std::log(P)); 251 } 254 } 252 if(sigma<0.) return 0.; 255 if(sigma<0.) return 0.; 253 return sigma; 256 return sigma; 254 } 257 } 255 258 256 // Calculation formula for piMinus-nuclear ine 259 // Calculation formula for piMinus-nuclear inelastic cross-section (mb) (P in GeV/c) 257 G4double G4ChipsKaonMinusInelasticXS::CrossSec 260 G4double G4ChipsKaonMinusInelasticXS::CrossSectionLin(G4int tZ, G4int tN, G4double P) 258 { 261 { 259 G4double lP=std::log(P); 262 G4double lP=std::log(P); 260 return CrossSectionFormula(tZ, tN, P, lP); 263 return CrossSectionFormula(tZ, tN, P, lP); 261 } 264 } 262 265 263 // Calculation formula for piMinus-nuclear ine 266 // Calculation formula for piMinus-nuclear inelastic cross-section (mb) log(P in GeV/c) 264 G4double G4ChipsKaonMinusInelasticXS::CrossSec 267 G4double G4ChipsKaonMinusInelasticXS::CrossSectionLog(G4int tZ, G4int tN, G4double lP) 265 { 268 { 266 G4double P=std::exp(lP); 269 G4double P=std::exp(lP); 267 return CrossSectionFormula(tZ, tN, P, lP); 270 return CrossSectionFormula(tZ, tN, P, lP); 268 } 271 } 269 // Calculation formula for piMinus-nuclear ine 272 // Calculation formula for piMinus-nuclear inelastic cross-section (mb) log(P in GeV/c) 270 G4double G4ChipsKaonMinusInelasticXS::CrossSec 273 G4double G4ChipsKaonMinusInelasticXS::CrossSectionFormula(G4int tZ, G4int tN, 271 274 G4double P, G4double lP) 272 { 275 { 273 G4double sigma=0.; 276 G4double sigma=0.; 274 if(tZ==1 && !tN) // P 277 if(tZ==1 && !tN) // PiMin-Proton interaction from G4QuasiElRatios 275 { 278 { 276 G4double ld=lP-3.5; 279 G4double ld=lP-3.5; 277 G4double ld2=ld*ld; 280 G4double ld2=ld*ld; 278 G4double p2=P*P; 281 G4double p2=P*P; 279 G4double p4=p2*p2; 282 G4double p4=p2*p2; 280 G4double sp=std::sqrt(P); 283 G4double sp=std::sqrt(P); 281 G4double psp=P*sp; 284 G4double psp=P*sp; 282 G4double lm=P-.39; 285 G4double lm=P-.39; 283 G4double md=lm*lm+.000156; 286 G4double md=lm*lm+.000156; 284 G4double lh=P-1.; 287 G4double lh=P-1.; 285 G4double hd=lh*lh+.0156; 288 G4double hd=lh*lh+.0156; 286 G4double El=(.0557*ld2+2.23)/(1.-.7/sp+.07 289 G4double El=(.0557*ld2+2.23)/(1.-.7/sp+.075/p4); 287 G4double To=(.3*ld2+19.5)/(1.-.21/sp+.52/p 290 G4double To=(.3*ld2+19.5)/(1.-.21/sp+.52/p4); 288 sigma=8.8/psp+(To-El)+.002/md+.15/hd; 291 sigma=8.8/psp+(To-El)+.002/md+.15/hd; 289 } 292 } 290 else if(tZ==1 && tN==1) // 293 else if(tZ==1 && tN==1) // kmp_tot 291 { 294 { 292 G4double p2=P*P; 295 G4double p2=P*P; 293 G4double dX=lP-3.7; 296 G4double dX=lP-3.7; 294 G4double dR=P-.94; 297 G4double dR=P-.94; 295 G4double sp=std::sqrt(P); 298 G4double sp=std::sqrt(P); 296 sigma=(.6*dX*dX+36.)/(1.-.11/sp+.52/p2/p2) 299 sigma=(.6*dX*dX+36.)/(1.-.11/sp+.52/p2/p2)+.7/(dR*dR+.0256)+18./P/sp; 297 } 300 } 298 else if(tZ<97 && tN<152) // G 301 else if(tZ<97 && tN<152) // General solution 299 { 302 { 300 G4double d=lP-4.2; 303 G4double d=lP-4.2; 301 G4double sp=std::sqrt(P); 304 G4double sp=std::sqrt(P); 302 G4double p2=P*P; 305 G4double p2=P*P; 303 G4double a=tN+tZ; // 306 G4double a=tN+tZ; // A of the target 304 G4double sa=std::sqrt(a); 307 G4double sa=std::sqrt(a); 305 G4double al=std::log(a); 308 G4double al=std::log(a); 306 G4double a2=a*a; 309 G4double a2=a*a; 307 G4double c=52.*std::exp(al*0.6)*(1.+97./a2 310 G4double c=52.*std::exp(al*0.6)*(1.+97./a2)/(1.+9.8/a)/(1.+47./a2); 308 G4double gg=-.2-.003*a; 311 G4double gg=-.2-.003*a; 309 G4double h=.5+.07*a; 312 G4double h=.5+.07*a; 310 G4double v=P-1.; 313 G4double v=P-1.; 311 G4double f=.6*a*sa/(1.+.00002*a2); 314 G4double f=.6*a*sa/(1.+.00002*a2); 312 G4double u=.125+.127*al; 315 G4double u=.125+.127*al; 313 sigma=(c+d*d)/(1.+gg/sp+h/p2/p2)+f/(v*v+u* 316 sigma=(c+d*d)/(1.+gg/sp+h/p2/p2)+f/(v*v+u*u)+20.*sa/P/sp; 314 } 317 } 315 else 318 else 316 { 319 { 317 G4cerr<<"-Warning-G4ChipsKMinusNuclearCroS 320 G4cerr<<"-Warning-G4ChipsKMinusNuclearCroSect::CSForm:*Bad A* Z="<<tZ<<", N="<<tN<<G4endl; 318 sigma=0.; 321 sigma=0.; 319 } 322 } 320 if(sigma<0.) return 0.; 323 if(sigma<0.) return 0.; 321 return sigma; 324 return sigma; 322 } 325 } 323 326 324 G4double G4ChipsKaonMinusInelasticXS::EquLinea 327 G4double G4ChipsKaonMinusInelasticXS::EquLinearFit(G4double X, G4int N, G4double X0, G4double DX, G4double* Y) 325 { 328 { 326 if(DX<=0. || N<2) 329 if(DX<=0. || N<2) 327 { 330 { 328 G4cerr<<"***G4ChipsKaonMinusInelasticXS: 331 G4cerr<<"***G4ChipsKaonMinusInelasticXS::EquLinearFit: DX="<<DX<<", N="<<N<<G4endl; 329 return Y[0]; 332 return Y[0]; 330 } 333 } 331 334 332 G4int N2=N-2; 335 G4int N2=N-2; 333 G4double d=(X-X0)/DX; 336 G4double d=(X-X0)/DX; 334 G4int jj=static_cast<int>(d); << 337 G4int j=static_cast<int>(d); 335 if (jj<0) jj=0; << 338 if (j<0) j=0; 336 else if(jj>N2) jj=N2; << 339 else if(j>N2) j=N2; 337 d-=jj; // excess << 340 d-=j; // excess 338 G4double yi=Y[jj]; << 341 G4double yi=Y[j]; 339 G4double sigma=yi+(Y[jj+1]-yi)*d; << 342 G4double sigma=yi+(Y[j+1]-yi)*d; 340 343 341 return sigma; 344 return sigma; 342 } 345 } 343 346