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: G4ChipsAntiBaryonInelasti 30 // G4 Physics class: G4ChipsAntiBaryonInelasticXS 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 // ------------------------------------------- 34 // ------------------------------------------------------------------------------------- 35 // Short description: Cross-sections extracted 35 // Short description: Cross-sections extracted (by W.Pokorski) from the CHIPS package for 36 // anti-baryoninteractions. Original author: M 36 // anti-baryoninteractions. Original author: M. Kossov 37 // ------------------------------------------- 37 // ------------------------------------------------------------------------------------- 38 // 38 // 39 39 40 #include "G4ChipsAntiBaryonInelasticXS.hh" 40 #include "G4ChipsAntiBaryonInelasticXS.hh" 41 #include "G4SystemOfUnits.hh" 41 #include "G4SystemOfUnits.hh" 42 #include "G4DynamicParticle.hh" 42 #include "G4DynamicParticle.hh" 43 #include "G4ParticleDefinition.hh" 43 #include "G4ParticleDefinition.hh" 44 #include "G4AntiNeutron.hh" 44 #include "G4AntiNeutron.hh" 45 #include "G4AntiProton.hh" 45 #include "G4AntiProton.hh" 46 #include "G4AntiLambda.hh" 46 #include "G4AntiLambda.hh" 47 #include "G4AntiSigmaPlus.hh" 47 #include "G4AntiSigmaPlus.hh" 48 #include "G4AntiSigmaMinus.hh" 48 #include "G4AntiSigmaMinus.hh" 49 #include "G4AntiSigmaZero.hh" 49 #include "G4AntiSigmaZero.hh" 50 #include "G4AntiXiMinus.hh" 50 #include "G4AntiXiMinus.hh" 51 #include "G4AntiXiZero.hh" 51 #include "G4AntiXiZero.hh" 52 #include "G4AntiOmegaMinus.hh" 52 #include "G4AntiOmegaMinus.hh" 53 #include "G4Log.hh" << 54 #include "G4Exp.hh" << 55 #include "G4Pow.hh" << 56 53 57 // factory 54 // factory 58 #include "G4CrossSectionFactory.hh" 55 #include "G4CrossSectionFactory.hh" 59 // 56 // 60 G4_DECLARE_XS_FACTORY(G4ChipsAntiBaryonInelast 57 G4_DECLARE_XS_FACTORY(G4ChipsAntiBaryonInelasticXS); 61 58 62 G4ChipsAntiBaryonInelasticXS::G4ChipsAntiBaryo 59 G4ChipsAntiBaryonInelasticXS::G4ChipsAntiBaryonInelasticXS():G4VCrossSectionDataSet(Default_Name()) 63 { 60 { 64 lastLEN=0; // Pointer to lastArray of LowEn 61 lastLEN=0; // Pointer to lastArray of LowEn CS 65 lastHEN=0; // Pointer to lastArray of HighEn 62 lastHEN=0; // Pointer to lastArray of HighEn CS 66 lastN=0; // The last N of calculated nucle 63 lastN=0; // The last N of calculated nucleus 67 lastZ=0; // The last Z of calculated nucle 64 lastZ=0; // The last Z of calculated nucleus 68 lastP=0.; // Last used Cross Section Moment 65 lastP=0.; // Last used Cross Section Momentum 69 lastTH=0.; // Last threshold momentum 66 lastTH=0.; // Last threshold momentum 70 lastCS=0.; // Last value of the Cross Sectio 67 lastCS=0.; // Last value of the Cross Section 71 lastI=0; // The last position in the DAMDB 68 lastI=0; // The last position in the DAMDB 72 LEN = new std::vector<G4double*>; 69 LEN = new std::vector<G4double*>; 73 HEN = new std::vector<G4double*>; 70 HEN = new std::vector<G4double*>; 74 } 71 } 75 72 76 G4ChipsAntiBaryonInelasticXS::~G4ChipsAntiBary 73 G4ChipsAntiBaryonInelasticXS::~G4ChipsAntiBaryonInelasticXS() 77 { 74 { 78 std::size_t lens=LEN->size(); << 75 G4int lens=LEN->size(); 79 for(std::size_t i=0; i<lens; ++i) delete[] ( << 76 for(G4int i=0; i<lens; ++i) delete[] (*LEN)[i]; 80 delete LEN; 77 delete LEN; 81 std::size_t hens=HEN->size(); << 78 G4int hens=HEN->size(); 82 for(std::size_t i=0; i<hens; ++i) delete[] ( << 79 for(G4int i=0; i<hens; ++i) delete[] (*HEN)[i]; 83 delete HEN; 80 delete HEN; 84 } 81 } 85 82 86 void G4ChipsAntiBaryonInelasticXS::CrossSectio << 83 G4bool G4ChipsAntiBaryonInelasticXS::IsIsoApplicable(const G4DynamicParticle* Pt, G4int, G4int, 87 { << 88 outFile << "G4ChipsAntiBaryonInelasticXS pro << 89 << "section for anti-baryon nucleus << 90 << "momentum. The cross section is c << 91 << "CHIPS parameterization of cross << 92 } << 93 << 94 << 95 G4bool G4ChipsAntiBaryonInelasticXS::IsIsoAppl << 96 const G4Element*, 84 const G4Element*, 97 const G4Material*) 85 const G4Material*) 98 { 86 { 99 /* << 87 G4ParticleDefinition* particle = Pt->GetDefinition(); 100 const G4ParticleDefinition* particle = Pt->G << 101 88 102 if(particle == G4AntiNeutron::AntiNeutron()) 89 if(particle == G4AntiNeutron::AntiNeutron()) 103 { 90 { 104 return true; 91 return true; 105 } 92 } 106 else if(particle == G4AntiProton::AntiProton 93 else if(particle == G4AntiProton::AntiProton()) 107 { 94 { 108 return true; 95 return true; 109 } 96 } 110 else if(particle == G4AntiLambda::AntiLambda 97 else if(particle == G4AntiLambda::AntiLambda()) 111 { 98 { 112 return true; 99 return true; 113 } 100 } 114 else if(particle == G4AntiSigmaPlus::AntiSig 101 else if(particle == G4AntiSigmaPlus::AntiSigmaPlus()) 115 { 102 { 116 return true; 103 return true; 117 } 104 } 118 else if(particle == G4AntiSigmaMinus::AntiSi 105 else if(particle == G4AntiSigmaMinus::AntiSigmaMinus()) 119 { 106 { 120 return true; 107 return true; 121 } 108 } 122 else if(particle == G4AntiSigmaZero::AntiSig 109 else if(particle == G4AntiSigmaZero::AntiSigmaZero()) 123 { 110 { 124 return true; 111 return true; 125 } 112 } 126 else if(particle == G4AntiXiMinus::AntiXiMin 113 else if(particle == G4AntiXiMinus::AntiXiMinus()) 127 { 114 { 128 return true; 115 return true; 129 } 116 } 130 else if(particle == G4AntiXiZero::AntiXiZero 117 else if(particle == G4AntiXiZero::AntiXiZero()) 131 { 118 { 132 return true; 119 return true; 133 } 120 } 134 else if(particle == G4AntiOmegaMinus::AntiOm 121 else if(particle == G4AntiOmegaMinus::AntiOmegaMinus()) 135 { 122 { 136 return true; 123 return true; 137 } 124 } 138 */ << 125 return false; 139 return true; << 140 } 126 } 141 127 142 // The main member function giving the collisi 128 // The main member function giving the collision cross section (P is in IU, CS is in mb) 143 // Make pMom in independent units ! (Now it is 129 // Make pMom in independent units ! (Now it is MeV) 144 G4double G4ChipsAntiBaryonInelasticXS::GetIsoC 130 G4double G4ChipsAntiBaryonInelasticXS::GetIsoCrossSection(const G4DynamicParticle* Pt, G4int tgZ, G4int A, 145 const G4Isotope*, 131 const G4Isotope*, 146 const G4Element*, 132 const G4Element*, 147 const G4Material*) 133 const G4Material*) 148 { 134 { 149 G4double pMom=Pt->GetTotalMomentum(); 135 G4double pMom=Pt->GetTotalMomentum(); 150 G4int tgN = A - tgZ; 136 G4int tgN = A - tgZ; 151 G4int pdg = Pt->GetDefinition()->GetPDGEncod 137 G4int pdg = Pt->GetDefinition()->GetPDGEncoding(); 152 138 153 return GetChipsCrossSection(pMom, tgZ, tgN, 139 return GetChipsCrossSection(pMom, tgZ, tgN, pdg); 154 } 140 } 155 141 156 G4double G4ChipsAntiBaryonInelasticXS::GetChip 142 G4double G4ChipsAntiBaryonInelasticXS::GetChipsCrossSection(G4double pMom, G4int tgZ, G4int tgN, G4int cPDG) 157 { 143 { >> 144 static G4ThreadLocal G4int j; // A#0f Z/N-records already tested in AMDB >> 145 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) >> 146 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) >> 147 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 >> 148 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 >> 149 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 >> 150 // ***---*** End of the mandatory Static Definitions of the Associative Memory ***---*** 158 151 159 G4bool in=false; // By d 152 G4bool in=false; // By default the isotope must be found in the AMDB 160 if(tgN!=lastN || tgZ!=lastZ) // The 153 if(tgN!=lastN || tgZ!=lastZ) // The nucleus was not the last used isotope 161 { 154 { 162 in = false; // By d 155 in = false; // By default the isotope haven't be found in AMDB 163 lastP = 0.; // New 156 lastP = 0.; // New momentum history (nothing to compare with) 164 lastN = tgN; // The 157 lastN = tgN; // The last N of the calculated nucleus 165 lastZ = tgZ; // The 158 lastZ = tgZ; // The last Z of the calculated nucleus 166 lastI = (G4int)colN.size(); // Size << 159 lastI = colN.size(); // Size of the Associative Memory DB in the heap 167 j = 0; // A#0f 160 j = 0; // A#0f records found in DB for this projectile 168 if(lastI) for(G4int i=0; i<lastI; i++) // 161 if(lastI) for(G4int i=0; i<lastI; i++) // AMDB exists, try to find the (Z,N) isotope 169 { 162 { 170 if(colN[i]==tgN && colZ[i]==tgZ) // Try 163 if(colN[i]==tgN && colZ[i]==tgZ) // Try the record "i" in the AMDB 171 { 164 { 172 lastI=i; // Reme 165 lastI=i; // Remember the index for future fast/last use 173 lastTH =colTH[i]; // The 166 lastTH =colTH[i]; // The last THreshold (A-dependent) 174 if(pMom<=lastTH) 167 if(pMom<=lastTH) 175 { 168 { 176 return 0.; // Ener 169 return 0.; // Energy is below the Threshold value 177 } 170 } 178 lastP =colP [i]; // Last 171 lastP =colP [i]; // Last Momentum (A-dependent) 179 lastCS =colCS[i]; // Last 172 lastCS =colCS[i]; // Last CrossSect (A-dependent) 180 in = true; // This 173 in = true; // This is the case when the isotop is found in DB 181 // Momentum pMom is in IU ! @@ Units 174 // Momentum pMom is in IU ! @@ Units 182 lastCS=CalculateCrossSection(-1,j,cPDG 175 lastCS=CalculateCrossSection(-1,j,cPDG,lastZ,lastN,pMom); // read & update 183 if(lastCS<=0. && pMom>lastTH) // Corr 176 if(lastCS<=0. && pMom>lastTH) // Correct the threshold (@@ No intermediate Zeros) 184 { 177 { 185 lastCS=0.; 178 lastCS=0.; 186 lastTH=pMom; 179 lastTH=pMom; 187 } 180 } 188 break; // Go o 181 break; // Go out of the LOOP 189 } 182 } 190 j++; // Incr 183 j++; // Increment a#0f records found in DB 191 } 184 } 192 if(!in) // This 185 if(!in) // This isotope has not been calculated previously 193 { 186 { 194 //!!The slave functions must provide cro 187 //!!The slave functions must provide cross-sections in millibarns (mb) !! (not in IU) 195 lastCS=CalculateCrossSection(0,j,cPDG,la 188 lastCS=CalculateCrossSection(0,j,cPDG,lastZ,lastN,pMom); //calculate & create 196 //if(lastCS>0.) // It 189 //if(lastCS>0.) // It means that the AMBD was initialized 197 //{ 190 //{ 198 191 199 lastTH = 0; //ThresholdEnergy(tgZ, tgN); 192 lastTH = 0; //ThresholdEnergy(tgZ, tgN); // The Threshold Energy which is now the last 200 colN.push_back(tgN); 193 colN.push_back(tgN); 201 colZ.push_back(tgZ); 194 colZ.push_back(tgZ); 202 colP.push_back(pMom); 195 colP.push_back(pMom); 203 colTH.push_back(lastTH); 196 colTH.push_back(lastTH); 204 colCS.push_back(lastCS); 197 colCS.push_back(lastCS); 205 //} // M.K. Presence of H1 with high thr 198 //} // M.K. Presence of H1 with high threshold breaks the syncronization 206 return lastCS*millibarn; 199 return lastCS*millibarn; 207 } // End of creation of the new set of par 200 } // End of creation of the new set of parameters 208 else 201 else 209 { 202 { 210 colP[lastI]=pMom; 203 colP[lastI]=pMom; 211 colCS[lastI]=lastCS; 204 colCS[lastI]=lastCS; 212 } 205 } 213 } // End of parameters udate 206 } // End of parameters udate 214 else if(pMom<=lastTH) 207 else if(pMom<=lastTH) 215 { 208 { 216 return 0.; // Mome 209 return 0.; // Momentum is below the Threshold Value -> CS=0 217 } 210 } 218 else // It i 211 else // It is the last used -> use the current tables 219 { 212 { 220 lastCS=CalculateCrossSection(1,j,cPDG,last 213 lastCS=CalculateCrossSection(1,j,cPDG,lastZ,lastN,pMom); // Only read and UpdateDB 221 lastP=pMom; 214 lastP=pMom; 222 } 215 } 223 return lastCS*millibarn; 216 return lastCS*millibarn; 224 } 217 } 225 218 226 // The main member function giving the gamma-A 219 // The main member function giving the gamma-A cross section (E in GeV, CS in mb) 227 G4double G4ChipsAntiBaryonInelasticXS::Calcula 220 G4double G4ChipsAntiBaryonInelasticXS::CalculateCrossSection(G4int F, G4int I, 228 G4int, 221 G4int, G4int targZ, G4int targN, G4double Momentum) 229 { 222 { 230 static const G4double THmin=27.; // defa 223 static const G4double THmin=27.; // default minimum Momentum (MeV/c) Threshold 231 static const G4double THmiG=THmin*.001; // m 224 static const G4double THmiG=THmin*.001; // minimum Momentum (GeV/c) Threshold 232 static const G4double dP=10.; // step 225 static const G4double dP=10.; // step for the LEN (Low ENergy) table MeV/c 233 static const G4double dPG=dP*.001; // step 226 static const G4double dPG=dP*.001; // step for the LEN (Low ENergy) table GeV/c 234 static const G4int nL=105; // A#of 227 static const G4int nL=105; // A#of LEN points in E (step 10 MeV/c) 235 static const G4double Pmin=THmin+(nL-1)*dP; 228 static const G4double Pmin=THmin+(nL-1)*dP; // minP for the HighE part with safety 236 static const G4double Pmax=227000.; // maxP 229 static const G4double Pmax=227000.; // maxP for the HEN (High ENergy) part 227 GeV 237 static const G4int nH=224; // A#of 230 static const G4int nH=224; // A#of HEN points in lnE 238 static const G4double milP=G4Log(Pmin);// Lo << 231 static const G4double milP=std::log(Pmin);// Low logarithm energy for the HEN part 239 static const G4double malP=G4Log(Pmax);// Hi << 232 static const G4double malP=std::log(Pmax);// High logarithm energy (each 2.75 percent) 240 static const G4double dlP=(malP-milP)/(nH-1) 233 static const G4double dlP=(malP-milP)/(nH-1); // Step in log energy in the HEN part 241 static const G4double milPG=G4Log(.001*Pmin) << 234 static const G4double milPG=std::log(.001*Pmin);// Low logarithmEnergy for HEN part GeV/c >> 235 G4double sigma=0.; >> 236 if(F&&I) sigma=0.; // @@ *!* Fake line *!* to use F & I !!!Temporary!!! >> 237 //G4double A=targN+targZ; // A of the target 242 if(F<=0) // This 238 if(F<=0) // This isotope was not the last used isotop 243 { 239 { 244 if(F<0) // This 240 if(F<0) // This isotope was found in DAMDB =-----=> RETRIEVE 245 { 241 { 246 G4int sync=(G4int)LEN->size(); << 242 G4int sync=LEN->size(); 247 if(sync<=I) G4cerr<<"*!*G4QPiMinusNuclCS 243 if(sync<=I) G4cerr<<"*!*G4QPiMinusNuclCS::CalcCrosSect:Sync="<<sync<<"<="<<I<<G4endl; 248 lastLEN=(*LEN)[I]; // Poin 244 lastLEN=(*LEN)[I]; // Pointer to prepared LowEnergy cross sections 249 lastHEN=(*HEN)[I]; // Poin 245 lastHEN=(*HEN)[I]; // Pointer to prepared High Energy cross sections 250 } 246 } 251 else // This 247 else // This isotope wasn't calculated before => CREATE 252 { 248 { 253 lastLEN = new G4double[nL]; // Allo 249 lastLEN = new G4double[nL]; // Allocate memory for the new LEN cross sections 254 lastHEN = new G4double[nH]; // Allo 250 lastHEN = new G4double[nH]; // Allocate memory for the new HEN cross sections 255 // --- Instead of making a separate func 251 // --- Instead of making a separate function --- 256 G4double P=THmiG; // Tabl 252 G4double P=THmiG; // Table threshold in GeV/c 257 for(G4int k=0; k<nL; k++) 253 for(G4int k=0; k<nL; k++) 258 { 254 { 259 lastLEN[k] = CrossSectionLin(targZ, ta 255 lastLEN[k] = CrossSectionLin(targZ, targN, P); 260 P+=dPG; 256 P+=dPG; 261 } 257 } 262 G4double lP=milPG; 258 G4double lP=milPG; 263 for(G4int n=0; n<nH; n++) 259 for(G4int n=0; n<nH; n++) 264 { 260 { 265 lastHEN[n] = CrossSectionLog(targZ, ta 261 lastHEN[n] = CrossSectionLog(targZ, targN, lP); 266 lP+=dlP; 262 lP+=dlP; 267 } 263 } 268 // --- End of possible separate function 264 // --- End of possible separate function 269 // *** The synchronization check *** 265 // *** The synchronization check *** 270 G4int sync=(G4int)LEN->size(); << 266 G4int sync=LEN->size(); 271 if(sync!=I) 267 if(sync!=I) 272 { 268 { 273 G4cerr<<"***G4QPiMinusNuclCS::CalcCros 269 G4cerr<<"***G4QPiMinusNuclCS::CalcCrossSect: Sinc="<<sync<<"#"<<I<<", Z=" <<targZ 274 <<", N="<<targN<<", F="<<F<<G4en 270 <<", N="<<targN<<", F="<<F<<G4endl; 275 //G4Exception("G4PiMinusNuclearCS::Cal 271 //G4Exception("G4PiMinusNuclearCS::CalculateCS:","39",FatalException,"DBoverflow"); 276 } 272 } 277 LEN->push_back(lastLEN); // reme 273 LEN->push_back(lastLEN); // remember the Low Energy Table 278 HEN->push_back(lastHEN); // reme 274 HEN->push_back(lastHEN); // remember the High Energy Table 279 } // End of creation of the new set of par 275 } // End of creation of the new set of parameters 280 } // End of parameters udate 276 } // End of parameters udate 281 // =-------------------= NOW the Magic Formu 277 // =-------------------= NOW the Magic Formula =--------------------= 282 G4double sigma; << 283 if (Momentum<lastTH) return 0.; // It m 278 if (Momentum<lastTH) return 0.; // It must be already checked in the interface class 284 else if (Momentum<Pmin) // High 279 else if (Momentum<Pmin) // High Energy region 285 { 280 { 286 sigma=EquLinearFit(Momentum,nL,THmin,dP,la 281 sigma=EquLinearFit(Momentum,nL,THmin,dP,lastLEN); 287 } 282 } 288 else if (Momentum<Pmax) // High 283 else if (Momentum<Pmax) // High Energy region 289 { 284 { 290 G4double lP=G4Log(Momentum); << 285 G4double lP=std::log(Momentum); 291 sigma=EquLinearFit(lP,nH,milP,dlP,lastHEN) 286 sigma=EquLinearFit(lP,nH,milP,dlP,lastHEN); 292 } 287 } 293 else // UHE 288 else // UHE region (calculation, not frequent) 294 { 289 { 295 G4double P=0.001*Momentum; // Appr 290 G4double P=0.001*Momentum; // Approximation formula is for P in GeV/c 296 sigma=CrossSectionFormula(targZ, targN, P, << 291 sigma=CrossSectionFormula(targZ, targN, P, std::log(P)); 297 } 292 } 298 if(sigma<0.) return 0.; 293 if(sigma<0.) return 0.; 299 return sigma; 294 return sigma; 300 } 295 } 301 296 302 // Calculation formula for piMinus-nuclear ine 297 // Calculation formula for piMinus-nuclear inelastic cross-section (mb) (P in GeV/c) 303 G4double G4ChipsAntiBaryonInelasticXS::CrossSe 298 G4double G4ChipsAntiBaryonInelasticXS::CrossSectionLin(G4int tZ, G4int tN, G4double P) 304 { 299 { 305 G4double lP=G4Log(P); << 300 G4double lP=std::log(P); 306 return CrossSectionFormula(tZ, tN, P, lP); 301 return CrossSectionFormula(tZ, tN, P, lP); 307 } 302 } 308 303 309 // Calculation formula for piMinus-nuclear ine 304 // Calculation formula for piMinus-nuclear inelastic cross-section (mb) log(P in GeV/c) 310 G4double G4ChipsAntiBaryonInelasticXS::CrossSe 305 G4double G4ChipsAntiBaryonInelasticXS::CrossSectionLog(G4int tZ, G4int tN, G4double lP) 311 { 306 { 312 G4double P=G4Exp(lP); << 307 G4double P=std::exp(lP); 313 return CrossSectionFormula(tZ, tN, P, lP); 308 return CrossSectionFormula(tZ, tN, P, lP); 314 } 309 } 315 // Calculation formula for piMinus-nuclear ine 310 // Calculation formula for piMinus-nuclear inelastic cross-section (mb) log(P in GeV/c) 316 G4double G4ChipsAntiBaryonInelasticXS::CrossSe 311 G4double G4ChipsAntiBaryonInelasticXS::CrossSectionFormula(G4int tZ, G4int tN, 317 312 G4double P, G4double lP) 318 { 313 { 319 G4double sigma=0.; 314 G4double sigma=0.; 320 if(tZ==1 && !tN) // A 315 if(tZ==1 && !tN) // AntiBar-Prot interaction from G4QuasiElRatios 321 { 316 { 322 G4double ld=lP-3.5; 317 G4double ld=lP-3.5; 323 G4double ld2=ld*ld; 318 G4double ld2=ld*ld; 324 G4double ye=G4Exp(lP*1.25); << 319 G4double ye=std::exp(lP*1.25); 325 G4double yt=G4Exp(lP*0.35); << 320 G4double yt=std::exp(lP*0.35); 326 G4double El=80./(ye+1.); 321 G4double El=80./(ye+1.); 327 G4double To=(80./yt+.3)/yt; 322 G4double To=(80./yt+.3)/yt; 328 sigma=(To-El)+.2443*ld2+31.48; 323 sigma=(To-El)+.2443*ld2+31.48; 329 } 324 } 330 else if(tZ==1 && tN==1) 325 else if(tZ==1 && tN==1) 331 { 326 { 332 G4double r=lP-3.7; 327 G4double r=lP-3.7; 333 sigma=0.6*r*r+67.+90.*G4Exp(-lP*.666); << 328 sigma=0.6*r*r+67.+90.*std::exp(-lP*.666); 334 } 329 } 335 else if(tZ<97 && tN<152) // G 330 else if(tZ<97 && tN<152) // General solution 336 { 331 { 337 G4double d=lP-4.2; 332 G4double d=lP-4.2; 338 G4double sp=std::sqrt(P); 333 G4double sp=std::sqrt(P); 339 G4double a=tN+tZ; // 334 G4double a=tN+tZ; // A of the target 340 G4double sa=std::sqrt(a); 335 G4double sa=std::sqrt(a); 341 G4double a2=a*a; 336 G4double a2=a*a; 342 G4double a3=a2*a; 337 G4double a3=a2*a; 343 G4double a2s=a2*sa; 338 G4double a2s=a2*sa; 344 G4double c=(170.+3600./a2s)/(1.+65./a2s)+4 << 339 G4double c=(170.+3600./a2s)/(1.+65./a2s)+40.*std::pow(a,0.712)/(1.+12.2/a)/(1.+34./a2); 345 G4double r=(170.+0.01*a3)/(1.+a3/28000.); 340 G4double r=(170.+0.01*a3)/(1.+a3/28000.); 346 sigma=c+d*d+r/sp; 341 sigma=c+d*d+r/sp; 347 } 342 } 348 else 343 else 349 { 344 { 350 G4cerr<<"-Warning-G4QAntiBarNuclearCroSect 345 G4cerr<<"-Warning-G4QAntiBarNuclearCroSect::CSForm:*Bad A* Z="<<tZ<<", N="<<tN<<G4endl; 351 sigma=0.; 346 sigma=0.; 352 } 347 } 353 if(sigma<0.) return 0.; 348 if(sigma<0.) return 0.; 354 return sigma; 349 return sigma; 355 } 350 } 356 351 357 G4double G4ChipsAntiBaryonInelasticXS::EquLine 352 G4double G4ChipsAntiBaryonInelasticXS::EquLinearFit(G4double X, G4int N, G4double X0, G4double DX, G4double* Y) 358 { 353 { 359 if(DX<=0. || N<2) 354 if(DX<=0. || N<2) 360 { 355 { 361 G4cerr<<"***G4ChipsAntiBaryonInelasticXS 356 G4cerr<<"***G4ChipsAntiBaryonInelasticXS::EquLinearFit: DX="<<DX<<", N="<<N<<G4endl; 362 return Y[0]; 357 return Y[0]; 363 } 358 } 364 359 365 G4int N2=N-2; 360 G4int N2=N-2; 366 G4double d=(X-X0)/DX; 361 G4double d=(X-X0)/DX; 367 G4int jj=static_cast<int>(d); << 362 G4int j=static_cast<int>(d); 368 if (jj<0) jj=0; << 363 if (j<0) j=0; 369 else if(jj>N2) jj=N2; << 364 else if(j>N2) j=N2; 370 d-=jj; // excess << 365 d-=j; // excess 371 G4double yi=Y[jj]; << 366 G4double yi=Y[j]; 372 G4double sigma=yi+(Y[jj+1]-yi)*d; << 367 G4double sigma=yi+(Y[j+1]-yi)*d; 373 368 374 return sigma; 369 return sigma; 375 } 370 } 376 371