Page MenuHomeHEPForge

old_S95tables_functions.f90
No OneTemporary

old_S95tables_functions.f90

!******************************************************************
module old_S95tables_functions
! contains functions which have been superceeded by newer,better functions in S95tables.f90, but which
! can still be useful for testing the new functions.
!******************************************************************
use S95tables
use S95tables_type1
use S95tables_type2
use S95tables_type3
contains
!******************************************************************
subroutine find_M0(ttype,tlist,datcomp,fact,massi_in,massj_in,log10sf_in,m_interpol,Mass0,n_points)
!******************************************************************
!for table type1, calls
!for table type2, calls
!******************************************************************
use usefulbits, only : listprocesses !internal
use interpolate
use S95tables_type1
use S95tables_type3
implicit none
!--------------------------------------input
double precision,intent(in) :: fact
integer,intent(in) :: ttype,tlist,datcomp
double precision,intent(in) :: massi_in,massj_in,log10sf_in
!-------------------------------------output
double precision,intent(out) :: Mass0
double precision,intent(out) :: m_interpol(:)
integer,intent(out) ::n_points
!-----------------------------------internal
type(table1) :: f_t1_for_findM0
double precision :: targt
!-------------------------------------------
targt=fact
if(size(m_interpol,dim=1).ne.n_points_max)stop'wrong input to find_M0'
if(targt.lt.0.0D0)then
Mass0 = -2.0D0
else
select case(ttype)
case(0) ! no channel applies
Mass0 = 0.0D0
case(1)
call interpolate_1D_inv(targt,S95_t1(tlist),datcomp,massj_in,m_interpol,Mass0,n_points)
case(2)
call f_at_const_m2(S95_t2(tlist),S95_t2(tlist)%xmin1,S95_t2(tlist)%xmax1,datcomp,massj_in,f_t1_for_findM0,0.0D0,0.1D0)
call interpolate_1D_inv(targt,f_t1_for_findM0,1,massi_in,m_interpol,Mass0,n_points)
deallocate(f_t1_for_findM0%dat)
case(3)
call f_at_const_massratio_and_log10sf(clsb_t3(tlist),clsb_t3(tlist)%xmin1,clsb_t3(tlist)%xmax1, &
& datcomp,massi_in,massj_in,log10sf_in,f_t1_for_findM0,0.0D0,0.1D0)
call interpolate_1D_inv(targt,f_t1_for_findM0,1,massi_in,m_interpol,Mass0,n_points)
deallocate(f_t1_for_findM0%dat)
case default
stop'wrong input to subroutine find_M0 in module S95tables'
end select
endif
end subroutine find_M0
!******************************************************************
subroutine f_at_const_m2(t2,x1lower,x1higher,datcomp,mass2,f_t1,valueoutsidetable,sepmultfactor)
!******************************************************************
! fill the f_t1 array with the information from a t2 array at constant mass2
! should contain lots of components.
! do not forget to deallocate dat
use S95tables_type1
use S95tables_type2
use interpolate
implicit none
type(table2), intent(in) :: t2
type(table1) :: f_t1
double precision, intent(in) :: mass2,x1lower,x1higher,valueoutsidetable
double precision, intent(in) :: sepmultfactor
integer, intent(in) :: datcomp
integer :: ilower,ihigher,ii
double precision ::mass1,interpol
if(x1lower.gt.x1higher)then
stop'wrong input to subroutine f_at_const_m2 (2)'
endif
! we want f_t1%xmin to be lower than x1lower
if((x1lower -t2%xmin1).ge.0.0D0)then
ilower = int((x1lower -t2%xmin1)/t2%sep1)+1
else !off lower edge of table
ilower = int((x1lower -t2%xmin1)/t2%sep1)+1-1 !-1 since int rounds up for negative numbers
endif
ihigher = int((x1higher-t2%xmin1)/t2%sep1)+2 ! we want f_t1%xmax to be higher than x1higher
f_t1%xmin = dble(ilower - 1)*t2%sep1+t2%xmin1
f_t1%xmax = dble(ihigher - 1)*t2%sep1+t2%xmin1
f_t1%id = t2%id
f_t1%sep = t2%sep1 *sepmultfactor
f_t1%deltax = t2%deltax
f_t1%nx=nint((f_t1%xmax-f_t1%xmin)/f_t1%sep)+1
allocate(f_t1%dat(f_t1%nx,1))
do ii=1,f_t1%nx
mass1 = dble(ii-1)*f_t1%sep + f_t1%xmin
if( mass1.lt.t2%xmin1)then
f_t1%dat(ii,1)=valueoutsidetable
elseif(mass1.gt.t2%xmax1)then
f_t1%dat(ii,1)=valueoutsidetable
else
mass1 = dble(ii-1)*f_t1%sep + f_t1%xmin
call interpolate_tabletype2(mass1,mass2,t2,datcomp,interpol)
f_t1%dat(ii,1)=interpol
endif
enddo
end subroutine f_at_const_m2
!******************************************************************
subroutine f_at_const_m1(t2,vmasslower,vmasshigher,datcomp,mass1,mass2,f_t1, &
& valueoutsidetable,sepmultfactor)
!******************************************************************
! fill the f_t1 array with the information from a t2 array at constant mass1
! should contain lots of components.
! do not forget to deallocate dat
use S95tables_type1
use interpolate
implicit none
type(table2), intent(in) :: t2
type(table1) :: f_t1
double precision, intent(in) :: mass1,mass2,vmasslower,vmasshigher,valueoutsidetable
double precision, intent(in) :: sepmultfactor
integer, intent(in) :: datcomp
integer :: i,ilower,ihigher
double precision :: interpol,varyingmass,constantmass
double precision :: vmass_xmin,vmass_xmax,vmass_sep
if(vmasslower.gt.vmasshigher)then
stop'wrong input to subroutine f_at_const_mass (2)'
endif
f_t1%id = t2%id
f_t1%deltax = t2%deltax
vmass_xmin = t2%xmin2
vmass_xmax = t2%xmax2
vmass_sep = t2%sep2
f_t1%sep = t2%sep2*sepmultfactor
constantmass = mass1
! we want f_t1%xmin to be lower than x1lower
if((vmasslower -vmass_xmin).ge.0.0D0)then
ilower = int((vmasslower -vmass_xmin)/vmass_sep)+1
else !off lower edge of table
ilower = int((vmasslower -vmass_xmin)/vmass_sep)+1-1 !-1 since int rounds up for negative numbers
endif
ihigher = int((vmasshigher-vmass_xmin)/vmass_sep)+2 ! we want f_t1%xmax to be higher than x1higher
f_t1%xmin = dble(ilower - 1)*vmass_sep + vmass_xmin
f_t1%xmax = dble(ihigher - 1)*vmass_sep + vmass_xmin
f_t1%nx=nint((f_t1%xmax-f_t1%xmin)/f_t1%sep)+1
allocate(f_t1%dat(f_t1%nx,1))
do i=1,ubound(f_t1%dat,dim=1)
varyingmass = dble(i-1)*f_t1%sep + f_t1%xmin
if( varyingmass.lt.vmass_xmin )then
f_t1%dat(i,1)=valueoutsidetable
elseif( varyingmass.gt.vmass_xmax )then
f_t1%dat(i,1)=valueoutsidetable
elseif(( t2%needs_M2_gt_2M1 ).and.(2.0D0*constantmass>varyingmass))then
f_t1%dat(i,1)=valueoutsidetable
elseif((.not.(t2%needs_M2_gt_2M1)).and.(constantmass>varyingmass))then
f_t1%dat(i,1)=valueoutsidetable
else
call interpolate_tabletype2(constantmass,varyingmass,t2,datcomp,interpol)
f_t1%dat(i,1)=interpol
endif
enddo
end subroutine f_at_const_m1
!******************************************************************
subroutine f_at_const_massratio(t2,vmasslower,vmasshigher,datcomp,mass1,mass2,f_t1, &
& valueoutsidetable,sepmultfactor)
!******************************************************************
! fill the f_t1 array with the information from a t2 array at constant mass2/mass1
! should contain lots of components.
! do not forget to deallocate dat
use S95tables_type1
use interpolate
implicit none
type(table2), intent(in) :: t2
type(table1) :: f_t1
double precision, intent(in) :: mass1,mass2,vmasslower,vmasshigher,valueoutsidetable
double precision, intent(in) :: sepmultfactor
integer, intent(in) :: datcomp
integer :: i,ilower,ihigher
double precision :: interpol,varyingmass,constantmass,varyingmass_higher
double precision :: vmass_xmin,vmass_xmax,vmass_sep
if(vmasslower.gt.vmasshigher)then
stop'wrong input to subroutine f_at_const_massratio (2)'
endif
f_t1%id = t2%id
f_t1%deltax = t2%deltax
vmass_xmin = t2%xmin1
vmass_xmax = t2%xmax1
vmass_sep = t2%sep1
f_t1%sep = t2%sep1*sepmultfactor
constantmass = t2%xmin2
! we want f_t1%xmin to be lower than x1lower
if((vmasslower -vmass_xmin).ge.0.0D0)then
ilower = int((vmasslower -vmass_xmin)/vmass_sep)+1
else !off lower edge of table
ilower = int((vmasslower -vmass_xmin)/vmass_sep)+1-1 !-1 since int rounds up for negative numbers
endif
ihigher = int((vmasshigher-vmass_xmin)/vmass_sep)+2 ! we want f_t1%xmax to be higher than x1higher
f_t1%xmin = dble(ilower - 1)*vmass_sep + vmass_xmin
f_t1%xmax = dble(ihigher - 1)*vmass_sep + vmass_xmin
f_t1%nx=nint((f_t1%xmax-f_t1%xmin)/f_t1%sep)+1
allocate(f_t1%dat(f_t1%nx,1))
do i=1,ubound(f_t1%dat,dim=1)
varyingmass = dble(i-1)*f_t1%sep + f_t1%xmin
varyingmass_higher = varyingmass*(mass2/mass1)
if( varyingmass.lt.vmass_xmin )then
f_t1%dat(i,1)=valueoutsidetable
elseif( varyingmass.gt.vmass_xmax )then
f_t1%dat(i,1)=valueoutsidetable
elseif(( t2%needs_M2_gt_2M1 ).and.(2.0D0*varyingmass>varyingmass_higher))then
f_t1%dat(i,1)=valueoutsidetable
elseif((.not.(t2%needs_M2_gt_2M1)).and.(varyingmass>varyingmass_higher))then
f_t1%dat(i,1)=valueoutsidetable
else
call interpolate_tabletype2(varyingmass,varyingmass_higher,t2,datcomp,interpol)
f_t1%dat(i,1)=interpol
endif
enddo
end subroutine f_at_const_massratio
!******************************************************************
!******************************************************************
subroutine f_at_const_massratio_and_log10sf(t3,vmasslower,vmasshigher,datcomp,mass1,mass2,log10sf,f_t1, &
& valueoutsidetable,sepmultfactor)
!******************************************************************
! fill the f_t1 array with the information from a t3 array at constant mass2/mass1 and sf
! should contain lots of components.
! do not forget to deallocate dat
use S95tables_type1
use S95tables_type3
use interpolate
implicit none
type(table3), intent(in) :: t3
type(table1) :: f_t1
double precision, intent(in) :: mass1,mass2,log10sf,vmasslower,vmasshigher,valueoutsidetable
double precision, intent(in) :: sepmultfactor
integer, intent(in) :: datcomp
integer :: i,ilower,ihigher,a
double precision :: interpol,varyingmass,constantmass
double precision :: othermass
double precision :: vmass_xmin,vmass_xmax,vmass_sep
if(vmasslower.gt.vmasshigher)then
stop'wrong input to subroutine f_at_const_massratio_and_log10sf (2)'
endif
f_t1%id = t3%id
f_t1%deltax = t3%deltax
vmass_xmin = t3%xmin1
vmass_xmax = t3%xmax1
vmass_sep = t3%sep1
f_t1%sep = t3%sep1*sepmultfactor
constantmass = t3%xmin2
! we want f_t1%xmin to be lower than x1lower
if((vmasslower -vmass_xmin).ge.0.0D0)then
ilower = int((vmasslower -vmass_xmin)/vmass_sep)+1
else !off lower edge of table
ilower = int((vmasslower -vmass_xmin)/vmass_sep)+1-1 !-1 since int rounds up for negative numbers
endif
ihigher = int((vmasshigher-vmass_xmin)/vmass_sep)+2 ! we want f_t1%xmax to be higher than x1higher
f_t1%xmin = dble(ilower - 1)*vmass_sep + vmass_xmin
f_t1%xmax = dble(ihigher - 1)*vmass_sep + vmass_xmin
f_t1%nx=nint((f_t1%xmax-f_t1%xmin)/f_t1%sep)+1
allocate(f_t1%dat(f_t1%nx,1))
do i=1,ubound(f_t1%dat,dim=1)
varyingmass = dble(i-1)*f_t1%sep + f_t1%xmin
select case(t3%type_of_assoc_table)
case(1)
othermass=constantmass
case(2)
othermass=varyingmass*(mass2/mass1)
case default
stop'error in subroutine f_at_const_massratio_and_log10sf'
end select
if( varyingmass.lt.vmass_xmin )then
f_t1%dat(i,1)=valueoutsidetable
elseif( varyingmass.gt.vmass_xmax )then
f_t1%dat(i,1)=valueoutsidetable
elseif((t3%type_of_assoc_table.eq.2).and.( t3%needs_M2_gt_2M1 ).and.(2.0D0*varyingmass>othermass))then
f_t1%dat(i,1)=valueoutsidetable
elseif((t3%type_of_assoc_table.eq.2).and.(.not.(t3%needs_M2_gt_2M1)).and.(varyingmass>othermass))then
f_t1%dat(i,1)=valueoutsidetable
else
call interpolate_tabletype3(varyingmass,othermass,log10sf,t3,datcomp,interpol)
f_t1%dat(i,1)=interpol
endif
enddo
end subroutine f_at_const_massratio_and_log10sf
!******************************************************************
subroutine f_at_const_mass_and_log10sf(t3,vmasslower,vmasshigher,datcomp,mass1,mass2,log10sf,f_t1, &
& valueoutsidetable,sepmultfactor)
!******************************************************************
! fill the f_t1 array with the information from a t3 array at constant mass1 and sf
! should contain lots of components.
! do not forget to deallocate dat
use S95tables_type1
use S95tables_type3
use interpolate
implicit none
type(table3), intent(in) :: t3
type(table1) :: f_t1
double precision, intent(in) :: mass1,mass2,log10sf,vmasslower,vmasshigher,valueoutsidetable
double precision, intent(in) :: sepmultfactor
integer, intent(in) :: datcomp
integer :: i,ilower,ihigher,a
double precision :: interpol,varyingmass,constantmass
double precision :: vmass_xmin,vmass_xmax,vmass_sep
if(vmasslower.gt.vmasshigher)then
stop'wrong input to subroutine f_at_const_mass_and_log10sf (2)'
endif
f_t1%id = t3%id
f_t1%deltax = t3%deltax
select case(t3%type_of_assoc_table)
case(1)
vmass_xmin = t3%xmin1
vmass_xmax = t3%xmax1
vmass_sep = t3%sep1
f_t1%sep = t3%sep1*sepmultfactor
constantmass = t3%xmin2
case(2)
vmass_xmin = t3%xmin2
vmass_xmax = t3%xmax2
vmass_sep = t3%sep2
f_t1%sep = t3%sep2*sepmultfactor
constantmass = mass1
end select
! we want f_t1%xmin to be lower than x1lower
if((vmasslower -vmass_xmin).ge.0.0D0)then
ilower = int((vmasslower -vmass_xmin)/vmass_sep)+1
else !off lower edge of table
ilower = int((vmasslower -vmass_xmin)/vmass_sep)+1-1 !-1 since int rounds up for negative numbers
endif
ihigher = int((vmasshigher-vmass_xmin)/vmass_sep)+2 ! we want f_t1%xmax to be higher than x1higher
f_t1%xmin = dble(ilower - 1)*vmass_sep + vmass_xmin
f_t1%xmax = dble(ihigher - 1)*vmass_sep + vmass_xmin
f_t1%nx=nint((f_t1%xmax-f_t1%xmin)/f_t1%sep)+1
allocate(f_t1%dat(f_t1%nx,1))
do i=1,ubound(f_t1%dat,dim=1)
varyingmass = dble(i-1)*f_t1%sep + f_t1%xmin
if( varyingmass.lt.vmass_xmin )then
f_t1%dat(i,1)=valueoutsidetable
elseif( varyingmass.gt.vmass_xmax )then
f_t1%dat(i,1)=valueoutsidetable
elseif((t3%type_of_assoc_table.eq.2).and.( t3%needs_M2_gt_2M1 ).and.(2.0D0*constantmass>varyingmass))then
f_t1%dat(i,1)=valueoutsidetable
elseif((t3%type_of_assoc_table.eq.2).and.(.not.(t3%needs_M2_gt_2M1)).and.(constantmass>varyingmass))then
f_t1%dat(i,1)=valueoutsidetable
else
select case(t3%type_of_assoc_table)
case(1)
call interpolate_tabletype3(varyingmass,constantmass,log10sf,t3,datcomp,interpol)
case(2)
call interpolate_tabletype3(constantmass,varyingmass,log10sf,t3,datcomp,interpol)
case default
stop'error in subroutine f_at_const_massratio_and_log10sf'
end select
f_t1%dat(i,1)=interpol
endif
enddo
end subroutine f_at_const_mass_and_log10sf
!******************************************************************
end module old_S95tables_functions

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 4:44 PM (18 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4019794
Default Alt Text
old_S95tables_functions.f90 (15 KB)

Event Timeline