Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

multiplicity.cpp

Go to the documentation of this file.
00001 /*
00002  * ******** fete: From ENDF To ENDL *********
00003  * 
00004  * Copyright (c) 2006, The Regents of the University of California. 
00005  * All rights reserved.
00006  * 
00007  * Produced at the Lawrence Livermore National Laboratory. 
00008  * Written by David A. Brown, Gerry Hedstrom, Tony Hill
00009  * 
00010  * This file is part of fete v1.0  (UCRL-CODE-218718)
00011  * 
00012  * Please read the COPYING file for "Our Notice and GNU General 
00013  * Public License" in the root of this software distribution.  
00014  * 
00015  * This program is free software; you can redistribute it and/or modify 
00016  * it under the terms of the GNU General Public License (as published by 
00017  * the Free Software Foundation) version 2, dated June 1991. 
00018  * 
00019  * This program is distributed in the hope that it will be useful, 
00020  * but WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF 
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms 
00022  * and conditions of the GNU General Public License for more details. 
00023  * 
00024  * You should have received a copy of the GNU General Public License along 
00025  * with this program; if not, write to the Free Software Foundation, Inc., 
00026  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
00027  * 
00028  * $Revision: 1866 $
00029  * $Date: 2006-05-15 09:12:12 -0700 (Mon, 15 May 2006) $
00030  * $Author: dbrown $
00031  * $Id: multiplicity.cpp 1866 2006-05-15 16:12:12Z dbrown $
00032  * 
00033  * ******** fete: From ENDF To ENDL *********
00034  */
00035 
00036 // implementation of the one_d_distrib class
00037 
00038 #include <cmath>   // math library
00039 
00040 #include "multiplicity.hpp"
00041 #include "endl_formats.hpp"
00042 #include "endl_precision.hpp"
00043 
00044 extern ENDLClass ENDL;
00045 
00046 // *********** multiplicity class ***********************
00047 
00048 
00049 // ----------- multiplicity::read_data ----------
00050 // read in and expand 2-column data
00051 void multiplicity::read_data( int NP, ENDF_file& inFile )
00052 {
00053   one_d_table::read_data( NP, inFile, ENDL.Max_E_in );
00054   if( ENDL.write_file )
00055   {
00056     expand_interp( ENDL.Max_E_in );
00057   }
00058 }
00059 
00060 // ----------- multiplicity::get_mult ----------
00061 //! Returns the constant multiplicity as may be used in an (n, Xn) reaction
00062 int multiplicity::get_mult( )
00063 {
00064   multiplicity::iterator left_ptr = begin( );
00065   multiplicity::iterator right_ptr = end( );
00066   --right_ptr;
00067   double dm = ENDL_EPSILON( 1.0 );
00068 
00069   if( abs( left_ptr->y - right_ptr->y ) > dm )
00070   {
00071     Warning( "multiplicity::get_mult", pastenum( 
00072       pastenum( pastenum("Multiplicity not constant: ",left_ptr->y)+" vs. ", right_ptr->y )+" at E = ",left_ptr->x) );
00073   }
00074   return static_cast<int>( dm + 0.5*( left_ptr->y + right_ptr->y ) );
00075 }
00076 
00077 // ----------- multiplicity::check_const_mult ----------
00078 //! Checks the multiplicity to make sure it is constant, as it should be
00079 bool multiplicity::check_const_mult( )
00080 {
00081   return check_const_mult( multiplicity::begin()->y );
00082 }
00083 
00084 // ----------- multiplicity::check_const_mult ----------
00085 //! Checks the multiplicity to make sure it is constant, as it should be
00086 bool multiplicity::check_const_mult( double first_mult )
00087 {
00088   double dm = ENDL_EPSILON( 1.0 );
00089 
00090   for( multiplicity::iterator itr = multiplicity::begin(); itr != multiplicity::end(); ++itr )
00091   {
00092     if( abs( itr->y - first_mult ) > dm ) return false;
00093   }
00094   return true;
00095 }
00096 
00097 // ----------- multiplicity::set_min_mult ----------
00098 //! Sets a floor value on the multiplicity for those times where 
00099 //! it is not constant, but a minimum value is requires
00100 void multiplicity::set_min_mult( double min_mult ){
00101   for( multiplicity::iterator itr = multiplicity::begin(); itr != multiplicity::end(); ++itr )
00102   {
00103     if( itr->y < min_mult )
00104     {
00105         Warning("multiplicity::set_min_mult",
00106             pastenum("Multiplicity at E = ",itr->x)+
00107             pastenum("MeV is ",itr->y)+
00108             pastenum(".  Resetting to minimum allowed value of ",min_mult));
00109         itr->y = min_mult;
00110     }
00111   }
00112 }
00113 
00114 // ----------- multiplicity::set_max_mult ----------
00115 //! Sets a ceiling value on the multiplicity for those times where 
00116 //! it is not constant, but a minimum value is requires
00117 void multiplicity::set_max_mult( double max_mult ){
00118   for( multiplicity::iterator itr = multiplicity::begin(); itr != multiplicity::end(); ++itr )
00119   {
00120     if( itr->y > max_mult )
00121     {
00122         Warning("multiplicity::set_min_mult",
00123             pastenum("Multiplicity at E = ",itr->x)+
00124             pastenum("MeV is ",itr->y)+
00125             pastenum(".  Resetting to maximum allowed value of ",max_mult));
00126         itr->y = max_mult;
00127     }
00128   }
00129 }
00130 
00131 // ----------- multiplicity::get_mult ----------
00132 //! Sets the multiplicity to a constant, 
00133 //! if we know it from another method (say the reaction MT)
00134 void multiplicity::set_mult( int mult )
00135 {
00136   for( multiplicity::iterator itr = multiplicity::begin(); itr != multiplicity::end(); ++itr )
00137   {
00138     itr->y=static_cast<double>(mult);
00139   }
00140 }
00141 
00142 // ----------- multiplicity::scale_by_xs ----------
00143 //! Scale photon multiplicity by the cross section to get photon production
00144 void multiplicity::scale_by_xs( )
00145 {
00146   mf3_file xs_File;   //Instantiate the input file
00147   xs_File.open(3, ENDL.T);
00148   one_d_table xs;  // Instantiate the cross section object
00149 
00150   // get the target ZA and mass
00151   int ZA;
00152   double AWR;
00153   xs_File.read_line1(&ZA, &AWR);
00154 
00155   //read second line
00156   double QM, QI;
00157   int LR, NR, NP;
00158   xs_File.read_line2(
00159       &QM,    // mass difference Q value
00160       &QI,    // reaction Q value for the lowest state
00161       &LR,    // complex or "breakup" flag
00162       &NR,    // number of INT regions 
00163       &NP     // number of data points
00164   );
00165   xs_File.get_regions( NR, xs.NBT, xs.INT );
00166   xs.read_data( NP, xs_File, ENDL.Max_E_in );
00167   xs_File.close();
00168   
00169   *this *= xs;
00170   
00171   thinit();
00172 }
00173 // ----------- multiplicity::divide_by_xs ----------
00174 //! Divide photon production by the cross section to get photon multiplicity
00175 void multiplicity::divide_by_xs()
00176 {
00177   mf3_file xs_File;   //Instantiate the input file
00178   xs_File.open(3, ENDL.T);
00179   one_d_table xs;  // Instantiate the cross section object
00180 
00181   // get the target ZA and mass
00182   int ZA;
00183   double AWR;
00184   xs_File.read_line1(&ZA, &AWR);
00185 
00186   //read second line
00187   double QM, QI;
00188   int LR, NR, NP;
00189   xs_File.read_line2(
00190       &QM,   // mass difference Q value
00191       &QI,   // reaction Q value for the lowest state
00192       &LR,   // complex or "breakup" flag
00193       &NR,   // number of INT regions 
00194       &NP    // number of data points
00195   );    
00196   xs_File.get_regions(NR, xs.NBT, xs.INT);
00197   xs.read_data( NP, xs_File, ENDL.Max_E_in );
00198   xs_File.close();
00199 
00200   *this /= xs;
00201 
00202 }
00203 
00204 // ----------- multiplicity::check_count ----------
00205 void multiplicity::check_count( )
00206 {
00207   multiplicity::iterator this_link;
00208 
00209   for( this_link = begin( ); this_link != end( );
00210        ++this_link )
00211   {
00212     if( this_link->y > 1.0 )
00213     {
00214       Warning( "multiplicity::check_count",
00215            " the multiplicity of a single gamma exceeds 1" );
00216       break;
00217     }
00218   }
00219 }
00220 
00221 // ----------- multiplicity::list_interp ----------
00222 void multiplicity::list_interp( double e_in, multiplicity& left_list,
00223   multiplicity& right_list )
00224 // Make a null list to be used for discrete gamma multiplicities.
00225 {
00226   if( !empty() )
00227   {
00228     SevereError("multiplicity::list_interp",
00229         "You are trying to fill a multiplicity which has already been made");
00230   }
00231 
00232   // get the first incident energy
00233   multiplicity::iterator left_ptr = left_list.begin( );
00234   multiplicity::iterator right_ptr = right_list.begin( );
00235 
00236   double left_e_in = left_ptr->x;
00237   double right_e_in = right_ptr->x;
00238 
00239   dd_link XYdata;
00240   XYdata.x = ( left_e_in < right_e_in ) ? left_e_in : right_e_in;
00241   XYdata.y = 0.0;
00242   insert( end( ), XYdata );
00243 
00244   // get the last incident energy
00245   left_ptr = left_list.end( );
00246   --left_ptr;
00247   right_ptr = right_list.end( );
00248   --right_ptr;
00249 
00250   left_e_in = left_ptr->x;
00251   right_e_in = right_ptr->x;
00252 
00253   XYdata.x = ( left_e_in < right_e_in ) ? left_e_in : right_e_in;
00254   insert( end( ), XYdata );
00255 }

Generated on Thu Sep 7 10:30:13 2006 for fete -- From ENDFB6 To ENDL by doxygen 1.3.4