// // ******************************************************************** // * 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.3 2010/01/22 17:02:48 mkossov Exp $ // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ // // // 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 // //======================================================================= // Short description: Provides percentage of quasi-free and quasi-elastic // reactions in the inelastic reactions. // ---------------------------------------------------------------------- //#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) { #ifdef pdebug G4cout<<">>>IN>>>G4QFRat::GetQF:P="< ElTot=GetElTot(pIU, pPDG, tgZ, tgN); // mean hN El&Tot(IU) //if( ( (pPDG>999 && pIU<227.) || pIU<27.) && tgA>1) R=1.; // @@ TMP to accelerate @lowE if(pPDG>999 && pIU<227. && tgZ+tgN>1) R=1.; // To accelerate @lowE else if(ElTot.second>0.) { R=ElTot.first/ElTot.second; // El/Total ratio (does not depend on units QF2In=GetQF2IN_Ratio(ElTot.second/millibarn, tgZ+tgN); // QuasiFree/Inelastic ratio } #ifdef pdebug G4cout<<">>>OUT>>>G4QuasiFreeRatio::GetQF2IN_Ratio: QF2In="<238, return zero"<sma && lastK((ls-lsi)/dl)+1; // MaxBin to be initialized in LogTaB if(lastK>nls) { lastK=nls; lastM=lsa-lsi; } else lastM = lastK*dl; // Calculate max initialized ln(s)-lsi for LogTab #ifdef pdebug G4cout<<"G4QFRat::GetQF2IN_Ratio: nK="<To) El=To; return std::make_pair(El,To); } // End of CalcElTot // For hadron PDG with momentum Mom (GeV/c) on N (p/n) calculate pair (mb) std::pair G4QuasiFreeRatios::GetElTotXS(G4double p, G4int PDG, G4bool F) { G4int ind=0; // Prototype of the reaction index G4bool kfl=true; // Flag of K0/aK0 oscillation G4bool kf=false; if(PDG==130||PDG==310) { kf=true; if(G4UniformRand()>.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 > -3335 && PDG < -2000) ind=7; // @@ for all anti-baryons (anti-p/anti-n) else { G4cout<<"*Error*G4QuasiFreeRatios::CalcElTotXS: PDG="< 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 "theSameMomentum" 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 don't 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 > -3335 && PDG < -2000) 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; iG4QuasiFreeR::FetchElTot:1st="<G4QuasiFreeR::GetElTot: P="< hp=FetchElTot(pGeV, hPDG, true); std::pair hn=FetchElTot(pGeV, hPDG, false); #ifdef pdebug G4cout<<"-OUT->G4QFRat::GetElTot: hp("< 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; #ifdef ppdebug G4cerr<<"->G4QFR::Scat:p4M="<