00001 // -*- C++ -*- $Id: photo.cxx,v 1.1 2000/09/01 20:20:21 burnett Exp $ 00002 // 00003 // This file is part of Gismo 2 00004 00005 #include "EGS.h" 00006 #include "PEGSData.h" 00007 #include "Random.h" 00008 00009 void EGS::photo(const PEGSData& mat) 00010 { 00011 // adapted from egs4 subroutine photo 00012 // ---------------------------------- 00013 // k-edge version -- 27 jul 1988/2300 00014 //****************************************************************** 00015 //******* special version for treating k-edge fluorescence ********* 00016 //****************************************************************** 00017 // programmers: w. r. nelson and t. m. jenkins (slac) 00018 // a.f. bielajew (nrc) photoelectric angular distn 00019 // d.w.o. rogers (nrc) document 00020 //****************************************************************** 00021 // this is a special k-edge version of an egs4 subroutine that is 00022 // patterned after a method developed in 1978 by a. clark (lbl) 00023 // with the help of w. r. nelson (slac). it requires subroutine 00024 // edgset (or equivalent for setting up the branching ratios and 00025 // fluorescent photon energies). 00026 // 00027 // this version adds selection of photo-electron angle 00028 // see 'photoelectron angle selection in the egs4 code system' 00029 // a.f. bielajew and d.w.o. rogers, nrc report pirs-0052,oct 86 00030 // 00031 // this requires a redefinition of $comin-photo which is done 00032 // in nrcc4mac(p).mor and definition of the macro 00033 // $select-photoelectron-direction (nrcc4mac(p).mor) 00034 // to select the a.d. in any region, one must set the variable 00035 // iphter(ir(np))=1 passed in comin/user; 00036 // 00037 // this version uses a simple model of k-shell fluorescence. 00038 // to sample fluorescent x-rays from the k-shell in a given region 00039 // the flag iedgfl(ir(np)) (in comin/edge) must be set non-zero 00040 // for each region; the value of iedgfl is the value of z used for 00041 // that region - the model must treat the region as a single 00042 // element for the selection of the fluorescent x-ray. 00043 // 00044 // the routine edgset(region1,region2) must be called for each 00045 // sequence of regions region1 to region2 for which the fluorescent 00046 // x-rays are to be sampled and iedgfl is set. 00047 // 00048 // the relevant arrays are all zeroed at the end of egs4blok so 00049 // that if the user initializes nothing, the code is the same as 00050 // the egs4 default system - i.e. no fluorescent x-rays and no 00051 // photo-electron a.d. 00052 // 00053 // the output from this routine is complex. 00054 // e < be => edep = e, iblobe=1 00055 // e > be no k-shell with k-shell 00056 // enew = 0.0 enew = 0, or kalpha 00057 // edep = binda edep = ebinda - enew 00058 // e(np) = edep e(np) = edep 00059 // 00060 // then iarg = 4 call is made i.e. energy discarded in middle 00061 // 00062 // then 00063 // e<be e(np) = 0 with iq=0, no e- is set up iblobe = 1 still 00064 // e>be iq(np) = -1, e(np) = einitial - ebinda+rm 00065 // and if flags on for fluorescence and sampled, then 00066 // np => np + 1 and a gamma is set up 00067 // 00068 // 00069 //****************************************************************** 00070 // $energy precision peig; 00071 // $comin-photo; //the next line is the default replacement for this 00072 //;comin/debug,edge,epcont,media,photin,stack,uphiot,useful/; 00073 //but for the photo-electron angle selection, see definition in nrcc4mac(p) 00074 00075 float eig = this->e, 00076 enew, edep, 00077 br = 0;; 00078 00079 double peig=eig, 00080 prm = rm; 00081 int iblobe; 00082 00083 if (eig <= mat.ebinda()) 00084 { edep=peig; iblobe=1; //below k-edge 00085 } 00086 else 00087 { // 'k-edge p.e. is possible' 00088 if ( mat.edge.iedgfl ) 00089 { // 'fluorescent option on' 00090 br=Random::flat();; //sample to decide k-edge photon versus either 00091 // auger electron or l-edge p.e. interaction 00092 00093 enew = (br > mat.edge.bkr1) 00094 ? 0.0 //k-edge photon not selected 00095 : (br <= mat.edge.bkr2) 00096 ? mat.edge.ekalph //alpha 00097 : mat.edge.ekbeta; //beta 00098 00099 00100 } 00101 else enew=0.0; //fluorescent option off 00102 00103 edep = mat.ebinda()-enew; 00104 this->e= edep; 00105 iblobe=0; //flag indicating 'not' below binding energy 00106 00107 } 00108 00109 // $auscall($photxaus); 00110 00111 if (iblobe) this->e=0; //below k-edge flag is on 00112 else 00113 { // 'set up particle(s) 00114 00115 this->iq =-1; //photoelectron (always set up) 00116 this->e =peig-mat.ebinda()+prm; 00117 // $select-photoelectron-direction;//defined in nrcc4mac(p).mor 00118 00119 if ( mat.edge.iedgfl) 00120 { //set up fluorescent photon 00121 if ( br > mat.edge.bkr1) return; //however, k-edge not chosen above 00122 EGS& gam = *new EGS(this); 00123 // np=np+1; 00124 gam.e =enew; 00125 gam.iq=0; 00126 00127 //photon comes off isotropically 00128 float rniso= Random::flat(); 00129 float costhe = 2.0*rniso-1.0; 00130 float phi = Random::flat(2.*M_PI); 00131 gam.u=0.0; gam.v=0.0; gam.w=1.0; //makes things easier in rotate 00132 gam.rotate(costhe, phi); 00133 //end of fluorescent photon set up 00134 } 00135 //end of 'set up particle(s)' loop 00136 } 00137 00138 00139 } //end of subroutine photo 00140
1.2.3 written by Dimitri van Heesch,
© 1997-2000