G4FissLib.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 // This software was developed by Lawrence Livermore National Laboratory.
00028 //
00029 // Redistribution and use in source and binary forms, with or without
00030 // modification, are permitted provided that the following conditions are met:
00031 //
00032 // 1. Redistributions of source code must retain the above copyright notice,
00033 //   this list of conditions and the following disclaimer.
00034 // 2. Redistributions in binary form must reproduce the above copyright notice,
00035 //   this list of conditions and the following disclaimer in the documentation
00036 //   and/or other materials provided with the distribution.
00037 // 3. The name of the author may not be used to endorse or promote products
00038 //   derived from this software without specific prior written permission.
00039 //
00040 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00041 // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00042 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
00043 // EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00044 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00045 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00046 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00047 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00048 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00049 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00050 //
00051 // Copyright (c) 2006 The Regents of the University of California.
00052 // All rights reserved.
00053 // UCRL-CODE-224807
00054 //
00055 //
00056 // $Id: G4FissLib.cc 69860 2013-05-16 14:39:02Z gcosmo $
00057 //
00058 // neutron_hp -- source file
00059 // J.M. Verbeke, Jan-2007
00060 // A prototype of the low energy neutron transport model.
00061 //
00062 #include "G4FissLib.hh"
00063 #include "G4SystemOfUnits.hh"
00064 
00065 G4FissLib::G4FissLib()
00066  :xSec(0)
00067 {
00068   SetMinEnergy(0.0);
00069   SetMaxEnergy(20.*MeV);
00070   if(!getenv("G4NEUTRONHPDATA")) {
00071      G4cout << "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files." << G4endl;
00072      throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
00073   }
00074   dirName = getenv("G4NEUTRONHPDATA");
00075   G4String tString = "/Fission/";
00076   dirName = dirName + tString;
00077   numEle = G4Element::GetNumberOfElements();
00078   theFission = new G4NeutronHPChannel[numEle];
00079 
00080   for (G4int i=0; i<numEle; i++)
00081   { 
00082 //    G4cout << "G4FissLib::G4FissLib(): element "<< i << " : " << (*(G4Element::GetElementTable()))[i]->GetZ()<< G4endl;
00083     if((*(G4Element::GetElementTable()))[i]->GetZ()>89)
00084     {
00085       theFission[i].Init((*(G4Element::GetElementTable()))[i], dirName);
00086       theFission[i].Register(&theLibrary);
00087     }
00088   }
00089 }
00090   
00091 G4FissLib::~G4FissLib()
00092 {
00093   delete [] theFission;
00094 }
00095   
00096 G4HadFinalState*
00097 G4FissLib::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus&)
00098 {
00099   const G4Material* theMaterial = aTrack.GetMaterial();
00100   G4int n = theMaterial->GetNumberOfElements();
00101   G4int index = theMaterial->GetElement(0)->GetIndex();
00102 
00103   if (n != 1) {
00104     xSec = new G4double[n];
00105     G4double sum = 0;
00106     G4int i;
00107     G4int imat;
00108     const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume();
00109     G4double rWeight;    
00110     G4NeutronHPThermalBoost aThermalE;
00111     for (i = 0; i < n; i++) {
00112       imat = theMaterial->GetElement(i)->GetIndex();
00113       rWeight = NumAtomsPerVolume[i];
00114       xSec[i] = theFission[imat].GetXsec(aThermalE.GetThermalEnergy(aTrack,
00115                                                                     theMaterial->GetElement(i),
00116                                                       theMaterial->GetTemperature()));
00117       xSec[i] *= rWeight;
00118       sum+=xSec[i];
00119     }
00120 
00121     G4double random = G4UniformRand();
00122     G4double running = 0;
00123     for (i = 0; i < n; i++) {
00124       running += xSec[i];
00125       index = theMaterial->GetElement(i)->GetIndex();
00126       if(random<=running/sum) break;
00127     }
00128     delete [] xSec;
00129   }
00130 
00131   return theFission[index].ApplyYourself(aTrack);
00132 }
00133 

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