C program for neutron efficiency

From New IAC Wiki
Revision as of 16:19, 5 May 2008 by Oborn (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

/**************************************************************************

* Author: Rebecca Bodily
* Date: 05/02/2008
* Organization: Idaho State University
*************************************************************************/
  1. include <iostream>
  2. include <cmath>

using namespace std;

double crossSectionHydrogenFunction(); double numberCarbonFunction(double thickness, const double

                           CUBICCENTIMETERCARBON);

double numberHydrogenFunction(double thickness, const double

                             CUBICCENTIMETERHYDROGEN);

double crossSectionCarbonFunction(); void efficiencyFunction(double numberHydrogen, double

                       numberCarbon, double
                       crossSectionHydrogen, double
                       crossSectionCarbon, double thickness);

/*************************************************************************

* This program is to find the
* efficiency of a neutron detector.
************************************************************************/

double main() {

 double neutronEnergy;
 double numberHydrogen;
 double numberCarbon;
 double crossSectionHydrogen;
 double crossSectionCarbon;
 double thickness;
 const double CUBICCENTIMETERCARBON = 5.23e22;
 const double CUBICCENTIMETERHYDROGEN = 4.74e22;
 cout << endl;
 cout << "Enter thickness of detector (in centimeters): ";
 cin >> thickness;
 crossSectionHydrogen = crossSectionHydrogenFunction();
 numberCarbon = numberCarbonFunction(thickness,
                                     CUBICCENTIMETERCARBON);
 numberHydrogen = numberHydrogenFunction(thickness,
                                         CUBICCENTIMETERHYDROGEN);
 crossSectionCarbon = crossSectionCarbonFunction();
 efficiencyFunction(numberHydrogen, numberCarbon,
                    crossSectionHydrogen, crossSectionCarbon,
                    thickness);

}

/***********************************************************************

 * Equation for cross section of hydrogen according to
 * equation 15-9 from Radiation Detection and Measurement
 *                                   by Glenn Knoll
 *********************************************************************/
 double crossSectionHydrogenFunction()
   {
     double neutronEnergy;
     double crossSectionHydrogen;
     cout << endl;
     cout << "Enter neutron energy (in MeV): ";
     cin >> neutronEnergy;
     crossSectionHydrogen = ((4.83 / sqrt(neutronEnergy))
                             - .578e-24);
     return crossSectionHydrogen;
   }

/**********************************************************************

* Equation for calculating the number of Carbons in
* the problem per cubic centimeter, dependent on what
* the user put in for the thickness of the detector.
*********************************************************************/

double numberCarbonFunction(double thickness, const

                           double CUBICCENTIMETERCARBON)

{

 double numberCarbon;
 numberCarbon = thickness * CUBICCENTIMETERCARBON;
 return numberCarbon;

}

/*********************************************************************

* Equation for calculating the number of Hydrogens in
* the problem per cubic centimeter, dependent on what
* the user put in for the thickness of the detector.
********************************************************************/

double numberHydrogenFunction(double thickness, const

                             double CUBICCENTIMETERHYDROGEN)

{

 double numberHydrogen;
 numberHydrogen = thickness * CUBICCENTIMETERHYDROGEN;
 return numberHydrogen;

}

/*********************************************************************

* Requesting the cross section from the Knoll book, and
* then calculating it from barns to centimeters.
********************************************************************/

double crossSectionCarbonFunction() {

 double crossSectionCarbon;
 cout << endl;
 cout << "Enter the cross section of Carbon by "
      << "looking in Radiation" << endl
      << "Detection and Measurement by Glenn Knoll, on"
      << " page 535, " << endl
      << "Figure 15-15b (in square centimeters): ";
 cin >> crossSectionCarbon;
 return crossSectionCarbon;

}

/********************************************************************

 * Equation for efficiency according to equation 15-8b
 * from Radiation Detection and Measurement
 *                            by Glenn Knoll
 ******************************************************************/
void efficiencyFunction(double numberHydrogen, double
                        numberCarbon, double crossSectionHydrogen,
                        double crossSectionCarbon, double
                        thickness)
{
    double efficiency;
    double nHcH = numberHydrogen * crossSectionHydrogen;
    double nCcC = numberCarbon * crossSectionCarbon;
    efficiency = (((nHcH) / (nHcH + nCcC)) * (1-exp(-(nHcH
                                                  + nCcC))
                                            * thickness) * 100);
    cout.precision(4);
    cout << endl;
    cout << "Therefore, the efficiency of our "
         << "system is: " << efficiency << "%" << endl;
    cout << endl;
    return;
  }