00001 // -*- C++ -*- $Id: Elecin.h,v 1.1 2000/09/01 20:20:15 burnett Exp $ 00002 // 00003 // This file is part of Gismo 2 00004 00005 00006 00007 #ifndef __ELECIN_H 00008 #define __ELECIN_H 00009 00010 #include "facilities/error.h" 00011 00012 #include <iostream> 00013 00014 class Elecin // electron cross sections in this material 00015 { 00016 friend class PEGSData; // this only accessible from PEGSData 00017 00018 float eold, // last energy (in MeV) 00019 loge; // log of E 00020 int index; // index 00021 00022 float eke0,eke1; 00023 00024 float xr0,teff0,blcc,xcc; 00025 00026 int meke ; // actual dimension following arrays 00027 float *esig0, *esig1, 00028 *psig0, *psig1, 00029 *ededx0, *ededx1, 00030 *pdedx0, *pdedx1, 00031 *ebr10, *ebr11, 00032 *pbr10, *pbr11, 00033 *pbr20, *pbr21, 00034 *tmxs0, *tmxs1; 00035 00036 Elecin():meke(0){eold=-1.;} // constructor 00037 00038 void updateIndex(float enew) const; 00039 // calculate new index if energy changes 00040 00041 float esig()const; 00042 float psig()const; 00043 float ededx()const; 00044 float pdedx()const; 00045 float ebr1()const; 00046 float pbr1()const; 00047 float pbr2()const; 00048 float tmxs()const; 00049 // the interpolating functions (should have designed a macro) 00050 00051 void readPEGS(std::istream&, int); 00052 void rescale(float); 00053 void fixtmx(float); 00054 // special routine that recalculates tmxs 00055 00056 public: 00057 ~Elecin(); 00058 }; 00059 /* 00060 inline void 00061 Elecin::updateIndex(float enew) const 00062 { 00063 if (enew == eold) return; 00064 Elecin * self = (Elecin *)this; 00065 self->loge = log(enew); 00066 self->index= (int)(eke1*loge + eke0 -1); // note -1 for C arrays 00067 if (index>=meke) 00068 { FATAL("Electin: energy too large for table"); 00069 } 00070 self->eold = enew; 00071 } 00072 inline float Elecin::esig()const{return esig1[index]*loge + esig0[index];} 00073 inline float Elecin::psig()const{return psig1[index]*loge + psig0[index];} 00074 inline float Elecin::ededx()const{return ededx1[index]*loge +ededx0[index];} 00075 inline float Elecin::pdedx()const{return pdedx1[index]*loge +pdedx0[index];} 00076 inline float Elecin::ebr1()const{return ebr11[index]*loge + ebr10[index];} 00077 inline float Elecin::pbr1()const{return pbr11[index]*loge + pbr10[index];} 00078 inline float Elecin::pbr2()const{return pbr21[index]*loge + pbr20[index];} 00079 inline float Elecin::tmxs()const{return tmxs1[index]*loge + tmxs0[index];} 00080 */ 00081 #endif 00082
1.2.3 written by Dimitri van Heesch,
© 1997-2000