// // ******************************************************************** // * 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: G4QLowEnergy.cc,v 1.7 2008/10/02 21:10:07 dennis Exp $ // GEANT4 tag $Name: geant4-09-02-ref-02 $ // // ---------------- G4QLowEnergy class ----------------- // by Mikhail Kossov, Aug 2007. // G4QLowEnergy class of the CHIPS Simulation Branch in GEANT4 // --------------------------------------------------------------- // **************************************************************************************** // ********** This CLASS is temporary moved from the "chips/interface" directory ********* // **************************************************************************************** //#define debug //#define pdebug //#define tdebug //#define nandebug //#define ppdebug #include "G4QLowEnergy.hh" // Initialization of static vectors G4int G4QLowEnergy::nPartCWorld=152; // #of particles initialized in CHIPS std::vector G4QLowEnergy::ElementZ; // Z of element(i) in theLastCalc std::vector G4QLowEnergy::ElProbInMat; // SumProbOfElem in Material std::vector*> G4QLowEnergy::ElIsoN;// N of isotope(j), E(i) std::vector*>G4QLowEnergy::IsoProbInEl;//SumProbIsotE(i) // Constructor G4QLowEnergy::G4QLowEnergy(const G4String& processName): G4VDiscreteProcess(processName, fHadronic), evaporate(true) { #ifdef debug G4cout<<"G4QLowEnergy::Constructor is called processName="<0) G4cout<GetParticles(nPartCWorld); // Create CHIPS World (234 part. max) } // Destructor G4QLowEnergy::~G4QLowEnergy() {} G4LorentzVector G4QLowEnergy::GetEnegryMomentumConservation(){return EnMomConservation;} G4int G4QLowEnergy::GetNumberOfNeutronsInTarget() {return nOfNeutrons;} // output of the function must be in units of length! L=1/sig_V,sig_V=SUM(n(j,i)*sig(j,i)), // where n(i,j) is a number of nuclei of the isotop j of the element i in V=1(lengtUnit^3) // ********** All CHIPS cross sections are calculated in the surface units ************ G4double G4QLowEnergy::GetMeanFreePath(const G4Track&Track, G4double, G4ForceCondition*F) { *F = NotForced; const G4DynamicParticle* incidentParticle = Track.GetDynamicParticle(); G4ParticleDefinition* incidentParticleDefinition=incidentParticle->GetDefinition(); if( !IsApplicable(*incidentParticleDefinition)) G4cout<<"-Warning-G4QLowEnergy::GetMeanFreePath for notImplemented Particle"<GetTotalMomentum(); // 3-momentum of the Particle #ifdef debug G4double KinEn = incidentParticle->GetKineticEnergy(); G4cout<<"G4QLowEnergy::GetMeanFreePath:Prpj, kinE="<GetPDGEncoding(); #ifdef debug G4int B=incidentParticleDefinition->GetBaryonNumber(); G4int C=incidentParticleDefinition->GetPDGCharge(); prPDG=100000000+1000*C+B; G4cout<<"G4QIonIonElastic::GetMeanFreePath: PDG="<GetBaryonNumber(); // Divide Mom by projectile A G4QIsotope* Isotopes = G4QIsotope::Get(); // Pointer to the G4QIsotopes singleton G4double sigma=0.; // Sums over elements for the material G4int IPIE=IsoProbInEl.size(); // How many old elements? if(IPIE) for(G4int ip=0; ip* SPI=IsoProbInEl[ip]; // Pointer to the SPI vector SPI->clear(); delete SPI; std::vector* IsN=ElIsoN[ip]; // Pointer to the N vector IsN->clear(); delete IsN; } ElProbInMat.clear(); // Clean up the SumProb's of Elements (SPE) ElementZ.clear(); // Clear the body vector for Z of Elements IsoProbInEl.clear(); // Clear the body vector for SPI ElIsoN.clear(); // Clear the body vector for N of Isotopes for(G4int i=0; i(pElement->GetZ()); // Z of the Element ElementZ.push_back(Z); // Remember Z of the Element G4int isoSize=0; // The default for the isoVectorLength is 0 G4int indEl=0; // Index of non-natural element or 0(default) G4IsotopeVector* isoVector=pElement->GetIsotopeVector(); // Get the predefined IsoVect if(isoVector) isoSize=isoVector->size();// Get size of the existing isotopeVector #ifdef debug G4cout<<"G4QLowEnergy::GetMeanFreePath: isovector Length="<GetIndex()+1; // Index of the non-trivial element is an order #ifdef debug G4cout<<"G4QLowEn::GetMFP:iE="<IsDefined(Z,indEl)<IsDefined(Z,indEl)) // This index is not defined for this Z: define { std::vector*>* newAbund = new std::vector*>; G4double* abuVector=pElement->GetRelativeAbundanceVector(); for(G4int j=0; jGetIsotope(j)->GetN()-Z; // N means A=N+Z ! if(pElement->GetIsotope(j)->GetZ()!=Z)G4cerr<<"G4QDiffract::GetMeanFreePath: Z=" <GetIsotope(j)->GetZ()<<"#"<* pr= new std::pair(N,abund); #ifdef debug G4cout<<"G4QLowEnergy::GetMeanFreePath:pair#"<push_back(pr); } #ifdef debug G4cout<<"G4QLowEnergy::GetMeanFreePath: pairVectLength="<size()<InitElement(Z,indEl,newAbund); // definition of the newInd for(G4int k=0; k*>* cs= Isotopes->GetCSVector(Z,indEl);//CSPointer std::vector* SPI = new std::vector; // Pointer to the SPI vector IsoProbInEl.push_back(SPI); std::vector* IsN = new std::vector; // Pointer to the N vector ElIsoN.push_back(IsN); G4int nIs=cs->size(); // A#Of Isotopes in the Element #ifdef debug G4cout<<"G4QLowEnergy::GetMFP:***=>,#isot="<="<GetMeanCrossSection(Z,indEl) <<",AddSigm="<GetMeanCrossSection(Z,indEl)*NOfNucPerVolume[i]<>G4QLowEnergy::IsApplicable: projPDG="<GetParticles(nPartCWorld); // Create CHIPS World (234 part.max) } //------------------------------------------------------------------------------------- const G4DynamicParticle* projHadron = track.GetDynamicParticle(); const G4ParticleDefinition* particle=projHadron->GetDefinition(); #ifdef debug G4cout<<"G4QLowEnergy::PostStepDoIt: Before the GetMeanFreePath is called In4M=" <Get4Momentum()<<" of PDG="<GetPDGEncoding()<<", Type=" <GetParticleType()<<",SubType="<GetParticleSubType()<Get4Momentum())/MeV; // Convert to MeV! G4double momentum = projHadron->GetTotalMomentum()/MeV; // 3-momentum of the Proj in MeV G4double Momentum = proj4M.rho(); // @@ Just for the test purposes if(std::fabs(Momentum-momentum)>.000001) G4cerr<<"-Warning-G4QLowEnergy::PostStepDoIt:P_IU="<GetElementVector(); G4int nE=material->GetNumberOfElements(); #ifdef debug G4cout<<"G4QLowEnergy::PostStepDoIt: "<GetPDGEncoding(); #ifdef debug G4int B=particle->GetBaryonNumber(); G4int C=particle->GetPDGCharge(); prPDG=100000000+1000*C+B; G4cout<<"G4QLowEnergy::PostStepDoIt: PDG="<GetPDGEncoding(); G4cout<<"G4QLowEnergy::PostStepDoIt: projPDG="<ret 0"<size(); // #of isotopes in the element i #ifdef debug G4cout<<"G4QLowEnergy::PostStepDoIt: nI="<N="<GetQuarkContent(3)-particle->GetAntiQuarkContent(3); // Strangeness G4int pZ=static_cast(particle->GetPDGCharge()); // Charge of the projectile G4int pN=particle->GetBaryonNumber()-pZ-pL;// #of neutrons in projectile G4double pM=targQPDG.GetNuclMass(pZ,pN,0); // CHIPS projectile nucleus mass in MeV G4double cosp=-14*Momentum*(tM-pM)/tM/pM; // Asymmetry power for angular distribution #ifdef debug G4cout<<"G4QLowEnergy::PoStDoIt: Proj("<0) prL=pL/pA; G4double qval[nCh]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.}; qval[ 0] = totM - mass[ 0]; qval[ 1] = (totM - mass[ 1] - mNeut)*prN; qval[ 2] = (totM - mass[ 2] - mProt)*prZ; qval[ 3] = (totM - mass[ 3] - mDeut)*prD/3.; qval[ 4] = (totM - mass[ 4] - mTrit)*prT/6.; qval[ 5] = (totM - mass[ 5] - mHel3)*prH/fhe3; qval[ 6] = (totM - mass[ 6] - mAlph)*prA/9.; qval[ 7] = (totM - mass[ 7] - mNeut - mNeut)*prN*prN; qval[ 8] = (totM - mass[ 8] - mNeut - mProt)*prD; qval[ 9] = (totM - mass[ 9] - mProt - mProt)*prZ*prZ; qval[10] = (totM - mass[10] - mProt - mDeut)*prH/3.; qval[11] = (totM - mass[11] - mNeut - mDeut)*prT/3.; qval[12] = (totM - mass[12] - mDeut - mDeut)*prA/3./3.; qval[13] = (totM - mass[13] - mProt - mTrit)*prA/6.; qval[14] = (totM - mass[14] - mNeut - mTrit)*prT*prN/6.; qval[15] = (totM - mass[15] - mProt - mHel3)*prH*prZ/fhe3; qval[16] = (totM - mass[16] - mNeut - mHel3)*prA/fhe3; qval[17] = (totM - mass[17] - mProt - mAlph)*prZ*prA/9.; qval[18] = (totM - mass[18] - mNeut - mAlph)*prN*prA/9.; if(pZ>0) { qval[19] = (totM - mass[19] - mLamb)*prL; qval[20] = (totM - mass[20] - mProt - mLamb)*prL*prZ; qval[21] = (totM - mass[21] - mNeut - mLamb)*prL*prN; qval[22] = (totM - mass[22] - mDeut - mLamb)*prL*prD/2.; qval[23] = (totM - mass[23] - mTrit - mLamb)*prL*prT/3.; qval[24] = (totM - mass[24] - mHel3 - mLamb)*prL*prH/fhe3; qval[25] = (totM - mass[25] - mAlph - mLamb)*prL*prA/4; } #ifdef debug G4cout<<"G4QLowEn::PSDI: Q-values are calculated, tgA="<(tA-1.)*(tA-1.)/52900.) qval[0] = 0.0; if(G4UniformRand()>kinEnergy/7.925*tA) qval[2]=qval[3]=qval[4]=qval[5]=qval[9]=0.; } else qval[0] = 0.0; G4double qv = 0.0; // Total sum of probabilities (q-values) for(G4int i=0; i 0.0 ) { qv1 += qval[index]/qv; if( ran <= qv1 ) break; } } #ifdef debug G4cout<<"G4QLowEn::PSDI: index="<M1="<