00001
00002
00003
00004
00005 #ifndef __PHOTIN_H
00006 #define __PHOTIN_H
00007
00008 #include "facilities/error.h"
00009
00010 #include <iostream>
00011 #include <strstream>
00012
00013 #include <cmath>
00014 class Photin
00015 {
00016 friend class PEGSData;
00017 public:
00018
00019 ~Photin();
00020
00021
00022 float rsct(float xxx)const;
00023
00024
00025 private:
00026 float ebinda;
00027
00028 float volatile eold;
00029 float volatile loge;
00030 int volatile index;
00031
00032 float ge0, ge1;
00033
00034 int mge;
00035 float *gmfp0, *gmfp1,
00036 *gbr10, *gbr11,
00037 *gbr20, *gbr21,
00038 *cohe0, *cohe1;
00039
00040 Photin():mge(0){eold = -1.;}
00041
00042
00043 void updateIndex(float enew) const
00044 { if (enew == eold) return;
00045 #if 1
00046 Photin * self = const_cast<Photin*>(this);
00047 self->loge = log(enew);
00048 self->index= (int)(ge1*loge + ge0 -1);
00049 if (index>=mge) {
00050 std::ostrstream msg;
00051 msg << "Photin: photon energy, " << enew
00052 << "MeV, index "<< index << ", exceeds ap, mge= " << mge << '\0';
00053 FATAL(msg.str());
00054 }
00055 self->eold = enew;
00056 #else // use volatile
00057 loge = log(enew);
00058 index= (int)(ge1*loge + ge0 -1);
00059 if (index>=mge)
00060 {
00061 FATAL("Photin: photon energy exceeds parameter ap");
00062 }
00063 eold = enew;
00064 #endif
00065 }
00066
00067
00068 float gmfp()const{return gmfp1[index]*loge + gmfp0[index];}
00069 float gbr1()const{return gbr11[index]*loge + gbr10[index];}
00070 float gbr2()const{return gbr21[index]*loge + gbr20[index];}
00071 float cohe()const{return cohe1[index]*loge + cohe0[index];}
00072
00073 float rco0, rco1;
00074
00075 int ngr;
00076 float *rsct0, *rsct1;
00077
00078
00079 void readPEGS(std::istream&, int, int);
00080 void rescale(float);
00081
00082 };
00083
00084 #endif
00085