Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

PEGSData.h

Go to the documentation of this file.
00001 // -*- C++ -*-  $Id: PEGSData.h,v 1.1 2000/09/01 20:20:16 burnett Exp $
00002 //
00003 // This file is part of Gismo 2
00004 
00005 #ifndef __PEGSDATA_H
00006 #define __PEGSDATA_H
00007 
00008 #include "gismo/Material.h"
00009 #include "gismo/MatData.h"
00010 
00011 #include <iostream>
00012 
00013 #include <cstdlib>
00014 #include <algorithm>
00015 
00016 #include "egs/Photin.h"
00017 #include "egs/Brempr.h"
00018 #include "egs/Elecin.h"
00019 
00020 class PEGSData : public MatData
00021 {
00022     friend class EGS;
00023 public:
00024     PEGSData():ae(1E12f),ap(1E12f){};
00025     // default, null constructor
00026 
00027     ~PEGSData();
00028     // destructor
00029 
00030     void read(std::istream& in,  Material& mat);
00031     // read, from open stream
00032 
00033     MatData* copy()const {return new PEGSData();}
00034     // make a copy
00035 
00036     void read(std::istream&);
00037     // read data from open file in PEGS format
00038 
00039     // Access to PEGSData for the rest of the World
00040     float ecut() const {return ae;}
00041     float pcut() const {return ap;}
00042     float emax() const {return ue;}
00043     float pmax() const {return up;}
00044     float rl()  const {return rldu;}
00045 
00046     float hzbrang()const {return zbrang;} //harrison    
00047 
00048 
00049     float tmxs(float ke)const;
00050     // the maximum step size
00051 
00052     float meanFreePath(float e, int charge)const;
00053     float dedx(float  e, int charge) const;
00054     // return meanFreePath or dedx for electron, positron, or gamma
00055 
00056     enum channel {STOP, BREMS, MOLLER, ANNIH, BHABHA, PAIR, COMPT, PHOTO, RAYLEIGH};
00057     // define possible channels returned by chooseChannel
00058 
00059     PEGSData::channel chooseChannel(float ran,float e,int charge)const;
00060     // return a channel, given uniform random number, energy, charge
00061 
00062 
00063     static float estepe;
00064     // fractional eloss allowed per step, user-settable. If zero, use standard
00065     // EGS step size, otherwise, calls fixtmx to modify step sizes when material
00066     // is defined
00067 
00068     static int irayl;
00069     // user settable, to control use of Rayleigh option
00070 
00071     static const float rm;       // electron mass in MeV
00072     static const float dunit;    // distance unit, in cm
00073 
00074 
00075     void printHead1(std::ostream&);
00076     void printHead2(std::ostream&);
00077     void printOn(std::ostream&);
00078     // print info about this material
00079 
00080 private:
00081 
00082     float rldu;         // radiation length scaled to actual units
00083     int   iraylm;       // user has to set to use Rayleigh option
00084 
00085 
00086     float ae, ap,       // thresholds
00087         up, ue,
00088         te,
00089         thmoll; // Moller
00090 
00091     float zbrang;       // ((1/111)*zeff**(1/3))**2
00092 
00093 
00094     Brempr bp;          // brems and pair Bethe-Heitler function
00095     Elecin el;          // electron/postron cross sections
00096     Photin ph;          // photon cross sections
00097     Kedge  edge;        // stuff for the photoelectric
00098 
00099 public:
00100 
00101     // various cross sections, branching ratios
00102 
00103     float  esig(float e)const;
00104     float  psig(float e)const;
00105     float ededx(float e)const;
00106     float pdedx(float e)const;
00107     float  ebr1(float e)const;
00108     float  pbr1(float e)const;
00109     float  pbr2(float e)const;
00110 
00111     float  gmfp(float e)const;
00112     float  gbr1(float e)const;
00113     float  gbr2(float e)const;
00114     float  cohe(float e)const;
00115 
00116     float blcc()const{return el.blcc;}
00117     float xcc()const{return el.xcc;}
00118     float ebinda()const{return ph.ebinda;}
00119 
00120     float screening(float del, int lvx, int lvl)const { return bp.screening(del,lvx,lvl);}
00121     float alphi(int lvx)const{return bp.alphi[lvx];}
00122     float bpar(int lvx)const{return bp.bpar[lvx];}
00123 
00124 };
00125 
00126 // evaluate cross sections inline
00127 
00128 // electron/positron cross sections, eloss, branching fractions
00129 
00130 
00131 inline float PEGSData::esig(float ke)const
00132 {
00133     el.updateIndex(ke); return el.esig();
00134 }
00135 inline float PEGSData::psig(float ke)const
00136 {     el.updateIndex(ke); return el.psig();
00137 }
00138 
00139 inline float PEGSData::ededx(float ke)const
00140 {     el.updateIndex(ke); return el.ededx();
00141 
00142 }
00143 
00144 inline float PEGSData::pdedx(float ke)const
00145 {     el.updateIndex(ke); return el.pdedx();
00146 
00147 }
00148 
00149 inline float PEGSData::ebr1(float ke) const
00150 {     el.updateIndex(ke); return el.ebr1();
00151 
00152 }
00153 
00154 inline float
00155 PEGSData::pbr1(float ke)const
00156 {     el.updateIndex(ke); return el.pbr1();
00157 
00158 }
00159 
00160 inline float
00161 PEGSData::pbr2(float ke)const
00162 {     el.updateIndex(ke); return el.pbr2();
00163 
00164 }
00165 inline float
00166 PEGSData::tmxs(float ke)const
00167 {
00168 /* "the following [macro] limits the step size to values less than
00169 200*teff0.  this restriction, which is consistent with egs2,
00170 was found to be necessary after egs3 calculations were
00171 compared with experimental benchmarks.  see chapter 3 of slac-210"
00172     */
00173     el.updateIndex(ke); return std::min(el.tmxs(),200*el.teff0);
00174 }
00175 
00176 // photon mfp, branching fractions
00177 
00178 inline float
00179 PEGSData::gmfp(float eig)const
00180 {     ph.updateIndex(eig); return ph.gmfp();
00181 }
00182 
00183 inline float
00184 PEGSData::gbr1(float eig)const
00185 {     ph.updateIndex(eig); return ph.gbr1();
00186 }
00187 
00188 inline float
00189 PEGSData::gbr2(float eig)const
00190 {     ph.updateIndex(eig); return ph.gbr2();
00191 }
00192 
00193 inline float
00194 PEGSData::cohe(float eig)const
00195 {     ph.updateIndex(eig); return ph.cohe();
00196 }
00197 
00198 #endif
00199 

Generated at Wed Nov 21 12:20:26 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000