G4NeutronHPorLFission.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 // 080319 Compilation warnings - gcc-4.3.0 fix by T. Koi
00032 //
00033 
00034 // neutron_hp -- source file
00035 // J.P. Wellisch, Nov-1996
00036 // A prototype of the low energy neutron transport model.
00037 //
00038 #include "G4NeutronHPorLFission.hh"
00039 #include "G4SystemOfUnits.hh"
00040 #include "G4NeutronHPFissionFS.hh"
00041 
00042 G4NeutronHPorLFission::G4NeutronHPorLFission()
00043   :G4HadronicInteraction("NeutronHPorLFission")
00044 {
00045    SetMinEnergy(0.*eV);
00046    SetMaxEnergy(20.*MeV);
00047 
00048    if( !getenv("G4NEUTRONHPDATA") ) 
00049        throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
00050 
00051    dirName = getenv("G4NEUTRONHPDATA");
00052    G4String tString = "/Fission/";
00053    dirName = dirName + tString;
00054 //    G4cout <<"G4NeutronHPorLFission::G4NeutronHPorLFission testit "<<dirName<<G4endl;
00055    unavailable_elements.clear();
00056 
00057    numEle = G4Element::GetNumberOfElements();
00058    theFission = new G4NeutronHPChannel[numEle];
00059 
00060    for ( G4int i = 0; i < numEle ; i++)
00061    {
00062       if ( (*(G4Element::GetElementTable()))[i]-> GetZ() > 87 ) //TK modified for ENDF-VII
00063       {
00064          theFission[i].Init((*(G4Element::GetElementTable()))[i], dirName);
00065          try { while(!theFission[i].Register(&theFS)) ; }
00066          catch ( G4HadronicException )
00067          {
00068              unavailable_elements.insert ( (*(G4Element::GetElementTable()))[i]->GetName() ); 
00069          }
00070       } 
00071    }
00072 
00073    if ( unavailable_elements.size() > 0 ) 
00074    {
00075       std::set< G4String>::iterator it;
00076       G4cout << "HP Fission data are not available for thess  elements "<< G4endl;
00077       for ( it = unavailable_elements.begin() ; it != unavailable_elements.end() ; it++ )
00078       {
00079             G4cout << *it << G4endl;
00080       }
00081       G4cout << "Low Energy Parameterization Models will be used."<< G4endl;
00082    }
00083 
00084    createXSectionDataSet();
00085 }
00086   
00087 G4NeutronHPorLFission::~G4NeutronHPorLFission()
00088 {
00089    delete [] theFission;
00090    delete theDataSet; 
00091 }
00092   
00093 #include "G4NeutronHPThermalBoost.hh"
00094   
00095 G4HadFinalState * G4NeutronHPorLFission::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& )
00096 {
00097    const G4Material * theMaterial = aTrack.GetMaterial();
00098    G4int n = theMaterial->GetNumberOfElements();
00099    G4int index = theMaterial->GetElement(0)->GetIndex();
00100    if(n!=1)
00101    {
00102       G4int i;
00103       xSec = new G4double[n];
00104       G4double sum=0;
00105       const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume();
00106       G4double rWeight;    
00107       G4NeutronHPThermalBoost aThermalE;
00108       for (i=0; i<n; i++)
00109       {
00110         index = theMaterial->GetElement(i)->GetIndex();
00111         rWeight = NumAtomsPerVolume[i];
00112         G4double x = aThermalE.GetThermalEnergy(aTrack, theMaterial->GetElement(i), theMaterial->GetTemperature());
00113 
00114         //xSec[i] = theFission[index].GetXsec(aThermalE.GetThermalEnergy(aTrack,
00115         //                                                                   theMaterial->GetElement(i),
00116         //                                                                   theMaterial->GetTemperature()));
00117         xSec[i] = theFission[index].GetXsec(x);
00118 
00119         xSec[i] *= rWeight;
00120         sum+=xSec[i];
00121       }
00122       G4double random = G4UniformRand();
00123       G4double running = 0;
00124       for (i=0; i<n; i++)
00125       {
00126         running += xSec[i];
00127         index = theMaterial->GetElement(i)->GetIndex();
00128         if(random<=running/sum) break;
00129       }
00130       delete [] xSec;
00131       // it is element-wise initialised.
00132     }
00133     return theFission[index].ApplyYourself(aTrack); 
00134 }
00135 
00136 
00137 
00138 G4bool G4NeutronHPorLFission::IsThisElementOK( G4String name )
00139 {
00140    if ( unavailable_elements.find( name ) == unavailable_elements.end() ) 
00141       return TRUE;
00142    else 
00143       return FALSE; 
00144 }
00145 
00146 
00147 
00148 void G4NeutronHPorLFission::createXSectionDataSet()
00149 {
00150    theDataSet = new G4NeutronHPorLFissionData ( theFission , &unavailable_elements );
00151 }
00152 const std::pair<G4double, G4double> G4NeutronHPorLFission::GetFatalEnergyCheckLevels() const
00153 {
00154    //return std::pair<G4double, G4double>(10*perCent,10*GeV);
00155    return std::pair<G4double, G4double>(10*perCent,DBL_MAX);
00156 }

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