source: trunk/source/processes/hadronic/models/chiral_inv_phase_space/interface/src/G4QNeutronNuclearCrossSection.cc @ 819

Last change on this file since 819 was 819, checked in by garnier, 16 years ago

import all except CVS

File size: 17.9 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26//
27// The lust update: M.V. Kossov, CERN/ITEP(Moscow) 17-June-02
28// GEANT4 tag $Name: geant4-09-01-patch-02 $
29//
30//
31// G4 Physics class: G4QNeutronNuclearCrossSection for gamma+A cross sections
32// @@ A preliminary temporary class identical to G4QProtonNuclearCS. Must be improved. @@
33// Created: M.V. Kossov, CERN/ITEP(Moscow), 20-Dec-03
34// The last update: M.V. Kossov, CERN/ITEP (Moscow) 15-Feb-04
35// --------------------------------------------------------------------------------
36// ****************************************************************************************
37// ****** This CLASS is a property of the CHIPS hadronic package in Geant4 (M. Kosov) *****
38// *********** DO NOT MAKE ANY CHANGE without approval of Mikhail.Kossov@cern.ch **********
39// ****************************************************************************************
40//
41//#define debug
42//#define pdebug
43//#define debug3
44//#define debugn
45//#define debugs
46
47#include "G4QNeutronNuclearCrossSection.hh"
48
49// Initialization of the
50G4double* G4QNeutronNuclearCrossSection::lastLEN=0; // Pointer to the lastArray of LowEn CS
51G4double* G4QNeutronNuclearCrossSection::lastHEN=0; // Pointer to the lastArray of HighEn CS
52G4int     G4QNeutronNuclearCrossSection::lastN=0;   // The last N of calculated nucleus
53G4int     G4QNeutronNuclearCrossSection::lastZ=0;   // The last Z of calculated nucleus
54G4double  G4QNeutronNuclearCrossSection::lastP=0.;  // Last used in cross section Momentum
55G4double  G4QNeutronNuclearCrossSection::lastTH=0.; // Last threshold momentum
56G4double  G4QNeutronNuclearCrossSection::lastCS=0.; // Last value of the Cross Section
57G4int     G4QNeutronNuclearCrossSection::lastI=0;   // The last position in the DAMDB
58
59// Returns Pointer to the G4VQCrossSection class
60G4VQCrossSection* G4QNeutronNuclearCrossSection::GetPointer()
61{
62  static G4QNeutronNuclearCrossSection theCrossSection; //**Static body of Cross Section**
63  return &theCrossSection;
64}
65
66// The main member function giving the collision cross section (P is in IU, CS is in mb)
67// Make pMom in independent units ! (Now it is MeV)
68G4double G4QNeutronNuclearCrossSection::GetCrossSection(G4bool fCS, G4double pMom,
69                                                       G4int tgZ, G4int tgN, G4int)
70{
71  static G4int j;                      // A#0f records found in DB for this projectile
72  static std::vector <G4int>    colN;  // Vector of N for calculated nuclei (isotops)
73  static std::vector <G4int>    colZ;  // Vector of Z for calculated nuclei (isotops)
74  static std::vector <G4double> colP;  // Vector of last momenta for the reaction
75  static std::vector <G4double> colTH; // Vector of energy thresholds for the reaction
76  static std::vector <G4double> colCS; // Vector of last cross sections for the reaction
77  // ***---*** End of the mandatory Static Definitions of the Associative Memory ***---***
78  G4double pEn=pMom;
79#ifdef pdebug
80  G4cout<<"G4QNtCS::GetCS:>>> f="<<fCS<<", p="<<pMom<<", Z="<<tgZ<<"("<<lastZ<<") ,N="<<tgN
81        <<"("<<lastN<<"),PDG=2212, P="<<pEn<<"("<<lastTH<<")"<<",Sz="<<colN.size()<<G4endl;
82#endif
83  G4bool in=false;                     // By default the isotope must be found in the AMDB
84  if(tgN!=lastN || tgZ!=lastZ)         // The nucleus was not the last used isotope
85  {
86    in = false;                        // By default the isotope haven't be found in AMDB 
87    lastP   = 0.;                      // New momentum history (nothing to compare with)
88    lastN   = tgN;                     // The last N of the calculated nucleus
89    lastZ   = tgZ;                     // The last Z of the calculated nucleus
90    lastI   = colN.size();             // Size of the Associative Memory DB in the heap
91    j  = 0;                            // A#0f records found in DB for this projectile
92    if(lastI) for(G4int i=0; i<lastI; i++) // The partType is found
93           {                                  // The nucleus with is found in AMDB
94      if(colN[i]==tgN && colZ[i]==tgZ)
95                                                {
96        lastI=i;
97        lastTH =colTH[i];                // Last THreshold (A-dependent)
98#ifdef pdebug
99        G4cout<<"G4QNtCS::GetCS:*Found* P="<<pMom<<",Threshold="<<lastTH<<",j="<<j<<G4endl;
100#endif
101        if(pEn<=lastTH)
102        {
103#ifdef pdebug
104          G4cout<<"G4QNtCS::GetCS:Found T="<<pEn<<" < Threshold="<<lastTH<<",CS=0"<<G4endl;
105#endif
106          return 0.;                     // Energy is below the Threshold value
107        }
108        lastP  =colP [i];                // Last Momentum  (A-dependent)
109        lastCS =colCS[i];                // Last CrossSect (A-dependent)
110        //        if(std::fabs(lastP/pMom-1.)<tolerance)
111        if(lastP==pMom)                 // VI do not use tolerance
112        {
113#ifdef pdebug
114          G4cout<<"G4QNeutronNuclCS::GetCS:P="<<pMom<<",CS="<<lastCS*millibarn<<G4endl;
115#endif
116          CalculateCrossSection(fCS,-1,j,2212,lastZ,lastN,pMom); // Update param's only
117          return lastCS*millibarn;     // Use theLastCS
118        }
119        in = true;                       // This is the case when the isotop is found in DB
120        // Momentum pMom is in IU ! @@ Units
121#ifdef pdebug
122        G4cout<<"G4QNtCS::G:UpdatDB P="<<pMom<<",f="<<fCS<<",lI="<<lastI<<",j="<<j<<G4endl;
123#endif
124        lastCS=CalculateCrossSection(fCS,-1,j,2212,lastZ,lastN,pMom); // read & update
125#ifdef pdebug
126        G4cout<<"G4QNeutronCS::GetCrosSec:*****>New (inDB) Calculated CS="<<lastCS<<G4endl;
127#endif
128        if(lastCS<=0. && pEn>lastTH)    // Correct the threshold
129        {
130#ifdef pdebug
131          G4cout<<"G4QNtCS::GetCS: New T="<<pEn<<"(CS=0) > Threshold="<<lastTH<<G4endl;
132#endif
133          lastTH=pEn;
134        }
135        break;                           // Go out of the LOOP
136      }
137#ifdef pdebug
138      G4cout<<"-->G4QNeutronNuclearCrossSec::GetCrosSec: pPDG=2212, j="<<j<<", N="<<colN[i]
139            <<",Z["<<i<<"]="<<colZ[i]<<G4endl;
140#endif
141      j++;                             // Increment a#0f records found in DB
142           }
143           if(!in)                            // This nucleus has not been calculated previously
144           {
145#ifdef pdebug
146      G4cout<<"G4QNtCS::GetCrosSec:CalcNew P="<<pMom<<",f="<<fCS<<",lastI="<<lastI<<G4endl;
147#endif
148      //!!The slave functions must provide cross-sections in millibarns (mb) !! (not in IU)
149      lastCS=CalculateCrossSection(fCS,0,j,2212,lastZ,lastN,pMom); //calculate & create
150      if(lastCS<=0.)
151                                                {
152        lastTH = ThresholdEnergy(tgZ, tgN); // The Threshold Energy which is now the last
153#ifdef pdebug
154        G4cout<<"G4QNeutronNuclCSec::GetCrossSect: NewThresh="<<lastTH<<",T="<<pEn<<G4endl;
155#endif
156        if(pEn>lastTH)
157        {
158#ifdef pdebug
159          G4cout<<"G4QNeutCS::GetCS: First T="<<pEn<<"(CS=0) > Threshold="<<lastTH<<G4endl;
160#endif
161          lastTH=pEn;
162        }
163                                                }
164#ifdef pdebug
165      G4cout<<"G4QNtCS::GetCrosSec: New CS="<<lastCS<<",lZ="<<lastN<<",lN="<<lastZ<<G4endl;
166#endif
167      colN.push_back(tgN);
168      colZ.push_back(tgZ);
169      colP.push_back(pMom);
170      colTH.push_back(lastTH);
171      colCS.push_back(lastCS);
172#ifdef pdebug
173      G4cout<<"G4QNtCS::GetCS:1st,P="<<pMom<<"(MeV),CS="<<lastCS*millibarn<<"(mb)"<<G4endl;
174#endif
175      return lastCS*millibarn;
176           } // End of creation of the new set of parameters
177    else
178                                {
179#ifdef pdebug
180      G4cout<<"G4QNeutronNuclearCrossSect::GetCS: Update lastI="<<lastI<<",j="<<j<<G4endl;
181#endif
182      colP[lastI]=pMom;
183      colCS[lastI]=lastCS;
184    }
185  } // End of parameters udate
186  else if(pEn<=lastTH)
187  {
188#ifdef pdebug
189    G4cout<<"G4QNeutCS::GetCS: Current T="<<pEn<<" < Threshold="<<lastTH<<", CS=0"<<G4endl;
190#endif
191    return 0.;                         // Momentum is below the Threshold Value -> CS=0
192  }
193  //  else if(std::fabs(lastP/pMom-1.)<tolerance)
194  else if(lastP==pMom)                 // do not use tolerance
195  {
196#ifdef pdebug
197    G4cout<<"G4QNtCS::GetCS:OldCur P="<<pMom<<"="<<pMom<<", CS="<<lastCS*millibarn<<G4endl;
198#endif
199    return lastCS*millibarn;     // Use theLastCS
200  }
201  else
202  {
203#ifdef pdebug
204    G4cout<<"G4QNtCS::GetCS:UpdatCur P="<<pMom<<",f="<<fCS<<",I="<<lastI<<",j="<<j<<G4endl;
205#endif
206    lastCS=CalculateCrossSection(fCS,1,j,2212,lastZ,lastN,pMom); // Only UpdateDB
207    lastP=pMom;
208  }
209#ifdef pdebug
210  G4cout<<"G4QNtCS::GetCroSec:End,P="<<pMom<<"(MeV),CS="<<lastCS*millibarn<<"(mb)"<<G4endl;
211#endif
212  return lastCS*millibarn;
213}
214
215// The main member function giving the gamma-A cross section (E in GeV, CS in mb)
216G4double G4QNeutronNuclearCrossSection::CalculateCrossSection(G4bool, G4int F, G4int I,
217                                        G4int, G4int targZ, G4int targN, G4double Momentum)
218{
219  static const G4double THmin=27.;     // minimum Momentum (MeV/c) Threshold
220  static const G4double THmiG=THmin*.001; // minimum Momentum (GeV/c) Threshold
221  static const G4double dP=10.;        // step for the LEN (Low ENergy) table MeV/c
222  static const G4double dPG=dP*.001;   // step for the LEN (Low ENergy) table GeV/c
223  static const G4int    nL=105;        // A#of LEN points in E (step 10 MeV/c)
224  static const G4double Pmin=THmin+(nL-1)*dP; // minP for the HighE part with safety
225  static const G4double Pmax=227000.;  // maxP for the HEN (High ENergy) part 227 GeV
226  static const G4int    nH=224;        // A#of HEN points in lnE
227  static const G4double milP=std::log(Pmin);// Low logarithm energy for the HEN part
228  static const G4double malP=std::log(Pmax);// High logarithm energy (each 2.75 percent)
229  static const G4double dlP=(malP-milP)/(nH-1); // Step in log energy in the HEN part
230  static const G4double milPG=std::log(.001*Pmin);// Low logarithm energy for the HEN part GeV/c
231  //
232  // Associative memory for acceleration
233  //static std::vector <G4double>  spA;  // shadowing coefficients (A-dependent)
234  static std::vector <G4double*> LEN;  // Vector of pointers to LowEnProtonCrossSection
235  static std::vector <G4double*> HEN;  // Vector of pointers to HighEnProtonCrossSection
236#ifdef debug
237  G4cout<<"G4QNeutronNuclearCS::CalcCS: N="<<targN<<",Z="<<targZ<<",P="<<Momentum<<G4endl;
238#endif
239  if (Momentum<THmin) return 0.;       // @@ This can be dangerouse for the heaviest nuc.!
240  G4double sigma=0.;
241  if(F&&I) sigma=0.;                   // @@ *!* Fake line *!* to use F & I !!!Temporary!!!
242  G4double A=targN+targZ;              // A of the target
243  if(F<=0)                           // This isotope was not the last used isotop
244  {
245    if(F<0)                          // This isotope was found in DAMDB =========> RETRIEVE
246                                {
247      lastLEN=LEN[I];                // Pointer to prepared LowEnergy cross sections
248      lastHEN=HEN[I];                // Pointer to prepared High Energy cross sections
249    }
250           else                             // This isotope wasn't calculated previously => CREATE
251           {
252      lastLEN = new G4double[nL];    // Allocate memory for the new LEN cross sections
253      lastHEN = new G4double[nH];    // Allocate memory for the new HEN cross sections
254      // --- Instead of making a separate function ---
255      G4double P=THmiG;              // Table threshold in GeV/c
256      for(G4int m=0; m<nL; m++)
257      {
258        lastLEN[m] = CrossSectionLin(targZ, targN, P);
259        P+=dPG;
260      }
261      G4double lP=milPG;
262      for(G4int n=0; n<nH; n++)
263      {
264        lastHEN[n] = CrossSectionLog(targZ, targN, lP);
265        lP+=dlP;
266      }
267      // --- End of possible separate function
268      // *** The synchronization check ***
269      G4int sync=LEN.size();
270      if(sync!=I) G4cerr<<"***G4QNeutronNuclCS::CalcCrossSect:Sync="<<sync<<"#"<<I<<G4endl;
271      LEN.push_back(lastLEN);          // added LEN, found by AH 10/7/02
272      HEN.push_back(lastHEN);          // added HEN, found by AH 10/7/02
273           } // End of creation of the new set of parameters
274  } // End of parameters udate
275  // ============================== NOW the Magic Formula =================================
276  if (Momentum<lastTH) return 0.;      // It must be already checked in the interface class
277  else if (Momentum<Pmin)                     // High Energy region
278  {
279#ifdef debug
280           G4cout<<"G4QNeutCS::CalcCS:bLEN A="<<A<<", nL="<<nL<<",TH="<<THmin<<",dP="<<dP<<G4endl;
281#endif
282    if(A<=1.) sigma=0.;
283    else      sigma=EquLinearFit(Momentum,nL,THmin,dP,lastLEN);
284#ifdef debugn
285           if(sigma<0.)
286      G4cout<<"G4QNeutCS::CalcCS:A="<<A<<",E="<<Momentum<<",T="<<THmin<<",dP="<<dP<<G4endl;
287#endif
288  }
289  else if (Momentum<Pmax)                     // High Energy region
290  {
291    G4double lP=std::log(Momentum);
292#ifdef debug
293    G4cout<<"G4QNeutNucCS::CalcCS: before HEN nH="<<nH<<",iE="<<milP<<",dlP="<<dlP<<G4endl;
294#endif
295    sigma=EquLinearFit(lP,nH,milP,dlP,lastHEN);
296  }
297  else                                      // UHE region (calculation, not frequent)
298  {
299    G4double P=0.001*Momentum;              // Approximation formula is for P in GeV/c
300    sigma=CrossSectionFormula(targZ, targN, P, std::log(P));
301  }
302#ifdef debug
303  G4cout<<"G4QNeutronNuclearCrossSection::CalcCS: sigma="<<sigma<<G4endl;
304#endif
305  if(sigma<0.) return 0.;
306  return sigma;
307}
308
309// Electromagnetic momentum-threshold (in MeV/c)
310G4double G4QNeutronNuclearCrossSection::ThresholdMomentum(G4int tZ, G4int tN)
311{
312  static const G4double third=1./3.;
313  static const G4double pM = G4QPDGCode(2212).GetMass(); // Proton mass in MeV
314  static const G4double tpM= pM+pM;       // Doubled proton mass (MeV)
315  G4double tA=tZ+tN;
316  if(tZ<.99 || tN<0.) return 0.;
317  //G4double dE=1.263*tZ/(1.+std::pow(tA,third));
318  G4double dE=tZ/(1.+std::pow(tA,third)); // Safety for diffused edge of the nucleus (QE)
319  return std::sqrt(dE*(tpM+dE));
320}
321
322// Calculation formula for proton-nuclear inelastic cross-section (mb) (P in GeV/c)
323G4double G4QNeutronNuclearCrossSection::CrossSectionLin(G4int tZ, G4int tN, G4double P)
324{
325  G4double sigma=0.;
326  if(P<ThresholdMomentum(tZ,tN)*.001) return sigma;
327  G4double lP=std::log(P);
328  if(tZ==1&&!tN){if(P>.35) sigma=CrossSectionFormula(tZ,tN,P,lP);}// s(pp)=0 below 350Mev/c
329  else if(tZ<93 && tN<239)                // General solution
330  {
331    G4double pex=0.;
332    G4double pos=0.;
333    G4double wid=1.;
334    if(tZ==13 && tN==14)                  // Excited metastable states
335    {
336      pex=230.;
337      pos=.13;
338      wid=8.e-5;
339    }
340    else if(tZ<7)
341    {
342      if(tZ==6 && tN==6)
343      {
344        pex=320.;
345        pos=.14;
346        wid=7.e-6;
347      }
348      else if(tZ==4 && tN==5)
349      {
350        pex=600.;
351        pos=.132;
352        wid=.005;
353      }
354      else if(tZ==3 && tN==4)
355      {
356        pex=280.;
357        pos=.19;
358        wid=.0025;
359      }
360      else if(tZ==3 && tN==3)
361      {
362        pex=370.;
363        pos=.171;
364        wid=.006;
365      }
366      else if(tZ==2 && tN==1)
367      {
368        pex=30.;
369        pos=.22;
370        wid=.0005;
371      }
372    }
373    sigma=CrossSectionFormula(tZ,tN,P,lP);
374    if(pex>0.)
375    {
376      G4double dp=P-pos;
377      sigma+=pex*std::exp(dp*dp/wid);
378    }
379  }
380  else
381  {
382    G4cerr<<"-Warning-G4QNeutronNuclearCrosSect::CSLin:*Bad A* Z="<<tZ<<", N="<<tN<<G4endl;
383    sigma=0.;
384  }
385  if(sigma<0.) return 0.;
386  return sigma; 
387}
388
389// Calculation formula for proton-nuclear inelastic cross-section (mb) log(P in GeV/c)
390G4double G4QNeutronNuclearCrossSection::CrossSectionLog(G4int tZ, G4int tN, G4double lP)
391{
392  G4double P=std::exp(lP);
393  return CrossSectionFormula(tZ, tN, P, lP);
394}
395// Calculation formula for proton-nuclear inelastic cross-section (mb) log(P in GeV/c)
396G4double G4QNeutronNuclearCrossSection::CrossSectionFormula(G4int tZ, G4int tN,
397                                                           G4double P, G4double lP)
398{
399  G4double sigma=0.;
400  if(tZ==1 && !tN)                        // np=pp interaction
401  {
402    G4double sp=std::sqrt(P);
403    G4double ds=lP-4.2;
404    G4double dp=P-.35;
405    G4double d3=dp*dp*dp;
406    sigma=(33.+.2*ds*ds)/(1.+.4/sp)/(1.+.5/d3/d3);
407  }
408  else if(tZ<93 && tN<146)                // General solution
409  {
410    G4double lP=std::log(P);
411    G4double d=lP-4.2;
412    G4double p2=P*P;
413    G4double p4=p2*p2;
414    G4double a=tN+tZ;                       // A of the target
415    G4double al=std::log(a);
416    G4double a2=a*a;
417    G4double a4=a2*a2;
418    G4double a8=a4*a4;
419    G4double a12=a8*a4;
420    G4double a16=a8*a8;
421    G4double c=170./(1.+5./std::exp(al*1.6));
422    G4double dl=al-2.8;
423    G4double r=.3+.2*dl*dl;
424    G4double g=40.*std::exp(al*0.712)/(1.+12.2/a)/(1.+34./a2);
425    G4double e=318.+a4/(1.+.0015*a4/std::exp(al*0.09))/(1.+4.e-28*a12)+
426               8.e-18/(1./a16+1.3e-20)/(1.+1.e-21*a12);
427    G4double s=3.57+.009*a2/(1.+.0001*a2*a);
428    G4double h=(.01/a4+2.5e-6/a)*(1.+7.e-8*a4)/(1.+6.e7/a12/a2);
429    sigma=(c+d*d)/(1.+r/p4)+(g+e*std::exp(-s*P))/(1.+h/p4/p4);
430  }
431  else
432  {
433    G4cerr<<"-Warning-G4QNeutronNuclearCroSect::CSForm:*Bad A* Z="<<tZ<<", N="<<tN<<G4endl;
434    sigma=0.;
435  }
436  if(sigma<0.) return 0.;
437  return sigma; 
438}
Note: See TracBrowser for help on using the repository browser.