>>8
program decay
* by Hannah Newfield-Plunkett, June 2004
* A program to compute the beta decay energy spectra of various isotopes.
* Properties of the isotopes are input through a data file. A Gaussian smear is
* conducted on the energy spectra. Subroutines written by me are included,
* but the subroutines birks and dedxls are not.
real cs,p(500)
real rmin,rmax,norm,rate
character name*6, title*20, filename*20, hisfile*20
real rkb
common /cbirks/rkb
common /g_smear/res
real malpha
parameter (malpha=3727.379)
* Plots from this program were made using HBOOK commands in PAW. This is
* reflected in the syntax.
integer maxblk
parameter (maxblk = 1024*512)
common /pawc/h(maxblk)
call hlimit(maxblk)
read(*,*) res
read(*,*) bw
read(*,*) rmin
read(*,*) rmax
read(*,*) rkb
read(*,*) filename
nbins=int((rmax-rmin)/bw)
nbins2=int((5.-3.)/bw)
nbins3=int((5.-3.5)/bw)
indx = index(filename,' ')-1
write(hisfile,4) filename(:indx)
4 format(A,'.his')
call hropen(17,'decay',hisfile,'n',1024,istat)
open(unit=7,file=filename,status='old')
k=0
read (7,*) rate
read (7,*) norm
call hbook1(5000,'Total E spectrum',nbins,rmin,rmax,0.)
call hbook1(6000,'Total E spectrum',nbins,rmin,rmax,0.)
call hbook1(7000,'Total E spectrum',nbins2,3.,5.,0.)
call hbook1(8000,'Total E spectrum',nbins3,3.5,5.,0.)
read(7,*) B
10 if(B.ne.0) then
k=k+1
read(7,*) name,z,a
write(title,3) name
3 format('E spectrum ',A6)
read(7,*) cs
call hbook1(k,title,nbins,rmin,rmax,0.)
call hbook1(100*k,title,nbins,rmin,rmax,0.)
* number of modes of decay
read(7,*) n
do i=1,n
* information about each decay mode
read(7,*) Q,Qex,bf1,Eann,Eec,bf2,Qexalpha,bfalpha
if(Eann.eq.1.022) then
zz=-abs(z)
else
zz=abs(z)
endif
Eex=Q-Qexalpha-Qex
* quenching of alphas
vealpha=birks(malpha,2.,Qexalpha)*Qexalpha
offset1=(10.*(Eex+Eann)-int(10.*(Eex+Eann)))/10.
offset2=bw/2.-offset1
if(offset2.lt.0.) offset2=offset2+bw
if(bf1.ne.0.) then
bnorm=betaint(Qex-Eann,zz,a)
endif
do Te=offset2,Q,bw
if(bf1.ne.0.) then
* beta spectrum calculated from energy
bp=beta(Te-Eex-Eann,Qex-Eann,bw,bnorm,zz,a)
else
bp=0.
endif
if(Eec.ge.0..and.Te.ge.Eec-bw/2..and.Te.le.Eec+bw/2.)then
* electron capture branching fraction
x=bf2
else if(bfalpha.ne.0..and.Te.ge.vealpha+Eex-bw/2..and.
+ Te.le.vealpha+Eex+bw/2.) then
* alpha branching fraction
x=bfalpha
else
x=0.
endif
call hfill(k,Te,0.,cs*bf1*bp/norm*rate)
call hfill(5000,Te,0.,cs*bf1*bp/norm*rate)
call hfill(k,Te,0.,cs*x/norm*rate)
call hfill(5000,Te,0.,cs*x/norm*rate)
* performs gaussian smear
call gauss_smear(Te,bw,p,num)
j=1
if(j.eq.1) then
call hfill(6000,Te,0.,p(1)*cs*bf1*bp/norm*rate)
call hfill(7000,Te,0.,p(1)*cs*bf1*bp/norm*rate)
call hfill(8000,Te,0.,p(1)*cs*bf1*bp/norm*rate)
call hfill(100*k,Te,0.,p(1)*cs*bf1*
+ bp/norm*rate)
call hfill(6000,Te,0.,p(1)*cs*x/norm*rate)
call hfill(7000,Te,0.,p(1)*cs*x/norm*rate)
call hfill(8000,Te,0.,p(1)*cs*x/norm*rate)
call hfill(100*k,Te,0.,p(1)*cs*x/norm*rate)
endif
do j=2,num
call hfill(6000,Te+bw*(j-1),0.,p(j)*cs*bf1*
+ bp/norm*rate)
call hfill(7000,Te+bw*(j-1),0.,p(j)*cs*bf1*
+ bp/norm*rate)
call hfill(8000,Te+bw*(j-1),0.,p(j)*cs*bf1*
+ bp/norm*rate)
call hfill(100*k,Te+bw*(j-1),0.,p(j)*
+ cs*bf1*bp/norm*rate)
call hfill(6000,Te-bw*(j-1),0.,p(j)*cs*bf1*
+ bp/norm*rate)
call hfill(7000,Te-bw*(j-1),0.,p(j)*cs*bf1*
+ bp/norm*rate)
call hfill(8000,Te-bw*(j-1),0.,p(j)*cs*bf1*
+ bp/norm*rate)
call hfill(100*k,Te-bw*(j-1),0.,p(j)*
+ cs*bf1*bp/norm*rate)
call hfill(6000,Te+bw*(j-1),0.,p(j)*cs*x/norm*rate)
call hfill(7000,Te+bw*(j-1),0.,p(j)*cs*x/norm*rate)
call hfill(8000,Te+bw*(j-1),0.,p(j)*cs*x/norm*rate)
call hfill(100*k,Te+bw*(j-1),0.,p(j)*
+ cs*x/norm*rate)
call hfill(6000,Te-bw*(j-1),0.,p(j)*cs*x/norm*rate)
call hfill(7000,Te-bw*(j-1),0.,p(j)*cs*x/norm*rate)
call hfill(8000,Te-bw*(j-1),0.,p(j)*cs*x/norm*rate)
call hfill(100*k,Te-bw*(j-1),0.,p(j)*
+ cs*x/norm*rate)
enddo
enddo
enddo
read(7,*) B
goto 10
endif
close(7)
call hrout(0,icycle,' ')
call hrend('decay')
close(17)
end
* ----------------------------------------------------------------
* ----------------------------------------------------------------
* Functions for the above program
function beta(x,Q,bw,bnorm,z,a)
* written by Hannah Newfield-Plunkett, June 2004
* Determines the beta decay energy spectrum of an isotope.
* Inputs: x=kinetic energy of beta
* Q=total energy of decay
* bw=bin width of histogram
* bnorm=normalization of beta function to 1
* z=charge of parent nucleus
* a=mass number of parent nucleus
real*8 me
parameter (me=.510999D0)
if (x.le.0..or.x.ge.Q) then
beta=0.
else
* special correction to beta spectrum of Bi-210 changes value
if(abs(z).eq.83..and.a.eq.210.) then
beta=sqrt(x**2+2*x*me)*(Q-x)**2*(x+me)/
c bnorm*bw*fermi(z,a,x)*bi210(x)
* same for K-40 (forbiddenness correction)
else if(abs(z).eq.19..and.a.eq.40.) then
beta=sqrt(x**2+2*x*me)*(Q-x)**2*(x+me)/
c bnorm*bw*fermi(z,a,x)*rk40(x,Q)
* otherwise, just calculates beta spectrum from Fermi theory
else
beta=sqrt(x**2+2*x*me)*(Q-x)**2*(x+me)/bnorm*bw*fermi(z,a,x)
endif
endif
return
end
*-------------------------------------------------------------------------
function rk40(x,Q)
* by Hannah Newfield-Plunkett
* forbiddenness correction to K40 decay
* Inputs: x=kinetic energy of beta
* Q=total energy of decay
real me
parameter (me=.510999)
pe=sqrt((x+me)**2-me**2)
qnu=Q-x
rk40=qnu**6.+pe**6.+7.*qnu**2.*pe**2.*(qnu**2.+pe**2.)
return
end
*--------------------------------------------------------------------------
function bi210(x)
* by Hannah Newfield-Plunkett
* special correction to Bi-210 decay
* Input: x=kinetic energy of beta
real me
parameter (me=.510999)
parameter(d=0.578)
parameter(b=28.466)
parameter(c=-0.658)
xx=x/me+1.
bi210=1.+d*xx+b/xx+c*xx**2
return
end
*------------------------------------------------------------------------
function betaint(Q,z,a)
* by Hannah Newfield-Plunkett
* integrates the beta function numerically for normalization
* Inputs: Q=total energy of decay
* z=charge of parent nucleus
* a=mass number of parent nucleus
betaint = 0.
do i=1,1000
bw = Q/1000.
x = (i-0.5)*Q/1000.
betaint = betaint + beta(x,q,bw,1.,z,a)
enddo
return
end
*-------------------------------------------------------------------------
real function fermi(z,a,x)
* written by Hannah Newfield-Plunkett
* Fermi correction to all beta spectra
* Inputs: z=charge of parent nucleus
* a=mass number of parent nucleus
* x=kinetic energy of beta
implicit double precision(a-h,o-z)
complex*16 wgamma
external wgamma
real z, a, x
real*8 rnu,g0
real*8 alpha, hbar, me, pi
parameter (alpha=1.D0/137.D0)
parameter (me=.510999D0)
parameter (pi=3.141592654D0)
complex*16 arg,cg
xx=x/me+1.
pe=sqrt(xx**2-1.)
g0=(1.-(alpha*z)**2)
rnu=alpha*z*xx/pe
r=a**(1./3.)
arg=complex(g0,rnu)
cg=wgamma(arg)
abscgsq=dreal(dconjg(cg)*cg)
temp=exp(pi*rnu)*abscgsq
fermi=temp*(pe*r)**(2.*(g0-1.))
return
end
* ---------------------------------------------------------------
* Gaussian smearing subroutine for decay.f and gamma.f
subroutine gauss_smear(Te,bw,p,num)
* written by Hannah Newfield-Plunkett, June 2004
* Determines the percentage of a Gaussian distribution in bins around a
* center bin with data in it.
* Inputs: Te=kinetic energy of beta
* bw=bin width of histogram
* Outputs: p=array containing fraction of distirbution in each bin,
* from mean to three sigma to the right
* num=number of elements in p
common /g_smear/res
real sqrt2
parameter (sqrt2=1.41423)
real p(*)
* standard deviation based on detector resolution
sig=res*sqrt(Te)
num=0
rnorm = 1.+erf(Te/sig/sqrt2)
* calculates amount of Gaussian distribution in each bin for 3 sigma
do i=0,int((3*sig)/bw+0.5)
num=num+1
p(i+1)=(erf(bw*(i+0.5)/sig/sqrt2)-
+ erf(bw*(i-0.5)/sig/sqrt2))/rnorm
enddo
return
end
* ---------------------------------------------------------------
* ---------------------------------------------------------------