module strs_mod
! Uses
use precision_mod
use physicalconstants_mod
use namelist_mod
use det_geom_mod
! Variables
integer, private, external :: dtt_read
real (kind=r8), private, external :: dtt_gettime
integer (kind=i4), private, parameter :: NX_IND = 201
integer (kind=i4), private, parameter :: NY_IND = 201
real (kind=r8), private :: x_inc = 0.0010
integer (kind=i4), private, PARAMETER :: MaxTimeBin = 3000
integer (kind=i4), private, PARAMETER :: MaxAngleBin = 200
real (kind=r4), public, DIMENSION(0:MaxAngleBin,0:MaxTimeBin) :: GARFIELD
real (kind=r4), public, DIMENSION(0:MaxAngleBin) :: MaxTime
real (kind=r4), private, DIMENSION(0:MaxAngleBin,0:MaxTimeBin) :: GARF_F1
real (kind=r4), private, DIMENSION(0:MaxAngleBin,0:MaxTimeBin) :: GARF_F2
! Subroutines and functions
public subroutine init_strs (nrun)
private subroutine create_STRs (NRUN, GARFIELD1, MaxTime1)
private subroutine interpolate (x, y, nPts, xout, yout, MaxTimeBin)
private subroutine linearInt (xa, ya, n, x, y)
private subroutine splint (xa, ya, y2a, n, x, y)
private subroutine spline (x, y, y2, n)
end module strs_mod
integer, private, external :: dtt_read
real (kind=r8), private, external :: dtt_gettime
integer (kind=i4), private, parameter :: NX_IND = 201
integer (kind=i4), private, parameter :: NY_IND = 201
real (kind=r8), private :: x_inc = 0.0010
integer (kind=i4), private, PARAMETER :: MaxTimeBin = 3000
integer (kind=i4), private, PARAMETER :: MaxAngleBin = 200
real (kind=r4), public, DIMENSION(0:MaxAngleBin,0:MaxTimeBin) :: GARFIELD
real (kind=r4), public, DIMENSION(0:MaxAngleBin) :: MaxTime
real (kind=r4), private, DIMENSION(0:MaxAngleBin,0:MaxTimeBin) :: GARF_F1
real (kind=r4), private, DIMENSION(0:MaxAngleBin,0:MaxTimeBin) :: GARF_F2
public subroutine init_strs (nrun)
integer (kind=i4), intent(in) :: nrun
! Calls: create_strs
end subroutine init_strs
Date: May 24,2001
Mod Art Olin to avoid compiler bug and localize code
Entry routine from MOFIA to create the STRs
.
Called from ReadCalib in calibrations_mod
**********************************************************************
Author: : Roy Wilds
private subroutine create_STRs (NRUN, GARFIELD1, MaxTime1)
integer (kind=i4), INTENT(IN) :: NRUN
real (kind=r4), dimension(0:MaxAngleBin,0:MaxTimeBin), INTENT(OUT) :: GARFIELD1
real (kind=r4), dimension(0:maxanglebin), INTENT(OUT) :: MaxTime1
! Calls: Interpolate, fill_STRs, generate_tracksX, generate_tracksY, kerror, kerror2, sortzv
end subroutine create_STRs
Date: May 24,2001
Procedure is:
-Set the parameters for the STRs.
-Read in the Drift Time Table.
-Loop thru angles from 0 to upperlimit:
-Generate distances,times for straight tracks at current angle
-Interpolate d vs t to get d as a function of t, with specific
increments in t.
-Fill STR structure with current angle info.
-Move onto next angle.
-Finished.
Comments on creation of STRs:
The STRs produced by this method differ from those created using the old
method. For more information, check out:
http://e614slow.triumf.ca/e614/offline/garfield/index.html
This website is also accessible from the TWIST software page.
Author: : Roy Wilds
private subroutine interpolate (x, y, nPts, xout, yout, MaxTimeBin)
real, INTENT(INOUT), dimension (:) :: x
real, INTENT(INOUT), dimension (:) :: y
integer, INTENT(INOUT) :: nPts
integer, INTENT(OUT), dimension (:) :: xout
real, INTENT(OUT), dimension (:) :: yout
integer, INTENT(IN) :: MaxTimeBin
! Calls: spline, splint
end subroutine interpolate
Author: Roy Wilds
Date: May 24,2001
Majority of code has been taken from Sun-Chong's garfield_to_mofia
program. See specific routines below for details on code sources.
Method is to use a piece-wise cubic spline fit to take the
x,y values (which are initially in constant increments
of y), and calculate values of y for constant
increments in x.
private subroutine linearInt (xa, ya, n, x, y)
real, DIMENSION(n), INTENT (IN) :: xa
real, DIMENSION(n), INTENT (IN) :: ya
integer, INTENT (IN) :: n
real, INTENT (IN) :: x
real, INTENT (OUT) :: y
end subroutine linearInt
private subroutine splint (xa, ya, y2a, n, x, y)
real, DIMENSION(n), INTENT (IN) :: xa
real, DIMENSION(n), INTENT (IN) :: ya
real, DIMENSION(n), INTENT (IN) :: y2a
integer, INTENT (IN) :: n
real, INTENT (IN) :: x
real, INTENT (OUT) :: y
end subroutine splint
private subroutine spline (x, y, y2, n)
real, DIMENSION(n), INTENT (IN) :: x
real, DIMENSION(n), INTENT (IN) :: y
real, DIMENSION(n), INTENT (INOUT) :: y2
integer, intent (in) :: n
! Calls: kerror
end subroutine spline