// // ******************************************************************** // * 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. * // ******************************************************************** // // neutron_hp -- source file // J.P. Wellisch, Nov-1996 // A prototype of the low energy neutron transport model. // // 25-08-06 New Final State type (refFlag==3 , Legendre (Low Energy) + Probability (High Energy) ) // is added by T. KOI // 080904 Add Protection for negative energy results in very low energy ( 1E-6 eV ) scattering by T. Koi // #include "G4NeutronHPElasticFS.hh" #include "G4ReactionProduct.hh" #include "G4Nucleus.hh" #include "G4Proton.hh" #include "G4Deuteron.hh" #include "G4Triton.hh" #include "G4Alpha.hh" #include "G4ThreeVector.hh" #include "G4LorentzVector.hh" #include "G4ParticleTable.hh" #include "G4NeutronHPDataUsed.hh" void G4NeutronHPElasticFS::Init (G4double A, G4double Z, G4String & dirName, G4String & ) { G4String tString = "/FS/"; G4bool dbool; G4NeutronHPDataUsed aFile = theNames.GetName(static_cast(A), static_cast(Z), dirName, tString, dbool); G4String filename = aFile.GetName(); theBaseA = aFile.GetA(); theBaseZ = aFile.GetZ(); if(!dbool) { hasAnyData = false; hasFSData = false; hasXsec = false; return; } std::ifstream theData(filename, std::ios::in); theData >> repFlag >> targetMass >> frameFlag; if(repFlag==1) { G4int nEnergy; theData >> nEnergy; theCoefficients = new G4NeutronHPLegendreStore(nEnergy); theCoefficients->InitInterpolation(theData); G4double temp, energy; G4int tempdep, nLegendre; G4int i, ii; for (i=0; i> temp >> energy >> tempdep >> nLegendre; energy *=eV; theCoefficients->Init(i, energy, nLegendre); theCoefficients->SetTemperature(i, temp); G4double coeff=0; for(ii=0; ii> coeff; theCoefficients->SetCoeff(i, ii+1, coeff); // @@@HPW@@@ } } } else if (repFlag==2) { G4int nEnergy; theData >> nEnergy; theProbArray = new G4NeutronHPPartial(nEnergy, nEnergy); theProbArray->InitInterpolation(theData); G4double temp, energy; G4int tempdep, nPoints; for(G4int i=0; i> temp >> energy >> tempdep >> nPoints; energy *= eV; theProbArray->InitInterpolation(i, theData); theProbArray->SetT(i, temp); theProbArray->SetX(i, energy); G4double prob, costh; for(G4int ii=0; ii> costh >> prob; theProbArray->SetX(i, ii, costh); theProbArray->SetY(i, ii, prob); } } } else if ( repFlag==3 ) { G4int nEnergy_Legendre; theData >> nEnergy_Legendre; theCoefficients = new G4NeutronHPLegendreStore( nEnergy_Legendre ); theCoefficients->InitInterpolation( theData ); G4double temp, energy; G4int tempdep, nLegendre; G4int i, ii; for ( i = 0 ; i < nEnergy_Legendre ; i++ ) { theData >> temp >> energy >> tempdep >> nLegendre; energy *=eV; theCoefficients->Init( i , energy , nLegendre ); theCoefficients->SetTemperature( i , temp ); G4double coeff = 0; for ( ii = 0 ; ii < nLegendre ; ii++ ) { // load legendre coefficients. theData >> coeff; theCoefficients->SetCoeff(i, ii+1, coeff); // @@@HPW@@@ } } tE_of_repFlag3 = energy; G4int nEnergy_Prob; theData >> nEnergy_Prob; theProbArray = new G4NeutronHPPartial( nEnergy_Prob , nEnergy_Prob ); theProbArray->InitInterpolation( theData ); G4int nPoints; for ( G4int i=0 ; i < nEnergy_Prob ; i++ ) { theData >> temp >> energy >> tempdep >> nPoints; energy *= eV; // consistensy check if ( i == 0 ) if ( energy != tE_of_repFlag3 ) G4cout << "Warning Trangition Energy of repFlag3 is not consistent." << G4endl; theProbArray->InitInterpolation( i , theData ); theProbArray->SetT( i , temp ); theProbArray->SetX( i , energy ); G4double prob, costh; for( G4int ii = 0 ; ii < nPoints ; ii++ ) { // fill probability arrays. theData >> costh >> prob; theProbArray->SetX( i , ii , costh ); theProbArray->SetY( i , ii , prob ); } } } else if (repFlag==0) { theData >> frameFlag; } else { G4cout << "unusable number for repFlag: repFlag="<(incidentParticle->GetDefinition()) ); theNeutron.SetMomentum( incidentParticle->Get4Momentum().vect() ); theNeutron.SetKineticEnergy( eKinetic ); // G4cout << "G4NeutronHPElasticFS::ApplyYourself++"<GetDefinition()->GetPDGMass())*theNeutron.GetMomentum(); theTarget = aNucleus.GetBiasedThermalNucleus( targetMass, neuVelo, theTrack.GetMaterial()->GetTemperature()); // G4cout << "Nucleus-test"<<" "<SampleElastic(eKinetic); } else if (repFlag==2) { cosTh = theProbArray->Sample(eKinetic); } else if (repFlag==3) { if ( eKinetic <= tE_of_repFlag3 ) { cosTh = theCoefficients->SampleElastic(eKinetic); } else { cosTh = theProbArray->Sample(eKinetic); } } else if (repFlag==0) { cosTh = 2.*G4UniformRand()-1.; } else { G4cout << "unusable number for repFlag: repFlag="<SetDefinition(G4Proton::Proton()); } else if(targetMass<2 ) { // deuteron theRecoil->SetDefinition(G4Deuteron::Deuteron()); } else if(targetMass<2.999 ) { // 3He theRecoil->SetDefinition(G4He3::He3()); } else if(targetMass<3 ) { // Triton theRecoil->SetDefinition(G4Triton::Triton()); } else { // alpha theRecoil->SetDefinition(G4Alpha::Alpha()); } } else { theRecoil->SetDefinition(G4ParticleTable::GetParticleTable() ->FindIon(static_cast(theBaseZ), static_cast(theBaseA), 0, static_cast(theBaseZ))); } theRecoil->SetMomentum(theTarget.GetMomentum()); theResult.AddSecondary(theRecoil); // G4cout << "G4NeutronHPElasticFS::ApplyYourself 10+"<