// // ******************************************************************** // * 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: G4QDiffraction.cc,v 1.3 2007/10/02 10:00:37 mkossov Exp $ // GEANT4 tag $Name: $ // // ---------------- G4QDiffraction class ----------------- // by Mikhail Kossov, Aug 2007. // G4QDiffraction 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 "G4QDiffraction.hh" // Initialization of static vectors G4int G4QDiffraction::nPartCWorld=152; // #of particles initialized in CHIPS std::vector G4QDiffraction::ElementZ; // Z of element(i) in theLastCalc std::vector G4QDiffraction::ElProbInMat; // SumProbOfElem in Material std::vector*> G4QDiffraction::ElIsoN;// N of isotope(j), E(i) std::vector*>G4QDiffraction::IsoProbInEl;//SumProbIsotE(i) // Constructor G4QDiffraction::G4QDiffraction(const G4String& processName):G4VDiscreteProcess(processName) { #ifdef debug G4cout<<"G4QDiffraction::Constructor is called processName="<0) G4cout << GetProcessName() << " process is created "<< G4endl; G4QCHIPSWorld::Get()->GetParticles(nPartCWorld); // Create CHIPS World (234 part. max) } // Destructor G4QDiffraction::~G4QDiffraction() {} G4LorentzVector G4QDiffraction::GetEnegryMomentumConservation(){return EnMomConservation;} G4int G4QDiffraction::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 G4QDiffraction::GetMeanFreePath(const G4Track&Track,G4double Q,G4ForceCondition*F) { *F = NotForced; const G4DynamicParticle* incidentParticle = Track.GetDynamicParticle(); G4ParticleDefinition* incidentParticleDefinition=incidentParticle->GetDefinition(); if( !IsApplicable(*incidentParticleDefinition)) G4cout<<"-Warning-G4QDiffraction::GetMeanFreePath for notImplemented Particle"<GetTotalMomentum(); // 3-momentum of the Particle #ifdef debug G4double KinEn = incidentParticle->GetKineticEnergy(); G4cout<<"G4QDiffraction::GetMeanFreePath:Prpj, kinE="<* 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<<"G4QDiffraction::GetMeanFreePath: isovector Length="<GetIndex()+1; // Index of the non-trivial element is an order #ifdef debug G4cout<<"G4QDiffr::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<<"G4QDiffract::GetMeanFreePath:pair#"<push_back(pr); } #ifdef debug G4cout<<"G4QDiffract::GetMeanFreePath:pairVectorLength="<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<<"G4QDiffract::GetMFP:=***=>,#isot="<="<GetMeanCrossSection(Z,indEl) <<",AddSigm="<GetMeanCrossSection(Z,indEl)*NOfNucPerVolume[i]<>G4QDiffraction::IsApplicable: projPDG="<GetParticles(nPartCWorld); // Create CHIPS World (234 part.max) diffRatio=G4QDiffractionRatio::GetPointer(); } //------------------------------------------------------------------------------------- const G4DynamicParticle* projHadron = track.GetDynamicParticle(); const G4ParticleDefinition* particle=projHadron->GetDefinition(); #ifdef debug G4cout<<"G4QDiffraction::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-G4QDiffraction::PostStepDoIt:P_IU="<GetElementVector(); G4int nE=material->GetNumberOfElements(); #ifdef debug G4cout<<"G4QDiffraction::PostStepDoIt: "<GetPDGEncoding(); G4cout<<"G4QDiffraction::PostStepDoIt: projPDG="<ret 0"<size(); // #of isotopes in the element i #ifdef debug G4cout<<"G4QDiffraction::PostStepDoIt: nI="<N="<GetKineticEnergy()*MeV; // Kin energy in MeV (Is *MeV n?) G4ParticleMomentum dir = projHadron->GetMomentumDirection();// It is a unit three-vector G4LorentzVector tot4M=proj4M+G4LorentzVector(0.,0.,0.,tM); // Total 4-mom of the reaction #ifdef debug G4cout<<"G4QDiffraction::PostStepDoIt: tM="<pM="<TargFragment(projPDG, proj4M, Z, N); G4int nSec=out->size(); // #of secondaries in the diffraction reaction G4DynamicParticle* theSec=0; // A prototype for secondary for the secondary G4LorentzVector dif4M(0.,0.,0.,0.); // Prototype for the secondary 4-momentum G4int difPDG=0; // PDG code of the secondary G4QHadron* difQH=0; // Prototype for a Q-secondary #ifdef pdebug G4cout<<"G4QDiffraction::PostStepDoIt: =====found===== nSecondaries="<GetPDGCode(); G4ParticleDefinition* theDefinition=0; if (difPDG==2212 || difPDG==90001000) theDefinition=G4Proton::Proton(); else if(difPDG==2112 || difPDG==90000001) theDefinition=G4Neutron::Neutron(); else if(difPDG== 22) theDefinition=G4Gamma::Gamma(); else if(difPDG== 111) theDefinition=G4PionZero::PionZero(); else if(difPDG==-211 || difPDG==89999001) theDefinition=G4PionMinus::PionMinus(); else if(difPDG== 211 || difPDG==90000999) theDefinition=G4PionPlus::PionPlus(); else if(difPDG== 321 || difPDG==89001000) theDefinition=G4KaonPlus::KaonPlus(); else if(difPDG==-321 || difPDG==90999000) theDefinition=G4KaonMinus::KaonMinus(); else if(difPDG== 130 || difPDG==-311 || difPDG==89000001) theDefinition=G4KaonZeroLong::KaonZeroLong(); else if(difPDG== 310 || difPDG== 311 || difPDG==90999999) theDefinition=G4KaonZeroShort::KaonZeroShort(); else if(difPDG==3122 || difPDG==91000000) theDefinition=G4Lambda::Lambda(); else if(difPDG== 3222) theDefinition=G4SigmaPlus::SigmaPlus(); else if(difPDG== 3112) theDefinition=G4SigmaMinus::SigmaMinus(); else if(difPDG== 3212) theDefinition=G4SigmaZero::SigmaZero(); else if(difPDG== 3312) theDefinition=G4XiMinus::XiMinus(); else if(difPDG== 3322) theDefinition=G4XiZero::XiZero(); else if(difPDG== 3334) theDefinition=G4OmegaMinus::OmegaMinus(); else if(difPDG==-2112) theDefinition=G4AntiNeutron::AntiNeutron(); else if(difPDG==-2212) theDefinition=G4AntiProton::AntiProton(); else if(difPDG==-3122) theDefinition=G4AntiLambda::AntiLambda(); else if(difPDG==-3222) theDefinition=G4AntiSigmaPlus::AntiSigmaPlus(); else if(difPDG==-3112) theDefinition=G4AntiSigmaMinus::AntiSigmaMinus(); else if(difPDG==-3212) theDefinition=G4AntiSigmaZero::AntiSigmaZero(); else if(difPDG==-3312) theDefinition=G4AntiXiMinus::AntiXiMinus(); else if(difPDG==-3322) theDefinition=G4AntiXiZero::AntiXiZero(); else if(difPDG==-3334) theDefinition=G4AntiOmegaMinus::AntiOmegaMinus(); else if(difPDG== -11) theDefinition=G4Electron::Electron(); else if(difPDG== -13) theDefinition=G4MuonMinus::MuonMinus(); else if(difPDG== 11) theDefinition=G4Positron::Positron(); else if(difPDG== 13) theDefinition=G4MuonPlus::MuonPlus(); else { G4int Z = difQH->GetCharge(); G4int B = difQH->GetBaryonNumber(); G4int S = difQH->GetStrangeness(); if(S||Z>B||Z<0)G4cout<<"-Warning-G4QDif::PoStDoIt:Z="<FindIon(Z,B,0,0); #ifdef pdebug G4cout<<"G4QDiffraction::PoStDoIt:Ion,Z="<SetDefinition(theDefinition); dif4M = difQH->Get4Momentum(); EnMomConservation-=dif4M; theSec->Set4Momentum(dif4M); G4Track* aNewTrack = new G4Track(theSec, localtime, position ); aNewTrack->SetWeight(weight); // weighted aNewTrack->SetTouchableHandle(trTouchable); aParticleChange.AddSecondary( aNewTrack ); #ifdef pdebug G4cout<<"G4QDiffraction::PostStepDoIt: Filled 4M="<GetCrossSection(true, p, Z, N, PDG); // inelastic XS //G4double pIU=p*GeV; // IndependentUnistMomentum //G4double r=diffRatio->GetRatio(pIU, PDG, Z, N); // Proj. Diffraction Part //G4double s=x*r; // XS for proj. diffraction G4double s=diffRatio->GetTargSingDiffXS(p, PDG, Z, N); // XS for target diffraction #ifdef debug G4cout<<"G4QDiff::CXS:p="<