G4NeutronHPorLElasticData.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // 05-11-21 NeutronHP or Low Energy Parameterization Models 
00028 //          Implemented by T. Koi (SLAC/SCCS)
00029 //          If NeutronHP data do not available for an element, then Low Energy 
00030 //          Parameterization models handle the interactions of the element.
00031 // 081024 G4NucleiPropertiesTable:: to G4NucleiProperties::
00032 //
00033 
00034 #include "G4NeutronHPorLElasticData.hh"
00035 #include "G4SystemOfUnits.hh"
00036 #include "G4Neutron.hh"
00037 #include "G4ElementTable.hh"
00038 #include "G4NeutronHPData.hh"
00039 
00040 #include "G4PhysicsVector.hh"
00041 
00042 G4NeutronHPorLElasticData::G4NeutronHPorLElasticData()
00043 {
00044    SetMinKinEnergy( 0*MeV );                                   
00045    SetMaxKinEnergy( 20*MeV );                                   
00046 
00047    ke_cache = 0.0;
00048    xs_cache = 0.0;
00049    element_cache = NULL;
00050    material_cache = NULL;
00051 //   BuildPhysicsTable(*G4Neutron::Neutron());
00052 }
00053 
00054 G4NeutronHPorLElasticData::~G4NeutronHPorLElasticData()
00055 {
00056 //  delete theCrossSections;
00057 }
00058 
00059 G4bool G4NeutronHPorLElasticData::IsIsoApplicable( const G4DynamicParticle* dp , 
00060                                                 G4int /*Z*/ , G4int /*A*/ ,
00061                                                 const G4Element* element ,
00062                                                 const G4Material* /*mat*/ )
00063 {
00064    G4double eKin = dp->GetKineticEnergy();
00065    if ( eKin > GetMaxKinEnergy() 
00066      || eKin < GetMinKinEnergy() 
00067      || dp->GetDefinition() != G4Neutron::Neutron() ) return false;                                   
00068    if ( unavailable_elements->find( element->GetName() ) != unavailable_elements->end() ) return false;
00069 
00070    return true;
00071 }
00072 
00073 G4double G4NeutronHPorLElasticData::GetIsoCrossSection( const G4DynamicParticle* dp ,
00074                                    G4int /*Z*/ , G4int /*A*/ ,
00075                                    const G4Isotope* /*iso*/  ,
00076                                    const G4Element* element ,
00077                                    const G4Material* material )
00078 {
00079    if ( dp->GetKineticEnergy() == ke_cache && element == element_cache &&  material == material_cache ) return xs_cache;
00080 
00081    ke_cache = dp->GetKineticEnergy();
00082    element_cache = element;
00083    material_cache = material;
00084    G4double xs = GetCrossSection( dp , element , material->GetTemperature() );
00085    xs_cache = xs;
00086    return xs;
00087    //return GetCrossSection( dp , element , material->GetTemperature() );
00088 }
00089 
00090 
00091 G4NeutronHPorLElasticData::G4NeutronHPorLElasticData( G4NeutronHPChannel* pChannel , std::set< G4String >* pSet )
00092 :G4VCrossSectionDataSet("NeutronHPorLElasticXS")
00093 {
00094    theElasticChannel = pChannel;
00095    unavailable_elements = pSet;   
00096 
00097    SetMinKinEnergy( 0*MeV );                                   
00098    SetMaxKinEnergy( 20*MeV );                                   
00099 
00100    ke_cache = 0.0;
00101    xs_cache = 0.0;
00102    element_cache = NULL;
00103    material_cache = NULL;
00104 }
00105 
00106  
00107 /*
00108 G4bool G4NeutronHPorLElasticData::IsApplicable(const G4DynamicParticle*aP, const G4Element* anElement)
00109 {
00110    G4bool result = true;
00111    G4double eKin = aP->GetKineticEnergy();
00112    if(eKin>20*MeV||aP->GetDefinition()!=G4Neutron::Neutron()) result = false;
00113    if ( unavailable_elements->find( anElement->GetName() ) != unavailable_elements->end() ) result = false;
00114    return result;
00115 }
00116 */
00117 
00118 void G4NeutronHPorLElasticData::BuildPhysicsTable( const G4ParticleDefinition& aP )
00119 {
00120    if( &aP!=G4Neutron::Neutron() ) 
00121       throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!");  
00122 }
00123  
00124 
00125 
00126 void G4NeutronHPorLElasticData::DumpPhysicsTable(const G4ParticleDefinition& aP)
00127 {
00128   if(&aP!=G4Neutron::Neutron()) 
00129      throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!");  
00130 //  G4cout << "G4NeutronHPorLElasticData::DumpPhysicsTable still to be implemented"<<G4endl;
00131 }
00132 
00133 
00134 
00135 #include "G4Nucleus.hh"
00136 #include "G4NucleiProperties.hh"
00137 #include "G4Neutron.hh"
00138 #include "G4Electron.hh"
00139 
00140 G4double G4NeutronHPorLElasticData::
00141 GetCrossSection(const G4DynamicParticle* aP, const G4Element*anE, G4double aT)
00142 {
00143 
00144   //G4cout << "Choice G4NeutronHPorLElasticData for element " << anE->GetName() << G4endl;
00145   G4double result = 0;
00146 //  G4bool outOfRange;
00147   G4int index = anE->GetIndex();
00148 
00149   // prepare neutron
00150   G4double eKinetic = aP->GetKineticEnergy();
00151   G4ReactionProduct theNeutron( aP->GetDefinition() );
00152   theNeutron.SetMomentum( aP->GetMomentum() );
00153   theNeutron.SetKineticEnergy( eKinetic );
00154 
00155   // prepare thermal nucleus
00156   G4Nucleus aNuc;
00157   G4double eps = 0.0001;
00158   G4double theA = anE->GetN();
00159   G4double theZ = anE->GetZ();
00160   G4double eleMass; 
00161   eleMass = ( G4NucleiProperties::GetNuclearMass(static_cast<G4int>(theA+eps), static_cast<G4int>(theZ+eps))
00162              ) / G4Neutron::Neutron()->GetPDGMass();
00163   
00164   G4ReactionProduct boosted;
00165   G4double aXsection;
00166   
00167   // MC integration loop
00168   G4int counter = 0;
00169   G4double buffer = 0;
00170   G4int size = G4int(std::max(10., aT/60*kelvin));
00171   G4ThreeVector neutronVelocity = 1./G4Neutron::Neutron()->GetPDGMass()*theNeutron.GetMomentum();
00172   G4double neutronVMag = neutronVelocity.mag();
00173   while(counter == 0 || std::abs(buffer-result/std::max(1,counter)) > 0.03*buffer)
00174   {
00175     if(counter) buffer = result/counter;
00176     while (counter<size)
00177     {
00178       counter ++;
00179       G4ReactionProduct aThermalNuc = aNuc.GetThermalNucleus(eleMass, aT);
00180       boosted.Lorentz(theNeutron, aThermalNuc);
00181       G4double theEkin = boosted.GetKineticEnergy();
00182       //aXsection = (*((*theCrossSections)(index))).GetValue(theEkin, outOfRange);
00183       aXsection = theElasticChannel[index].GetXsec( theEkin );
00184       // velocity correction.
00185       G4ThreeVector targetVelocity = 1./aThermalNuc.GetMass()*aThermalNuc.GetMomentum();
00186       aXsection *= (targetVelocity-neutronVelocity).mag()/neutronVMag;
00187       result += aXsection;
00188     }
00189     size += size;
00190   }
00191   result /= counter;
00192   return result;
00193 }

Generated on Mon May 27 17:49:03 2013 for Geant4 by  doxygen 1.4.7