// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // // $Id: G4QuasiFreeRatios.cc,v 1.19 2008/03/21 21:44:39 dennis Exp $ // GEANT4 tag $Name: geant4-09-02-ref-02 $ // // // G4 Physics class: G4QuasiFreeRatios for N+A elastic cross sections // Created: M.V. Kossov, CERN/ITEP(Moscow), 10-OCT-01 // The last update: M.V. Kossov, CERN/ITEP (Moscow) 15-Oct-06 // //================================================================================ //#define debug //#define pdebug //#define ppdebug //#define nandebug #include "G4QuasiFreeRatios.hh" // initialisation of statics std::vector G4QuasiFreeRatios::vT; // Vector of pointers to LinTable in C++ heap std::vector G4QuasiFreeRatios::vL; // Vector of pointers to LogTable in C++ heap std::vector*> G4QuasiFreeRatios::vX; // ETPointers to LogTable G4QuasiFreeRatios::G4QuasiFreeRatios() { #ifdef pdebug G4cout<<"***^^^*** G4QuasiFreeRatios singletone is created ***^^^***"<::iterator pos; for(pos=vT.begin(); pos*>::iterator pos2; for(pos2=vX.begin(); pos2 G4QuasiFreeRatios::GetRatios(G4double pIU, G4int pPDG, G4int tgZ, G4int tgN) { std::pair ElTot=GetElTot(pIU, pPDG, tgZ, tgN); // mean hN El&Tot(IU) G4double R=0.; G4double QF2In=1.; // Prototype of QuasiFree/Inelastic ratio for hN_tot if(ElTot.second>0.) { R=ElTot.first/ElTot.second; // Elastic/Total ratio (does not depend on units QF2In=GetQF2IN_Ratio(ElTot.second/millibarn, tgZ+tgN); // QuasiFree/Inelastic ratio } return std::make_pair(QF2In,R); } // Calculatio QasiFree/Inelastic Ratio as a function of total hN cross-section (mb) and A G4double G4QuasiFreeRatios::GetQF2IN_Ratio(G4double s, G4int A) { static const G4int nps=150; // Number of steps in the R(s) LinTable static const G4int mps=nps+1; // Number of elements in the R(s) LinTable static const G4double sma=150.; // The first LinTabEl(s=0)=1., s>sma -> logTab static const G4double ds=sma/nps; // Step of the linear Table static const G4int nls=100; // Number of steps in the R(lns) logTable static const G4int mls=nls+1; // Number of elements in the R(lns) logTable static const G4double lsi=5.; // The min ln(s) logTabEl(s=148.4 < sma=150.) static const G4double lsa=9.; // The max ln(s) logTabEl(s=148.4 - 8103. mb) static const G4double mi=std::exp(lsi);// The min s of logTabEl(~ 148.4 mb) static const G4double ms=std::exp(lsa);// The max s of logTabEl(~ 8103. mb) static const G4double dl=(lsa-lsi)/nls;// Step of the logarithmic Table static const G4double edl=std::exp(dl);// Multiplication step of the logarithmic Table static const G4double toler=.01; // The tolarence mb defining the same cross-section static G4double lastS=0.; // The last sigma value for which R was calculated static G4double lastR=0.; // The last ratio R which was calculated // Local Associative Data Base: static std::vector vA; // Vector of calculated A static std::vector vH; // Vector of max s initialized in the LinTable static std::vector vN; // Vector of topBin number initialized in LinTable static std::vector vM; // Vector of rel max ln(s) initialized in LogTable static std::vector vK; // Vector of topBin number initialized in LogTable // Last values of the Associative Data Base: static G4int lastA=0; // theLast of calculated A static G4double lastH=0.; // theLast of max s initialized in the LinTable static G4int lastN=0; // theLast of topBin number initialized in LinTable static G4double lastM=0.; // theLast of rel max ln(s) initialized in LogTable static G4int lastK=0; // theLast of topBin number initialized in LogTable static G4double* lastT=0; // theLast of pointer to LinTable in the C++ heap static G4double* lastL=0; // theLast of pointer to LogTable in the C++ heap // LogTable is created only if necessary. The ratio R(s>8100 mb) = 0 for any nuclei if(sms) return 0.; if(A>238) { G4cout<<"-Warning-G4QuasiFreeRatio::GetQF2IN_Ratio:A="<238, return zero"<To) El=To; return std::make_pair(El,To); } // End of CalcElTot // Calculatio pair(hN_el,hN_tot)(mb): p in GeV/c, F=true -> N=proton, F=false -> N=neutron std::pair G4QuasiFreeRatios::FetchElTot(G4double p, G4int PDG, G4bool F) { static const G4int nlp=300; // Number of steps in the S(lnp) logTable(5% step) static const G4int mlp=nlp+1; // Number of elements in the S(lnp) logTable static const G4double lpi=-5.; // The min ln(p) logTabEl(p=6.7 MeV/c - 22. TeV/c) static const G4double lpa=10.; // The max ln(p) logTabEl(p=6.7 MeV/c - 22. TeV/c) static const G4double mi=std::exp(lpi);// The min p of logTabEl(~ 6.7 MeV/c) static const G4double ma=std::exp(lpa);// The max p of logTabEl(~ 22. TeV) static const G4double dl=(lpa-lpi)/nlp;// Step of the logarithmic Table static const G4double edl=std::exp(dl);// Multiplication step of the logarithmic Table // static const G4double toler=.001; // Relative tolarence defining "the same momentum" static G4double lastP=0.; // The last momentum for which XS was calculated static G4int lastH=0; // The last projPDG for which XS was calculated static G4bool lastF=true; // The last nucleon for which XS was calculated static std::pair lastR=std::make_pair(0.,0.); // The last result // Local Associative Data Base: static std::vector vI; // Vector of index for which XS was calculated static std::vector vM; // Vector of rel max ln(p) initialized in LogTable static std::vector vK; // Vector of topBin number initialized in LogTable // Last values of the Associative Data Base: static G4int lastI=0; // The Last index for which XS was calculated static G4double lastM=0.; // The Last rel max ln(p) initialized in LogTable static G4int lastK=0; // The Last topBin number initialized in LogTable static std::pair* lastX=0; // The Last ETPointers to LogTable in heap // LogTable is created only if necessary. The ratio R(s>8100 mb) = 0 for any nuclei G4int nDB=vI.size(); // A number of hadrons already initialized in AMDB #ifdef pdebug G4cout<<"G4QuasiFreeR::FetchElTot:p="<0. && p==lastP) return lastR; // VI do not use toler // if(nDB && lastH==PDG && lastF==F && p>0. && std::fabs(p-lastP)/p.5) kfl=false; } if ( (PDG == 2212 && F) || (PDG == 2112 && !F) ) { ind=0; // pp/nn } else if ( (PDG == 2112 && F) || (PDG == 2212 && !F) ) { ind=1; // np/pn } else if ( (PDG == -211 && F) || (PDG == 211 && !F) ) { ind=2; // pimp/pipn } else if ( (PDG == 211 && F) || (PDG == -211 && !F) ) { ind=3; // pipp/pimn } else if ( PDG == -321 || PDG == -311 || (kf && !kfl) ) { ind=4; // KmN/K0N } else if ( PDG == 321 || PDG == 311 || (kf && kfl) ) { ind=5; // KpN/aK0N } else if ( PDG > 3000 && PDG < 3335) { ind=6; // @@ for all hyperons - take Lambda } else if ( PDG < -2000 && PDG > -3335 ) { ind=7; // @@ for all anti-baryons - anti-p/anti-n } else { G4cout<<"*Error*G4QuasiFreeRatios::FetchElTot: PDG="<0. && p==lastP) return lastR; // VI do not use toler // if(nDB && lastI==ind && p>0. && std::fabs(p-lastP)/p=ma) return CalcElTot(p,ind); // @@ Slow calculation ! (Warning?) G4bool found=false; G4int i=-1; if(nDB) for (i=0; i hp=FetchElTot(pGeV, hPDG, true); std::pair hn=FetchElTot(pGeV, hPDG, false); G4double A=(Z+N)/millibarn; // To make the result in independent units(IU) return std::make_pair((Z*hp.first+N*hn.first)/A,(Z*hp.second+N*hn.second)/A); } // End of GetElTot // (Mean Elastic and Mean Total) Cross-Sections (mb) for PDG+(Z,N) at P=p[GeV/c] std::pair G4QuasiFreeRatios::GetChExFactor(G4double pIU, G4int hPDG, G4int Z, G4int N) { G4double pGeV=pIU/gigaelectronvolt; G4double resP=0.; G4double resN=0.; if(Z<1 && N<1) { G4cout<<"-Warning-G4QuasiFreeRatio::GetChExF:Z="<.5) { mult=1./(1.+std::log(pGeV+pGeV))/pGeV; if(mult>1.) mult=1.; } if(pf) { std::pair hp=FetchElTot(pGeV, hPDG, true); resP=pf*(hp.second/hp.first-1.)*mult; } if(nf) { std::pair hn=FetchElTot(pGeV, hPDG, false); resN=nf*(hn.second/hn.first-1.)*mult; } return std::make_pair(resP,resN); } // End of GetChExFactor // scatter (pPDG,p4M) on a virtual nucleon (NPDG,N4M), result: final pair(newN4M,newp4M) // if(newN4M.e()==0.) - below threshold, XS=0, no scattering of the progectile happened std::pair G4QuasiFreeRatios::Scatter(G4int NPDG, G4LorentzVector N4M, G4int pPDG, G4LorentzVector p4M) { static const G4double mNeut= G4QPDGCode(2112).GetMass(); static const G4double mProt= G4QPDGCode(2212).GetMass(); static const G4double mDeut= G4QPDGCode(2112).GetNuclMass(1,1,0);// Mass of deuteron static const G4double mTrit= G4QPDGCode(2112).GetNuclMass(1,2,0);// Mass of tritium static const G4double mHel3= G4QPDGCode(2112).GetNuclMass(2,1,0);// Mass of Helium3 static const G4double mAlph= G4QPDGCode(2112).GetNuclMass(2,2,0);// Mass of alpha G4LorentzVector pr4M=p4M/megaelectronvolt; // Convert 4-momenta in MeV (keep p4M) N4M/=megaelectronvolt; G4LorentzVector tot4M=N4M+p4M; G4double mT=mNeut; G4int Z=0; G4int N=1; if(NPDG==2212||NPDG==90001000) { mT=mProt; Z=1; N=0; } else if(NPDG==90001001) { mT=mDeut; Z=1; N=1; } else if(NPDG==90002001) { mT=mHel3; Z=2; N=1; } else if(NPDG==90001002) { mT=mTrit; Z=1; N=2; } else if(NPDG==90002002) { mT=mAlph; Z=2; N=2; } else if(NPDG!=2112&&NPDG!=90000001) { G4cout<<"Error:G4QuasiFreeRatios::Scatter:NPDG="<