Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/hadronic/cross_sections/src/G4ChipsKaonMinusInelasticXS.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/hadronic/cross_sections/src/G4ChipsKaonMinusInelasticXS.cc (Version 11.3.0) and /processes/hadronic/cross_sections/src/G4ChipsKaonMinusInelasticXS.cc (Version 10.6.p2)


  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 void
 92 G4ChipsKaonMinusInelasticXS::CrossSectionDescr     92 G4ChipsKaonMinusInelasticXS::CrossSectionDescription(std::ostream& outFile) const
 93 {                                                  93 {
 94     outFile << "G4ChipsKaonMinusInelasticXS pr     94     outFile << "G4ChipsKaonMinusInelasticXS provides the inelastic cross\n"
 95             << "section for K- nucleus scatter     95             << "section for K- nucleus scattering as a function of incident\n"
 96             << "momentum. The cross section is     96             << "momentum. The cross section is calculated using M. Kossov's\n"
 97             << "CHIPS parameterization of cros     97             << "CHIPS parameterization of cross section data.\n";
 98 }                                                  98 }
 99                                                    99 
100 G4bool G4ChipsKaonMinusInelasticXS::IsIsoAppli    100 G4bool G4ChipsKaonMinusInelasticXS::IsIsoApplicable(const G4DynamicParticle*, G4int, G4int,    
101          const G4Element*,                        101          const G4Element*,
102          const G4Material*)                       102          const G4Material*)
103 {                                                 103 {
104   return true;                                    104   return true;
105 }                                                 105 }
106                                                   106 
107                                                   107 
108 // The main member function giving the collisi    108 // 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    109 // Make pMom in independent units ! (Now it is MeV)
110 G4double G4ChipsKaonMinusInelasticXS::GetIsoCr    110 G4double G4ChipsKaonMinusInelasticXS::GetIsoCrossSection(const G4DynamicParticle* Pt, G4int tgZ, G4int A,  
111                const G4Isotope*,                  111                const G4Isotope*,
112                const G4Element*,                  112                const G4Element*,
113                const G4Material*)                 113                const G4Material*)
114 {                                                 114 {
115   G4double pMom=Pt->GetTotalMomentum();           115   G4double pMom=Pt->GetTotalMomentum();
116   G4int tgN = A - tgZ;                            116   G4int tgN = A - tgZ;
117                                                   117   
118   return GetChipsCrossSection(pMom, tgZ, tgN,     118   return GetChipsCrossSection(pMom, tgZ, tgN, -321);
119 }                                                 119 }
120                                                   120 
121 G4double G4ChipsKaonMinusInelasticXS::GetChips    121 G4double G4ChipsKaonMinusInelasticXS::GetChipsCrossSection(G4double pMom, G4int tgZ, G4int tgN, G4int)
122 {                                                 122 {
123   G4bool in=false;                     // By d    123   G4bool in=false;                     // By default the isotope must be found in the AMDB
124   if(tgN!=lastN || tgZ!=lastZ)         // The     124   if(tgN!=lastN || tgZ!=lastZ)         // The nucleus was not the last used isotope
125   {                                               125   {
126     in = false;                        // By d    126     in = false;                        // By default the isotope haven't be found in AMDB  
127     lastP   = 0.;                      // New     127     lastP   = 0.;                      // New momentum history (nothing to compare with)
128     lastN   = tgN;                     // The     128     lastN   = tgN;                     // The last N of the calculated nucleus
129     lastZ   = tgZ;                     // The     129     lastZ   = tgZ;                     // The last Z of the calculated nucleus
130     lastI   = (G4int)colN.size();      // Size << 130     lastI   = colN.size();             // Size of the Associative Memory DB in the heap
131     j  = 0;                            // A#0f    131     j  = 0;                            // A#0f records found in DB for this projectile
132     if(lastI) for(G4int i=0; i<lastI; ++i) //  << 132     if(lastI) for(G4int i=0; i<lastI; i++) // AMDB exists, try to find the (Z,N) isotope
133     {                                             133     {
134       if(colN[i]==tgN && colZ[i]==tgZ) // Try     134       if(colN[i]==tgN && colZ[i]==tgZ) // Try the record "i" in the AMDB
135       {                                           135       {
136         lastI=i;                       // Reme    136         lastI=i;                       // Remember the index for future fast/last use
137         lastTH =colTH[i];              // The     137         lastTH =colTH[i];              // The last THreshold (A-dependent)
138         if(pMom<=lastTH)                          138         if(pMom<=lastTH)
139         {                                         139         {
140           return 0.;                   // Ener    140           return 0.;                   // Energy is below the Threshold value
141         }                                         141         }
142         lastP  =colP [i];              // Last    142         lastP  =colP [i];              // Last Momentum  (A-dependent)
143         lastCS =colCS[i];              // Last    143         lastCS =colCS[i];              // Last CrossSect (A-dependent)
144         in = true;                     // This    144         in = true;                     // This is the case when the isotop is found in DB
145         // Momentum pMom is in IU ! @@ Units      145         // Momentum pMom is in IU ! @@ Units
146         lastCS=CalculateCrossSection(-1,j,-321    146         lastCS=CalculateCrossSection(-1,j,-321,lastZ,lastN,pMom); // read & update
147         if(lastCS<=0. && pMom>lastTH)  // Corr    147         if(lastCS<=0. && pMom>lastTH)  // Correct the threshold (@@ No intermediate Zeros)
148         {                                         148         {
149           lastCS=0.;                              149           lastCS=0.;
150           lastTH=pMom;                            150           lastTH=pMom;
151         }                                         151         }
152         break;                         // Go o    152         break;                         // Go out of the LOOP
153       }                                           153       }
154       j++;                             // Incr    154       j++;                             // Increment a#0f records found in DB
155     }                                             155     }
156     if(!in)                            // This    156     if(!in)                            // This isotope has not been calculated previously
157     {                                             157     {
158       //!!The slave functions must provide cro    158       //!!The slave functions must provide cross-sections in millibarns (mb) !! (not in IU)
159       lastCS=CalculateCrossSection(0,j,-321,la    159       lastCS=CalculateCrossSection(0,j,-321,lastZ,lastN,pMom); //calculate & create
160       //if(lastCS>0.)                   // It     160       //if(lastCS>0.)                   // It means that the AMBD was initialized
161       //{                                         161       //{
162                                                   162 
163       //        lastTH = ThresholdEnergy(tgZ,     163       //        lastTH = ThresholdEnergy(tgZ, tgN); // The Threshold Energy which is now the last
164                                                   164 
165       lastTH = 0; // WP - to be checked!!!        165       lastTH = 0; // WP - to be checked!!!
166         colN.push_back(tgN);                      166         colN.push_back(tgN);
167         colZ.push_back(tgZ);                      167         colZ.push_back(tgZ);
168         colP.push_back(pMom);                     168         colP.push_back(pMom);
169         colTH.push_back(lastTH);                  169         colTH.push_back(lastTH);
170         colCS.push_back(lastCS);                  170         colCS.push_back(lastCS);
171       //} // M.K. Presence of H1 with high thr    171       //} // M.K. Presence of H1 with high threshold breaks the syncronization
172       return lastCS*millibarn;                    172       return lastCS*millibarn;
173     } // End of creation of the new set of par    173     } // End of creation of the new set of parameters
174     else                                          174     else
175     {                                             175     {
176       colP[lastI]=pMom;                           176       colP[lastI]=pMom;
177       colCS[lastI]=lastCS;                        177       colCS[lastI]=lastCS;
178     }                                             178     }
179   } // End of parameters udate                    179   } // End of parameters udate
180   else if(pMom<=lastTH)                           180   else if(pMom<=lastTH)
181   {                                               181   {
182     return 0.;                         // Mome    182     return 0.;                         // Momentum is below the Threshold Value -> CS=0
183   }                                               183   }
184   else                                 // It i    184   else                                 // It is the last used -> use the current tables
185   {                                               185   {
186     lastCS=CalculateCrossSection(1,j,-321,last    186     lastCS=CalculateCrossSection(1,j,-321,lastZ,lastN,pMom); // Only read and UpdateDB
187     lastP=pMom;                                   187     lastP=pMom;
188   }                                               188   }
189   return lastCS*millibarn;                        189   return lastCS*millibarn;
190 }                                                 190 }
191                                                   191 
192 // The main member function giving the gamma-A    192 // The main member function giving the gamma-A cross section (E in GeV, CS in mb)
193 G4double G4ChipsKaonMinusInelasticXS::Calculat    193 G4double G4ChipsKaonMinusInelasticXS::CalculateCrossSection(G4int F, G4int I,
194                                         G4int,    194                                         G4int, G4int targZ, G4int targN, G4double Momentum)
195 {                                                 195 {
                                                   >> 196   G4double sigma=0.;
                                                   >> 197   if(F&&I) sigma=0.;                   // @@ *!* Fake line *!* to use F & I !!!Temporary!!!
                                                   >> 198   //G4double A=targN+targZ;              // A of the target
196   if(F<=0)                             // This    199   if(F<=0)                             // This isotope was not the last used isotop
197   {                                               200   {
198     if(F<0)                            // This    201     if(F<0)                            // This isotope was found in DAMDB =-----=> RETRIEVE
199     {                                             202     {
200       G4int sync=(G4int)LEN->size();           << 203       G4int sync=LEN->size();
201       if(sync<=I) G4cerr<<"*!*G4QPiMinusNuclCS    204       if(sync<=I) G4cerr<<"*!*G4QPiMinusNuclCS::CalcCrosSect:Sync="<<sync<<"<="<<I<<G4endl;
202       lastLEN=(*LEN)[I];                // Poi    205       lastLEN=(*LEN)[I];                // Pointer to prepared LowEnergy cross sections
203       lastHEN=(*HEN)[I];                // Poi    206       lastHEN=(*HEN)[I];                // Pointer to prepared High Energy cross sections
204     }                                             207     }
205     else                               // This    208     else                               // This isotope wasn't calculated before => CREATE
206     {                                             209     {
207       lastLEN = new G4double[nL];      // Allo    210       lastLEN = new G4double[nL];      // Allocate memory for the new LEN cross sections
208       lastHEN = new G4double[nH];      // Allo    211       lastHEN = new G4double[nH];      // Allocate memory for the new HEN cross sections
209       // --- Instead of making a separate func    212       // --- Instead of making a separate function ---
210       G4double P=THmiG;                // Tabl    213       G4double P=THmiG;                // Table threshold in GeV/c
211       for(G4int k=0; k<nL; k++)                   214       for(G4int k=0; k<nL; k++)
212       {                                           215       {
213         lastLEN[k] = CrossSectionLin(targZ, ta    216         lastLEN[k] = CrossSectionLin(targZ, targN, P);
214         P+=dPG;                                   217         P+=dPG;
215       }                                           218       }
216       G4double lP=milPG;                          219       G4double lP=milPG;
217       for(G4int n=0; n<nH; n++)                   220       for(G4int n=0; n<nH; n++)
218       {                                           221       {
219         lastHEN[n] = CrossSectionLog(targZ, ta    222         lastHEN[n] = CrossSectionLog(targZ, targN, lP);
220         lP+=dlP;                                  223         lP+=dlP;
221       }                                           224       }
222       // --- End of possible separate function    225       // --- End of possible separate function
223       // *** The synchronization check ***        226       // *** The synchronization check ***
224       G4int sync=(G4int)LEN->size();           << 227       G4int sync=LEN->size();
225       if(sync!=I)                                 228       if(sync!=I)
226       {                                           229       {
227         G4cerr<<"***G4ChipsKaonMinusCS::CalcCr    230         G4cerr<<"***G4ChipsKaonMinusCS::CalcCrossSect: Sinc="<<sync<<"#"<<I<<", Z=" <<targZ
228               <<", N="<<targN<<", F="<<F<<G4en    231               <<", N="<<targN<<", F="<<F<<G4endl;
229         //G4Exception("G4PiMinusNuclearCS::Cal    232         //G4Exception("G4PiMinusNuclearCS::CalculateCS:","39",FatalException,"DBoverflow");
230       }                                           233       }
231       LEN->push_back(lastLEN);         // reme    234       LEN->push_back(lastLEN);         // remember the Low Energy Table
232       HEN->push_back(lastHEN);         // reme    235       HEN->push_back(lastHEN);         // remember the High Energy Table
233     } // End of creation of the new set of par    236     } // End of creation of the new set of parameters
234   } // End of parameters update                << 237   } // End of parameters udate
235   // =------------------= NOW the Magic Formul    238   // =------------------= NOW the Magic Formula =--------------------------=
236   G4double sigma;                              << 
237   if (Momentum<lastTH) return 0.;      // It m    239   if (Momentum<lastTH) return 0.;      // It must be already checked in the interface class
238   else if (Momentum<Pmin)              // High    240   else if (Momentum<Pmin)              // High Energy region
239   {                                               241   {
240     sigma=EquLinearFit(Momentum,nL,THmin,dP,la    242     sigma=EquLinearFit(Momentum,nL,THmin,dP,lastLEN);
241   }                                               243   }
242   else if (Momentum<Pmax)              // High    244   else if (Momentum<Pmax)              // High Energy region
243   {                                               245   {
244     G4double lP=std::log(Momentum);               246     G4double lP=std::log(Momentum);
245     sigma=EquLinearFit(lP,nH,milP,dlP,lastHEN)    247     sigma=EquLinearFit(lP,nH,milP,dlP,lastHEN);
246   }                                               248   }
247   else                                 // UHE     249   else                                 // UHE region (calculation, not frequent)
248   {                                               250   {
249     G4double P=0.001*Momentum;         // Appr    251     G4double P=0.001*Momentum;         // Approximation formula is for P in GeV/c
250     sigma=CrossSectionFormula(targZ, targN, P,    252     sigma=CrossSectionFormula(targZ, targN, P, std::log(P));
251   }                                               253   }
252   if(sigma<0.) return 0.;                         254   if(sigma<0.) return 0.;
253   return sigma;                                   255   return sigma;
254 }                                                 256 }
255                                                   257 
256 // Calculation formula for piMinus-nuclear ine    258 // Calculation formula for piMinus-nuclear inelastic cross-section (mb) (P in GeV/c)
257 G4double G4ChipsKaonMinusInelasticXS::CrossSec    259 G4double G4ChipsKaonMinusInelasticXS::CrossSectionLin(G4int tZ, G4int tN, G4double P)
258 {                                                 260 {
259   G4double lP=std::log(P);                        261   G4double lP=std::log(P);
260   return CrossSectionFormula(tZ, tN, P, lP);      262   return CrossSectionFormula(tZ, tN, P, lP);
261 }                                                 263 }
262                                                   264 
263 // Calculation formula for piMinus-nuclear ine    265 // Calculation formula for piMinus-nuclear inelastic cross-section (mb) log(P in GeV/c)
264 G4double G4ChipsKaonMinusInelasticXS::CrossSec    266 G4double G4ChipsKaonMinusInelasticXS::CrossSectionLog(G4int tZ, G4int tN, G4double lP)
265 {                                                 267 {
266   G4double P=std::exp(lP);                        268   G4double P=std::exp(lP);
267   return CrossSectionFormula(tZ, tN, P, lP);      269   return CrossSectionFormula(tZ, tN, P, lP);
268 }                                                 270 }
269 // Calculation formula for piMinus-nuclear ine    271 // Calculation formula for piMinus-nuclear inelastic cross-section (mb) log(P in GeV/c)
270 G4double G4ChipsKaonMinusInelasticXS::CrossSec    272 G4double G4ChipsKaonMinusInelasticXS::CrossSectionFormula(G4int tZ, G4int tN,
271                                                   273                                                               G4double P, G4double lP)
272 {                                                 274 {
273   G4double sigma=0.;                              275   G4double sigma=0.;
274   if(tZ==1 && !tN)                        // P    276   if(tZ==1 && !tN)                        // PiMin-Proton interaction from G4QuasiElRatios
275   {                                               277   {
276     G4double ld=lP-3.5;                           278     G4double ld=lP-3.5;
277     G4double ld2=ld*ld;                           279     G4double ld2=ld*ld;
278     G4double p2=P*P;                              280     G4double p2=P*P;
279     G4double p4=p2*p2;                            281     G4double p4=p2*p2;
280     G4double sp=std::sqrt(P);                     282     G4double sp=std::sqrt(P);
281     G4double psp=P*sp;                            283     G4double psp=P*sp;
282     G4double lm=P-.39;                            284     G4double lm=P-.39;
283     G4double md=lm*lm+.000156;                    285     G4double md=lm*lm+.000156;
284     G4double lh=P-1.;                             286     G4double lh=P-1.;
285     G4double hd=lh*lh+.0156;                      287     G4double hd=lh*lh+.0156;
286     G4double El=(.0557*ld2+2.23)/(1.-.7/sp+.07    288     G4double El=(.0557*ld2+2.23)/(1.-.7/sp+.075/p4);
287     G4double To=(.3*ld2+19.5)/(1.-.21/sp+.52/p    289     G4double To=(.3*ld2+19.5)/(1.-.21/sp+.52/p4);
288     sigma=8.8/psp+(To-El)+.002/md+.15/hd;         290     sigma=8.8/psp+(To-El)+.002/md+.15/hd;
289   }                                               291   }
290   else if(tZ==1 && tN==1)                  //     292   else if(tZ==1 && tN==1)                  // kmp_tot
291   {                                               293   {
292     G4double p2=P*P;                              294     G4double p2=P*P;
293     G4double dX=lP-3.7;                           295     G4double dX=lP-3.7;
294     G4double dR=P-.94;                            296     G4double dR=P-.94;
295     G4double sp=std::sqrt(P);                     297     G4double sp=std::sqrt(P);
296     sigma=(.6*dX*dX+36.)/(1.-.11/sp+.52/p2/p2)    298     sigma=(.6*dX*dX+36.)/(1.-.11/sp+.52/p2/p2)+.7/(dR*dR+.0256)+18./P/sp;
297   }                                               299   }
298   else if(tZ<97 && tN<152)                // G    300   else if(tZ<97 && tN<152)                // General solution
299   {                                               301   {
300     G4double d=lP-4.2;                            302     G4double d=lP-4.2;
301     G4double sp=std::sqrt(P);                     303     G4double sp=std::sqrt(P);
302     G4double p2=P*P;                              304     G4double p2=P*P;
303     G4double a=tN+tZ;                       //    305     G4double a=tN+tZ;                       // A of the target
304     G4double sa=std::sqrt(a);                     306     G4double sa=std::sqrt(a);
305     G4double al=std::log(a);                      307     G4double al=std::log(a);
306     G4double a2=a*a;                              308     G4double a2=a*a;
307     G4double c=52.*std::exp(al*0.6)*(1.+97./a2    309     G4double c=52.*std::exp(al*0.6)*(1.+97./a2)/(1.+9.8/a)/(1.+47./a2);
308     G4double gg=-.2-.003*a;                       310     G4double gg=-.2-.003*a;
309     G4double h=.5+.07*a;                          311     G4double h=.5+.07*a;
310     G4double v=P-1.;                              312     G4double v=P-1.;
311     G4double f=.6*a*sa/(1.+.00002*a2);            313     G4double f=.6*a*sa/(1.+.00002*a2);
312     G4double u=.125+.127*al;                      314     G4double u=.125+.127*al;
313     sigma=(c+d*d)/(1.+gg/sp+h/p2/p2)+f/(v*v+u*    315     sigma=(c+d*d)/(1.+gg/sp+h/p2/p2)+f/(v*v+u*u)+20.*sa/P/sp;
314   }                                               316   }
315   else                                            317   else
316   {                                               318   {
317     G4cerr<<"-Warning-G4ChipsKMinusNuclearCroS    319     G4cerr<<"-Warning-G4ChipsKMinusNuclearCroSect::CSForm:*Bad A* Z="<<tZ<<", N="<<tN<<G4endl;
318     sigma=0.;                                     320     sigma=0.;
319   }                                               321   }
320   if(sigma<0.) return 0.;                         322   if(sigma<0.) return 0.;
321   return sigma;                                   323   return sigma;  
322 }                                                 324 }
323                                                   325 
324 G4double G4ChipsKaonMinusInelasticXS::EquLinea    326 G4double G4ChipsKaonMinusInelasticXS::EquLinearFit(G4double X, G4int N, G4double X0, G4double DX, G4double* Y)
325 {                                                 327 {
326   if(DX<=0. || N<2)                               328   if(DX<=0. || N<2)
327     {                                             329     {
328       G4cerr<<"***G4ChipsKaonMinusInelasticXS:    330       G4cerr<<"***G4ChipsKaonMinusInelasticXS::EquLinearFit: DX="<<DX<<", N="<<N<<G4endl;
329       return Y[0];                                331       return Y[0];
330     }                                             332     }
331                                                   333   
332   G4int    N2=N-2;                                334   G4int    N2=N-2;
333   G4double d=(X-X0)/DX;                           335   G4double d=(X-X0)/DX;
334   G4int         jj=static_cast<int>(d);           336   G4int         jj=static_cast<int>(d);
335   if     (jj<0)  jj=0;                            337   if     (jj<0)  jj=0;
336   else if(jj>N2) jj=N2;                           338   else if(jj>N2) jj=N2;
337   d-=jj; // excess                                339   d-=jj; // excess
338   G4double yi=Y[jj];                              340   G4double yi=Y[jj];
339   G4double sigma=yi+(Y[jj+1]-yi)*d;               341   G4double sigma=yi+(Y[jj+1]-yi)*d;
340                                                   342   
341   return sigma;                                   343   return sigma;
342 }                                                 344 }
343                                                   345