Module tec_mod

module tec_mod

        ! Uses
    use precision_mod
    use det_geom_mod
    use chambers_mod
    use tdc_mod
    use unp_mod
    use unpmc_mod
    use filters_mod
    use namelist_mod
    use classify_mod
    use hists_mod
    use user_hists_mod, ONLY: msor6nbins, msor6cmin,msor6binwid,        IDH_MSOR6_FIRSTHIST
    use calibrations_mod, ONLY: TCtmkpar, TCTcor, BField,          NXY_TC_IND,NZ_TC_IND,tc_table,tec_dttim,tec_dtpos,        tc_para,grid_step_TC, UseDataDerivedSTR,istrversion
    use pattern_mod
    use trackrange_mod
    use track_mod, ONLY: fNumHelixFits, fHelixFits, HelixFit_type
    use trackswim_mod, only : TrackToZ

        ! Variables
    integer, private :: MaxTCHit
    integer, private :: kMaxHit
    integer, private :: kMaxPlane
    integer, public, dimension (MaxTCHit) :: ITCP
    integer, public, dimension (MaxTCHit) :: ITCW
    integer, public, dimension (MaxTCHit) :: global_wire
    real (kind=R4), public, dimension (MaxTCHit) :: TCTIM
    real (kind=R4), public, dimension (MaxTCHit) :: TCWID
    real (kind=R4), public, dimension (MaxTCHit) :: TCZPOS
    real (kind=R4), public, dimension (kMaxHit,kMaxPlane) :: TCXYPOS
    real (kind=R4), public, dimension (MaxTCHit) :: TC_xy_TWIST
    integer (kind=I4), public :: TECXVisN
    integer (kind=I4), public :: TECYVisN
    real (kind=R4), public, dimension (kMaxHit) :: TECXVisT
    real (kind=R4), public, dimension (kMaxHit) :: TECXVisW
    real (kind=R4), public, dimension (kMaxHit) :: TECXVisZ
    real (kind=R4), public, dimension (kMaxHit) :: TECYVisT
    real (kind=R4), public, dimension (kMaxHit) :: TECYVisW
    real (kind=R4), public, dimension (kMaxHit) :: TECYVisZ
    real (kind=R4), public, dimension (kMaxHit) :: TECXRes
    real (kind=R4), public, dimension (kMaxHit) :: TECYRes
    real (kind=R4), public, dimension (kMaxPlane) :: HitZSpan
    real (kind=R4), public, dimension (kMaxPlane) :: HitZRMS
    real (kind=R4), public, dimension (kMaxPlane) :: TCa0
    real (kind=R4), public, dimension (kMaxPlane) :: TCa1
    real (kind=R4), public, dimension (kMaxPlane) :: TCsd
    integer, public, dimension (kMaxPlane) :: TCifail
    integer, public :: TCNHIT
    integer, public :: nhits_in_scin
    integer, public :: failed_cptof_m12

        ! Subroutines and functions
    public subroutine TECanalysis ()
    public subroutine ClearImportantTECArrays ()
    public subroutine MyLineFit (N, X, Y, AA, BB, SD, IFAIL)
    private subroutine get_TEC_DTdistance (time, planeNo, wireNo, distance)

end module tec_mod

Description of Variables

MaxTCHit

integer, private :: MaxTCHit
 __________ public variables __________

kMaxHit

integer, private :: kMaxHit
 __________ public variables __________

kMaxPlane

integer, private :: kMaxPlane
 __________ public variables __________

ITCP

integer, public, dimension (MaxTCHit) :: ITCP

ITCW

integer, public, dimension (MaxTCHit) :: ITCW

global_wire

integer, public, dimension (MaxTCHit) :: global_wire

TCTIM

real (kind=R4), public, dimension (MaxTCHit) :: TCTIM

TCWID

real (kind=R4), public, dimension (MaxTCHit) :: TCWID

TCZPOS

real (kind=R4), public, dimension (MaxTCHit) :: TCZPOS

TCXYPOS

real (kind=R4), public, dimension (kMaxHit,kMaxPlane) :: TCXYPOS

TC_xy_TWIST

real (kind=R4), public, dimension (MaxTCHit) :: TC_xy_TWIST

TECXVisN

integer (kind=I4), public :: TECXVisN

TECYVisN

integer (kind=I4), public :: TECYVisN

TECXVisT

real (kind=R4), public, dimension (kMaxHit) :: TECXVisT

TECXVisW

real (kind=R4), public, dimension (kMaxHit) :: TECXVisW

TECXVisZ

real (kind=R4), public, dimension (kMaxHit) :: TECXVisZ

TECYVisT

real (kind=R4), public, dimension (kMaxHit) :: TECYVisT

TECYVisW

real (kind=R4), public, dimension (kMaxHit) :: TECYVisW

TECYVisZ

real (kind=R4), public, dimension (kMaxHit) :: TECYVisZ

TECXRes

real (kind=R4), public, dimension (kMaxHit) :: TECXRes

TECYRes

real (kind=R4), public, dimension (kMaxHit) :: TECYRes

HitZSpan

real (kind=R4), public, dimension (kMaxPlane) :: HitZSpan

HitZRMS

real (kind=R4), public, dimension (kMaxPlane) :: HitZRMS

TCa0

real (kind=R4), public, dimension (kMaxPlane) :: TCa0

TCa1

real (kind=R4), public, dimension (kMaxPlane) :: TCa1

TCsd

real (kind=R4), public, dimension (kMaxPlane) :: TCsd

TCifail

integer, public, dimension (kMaxPlane) :: TCifail

TCNHIT

integer, public :: TCNHIT

nhits_in_scin

integer, public :: nhits_in_scin

failed_cptof_m12

integer, public :: failed_cptof_m12

Description of Subroutines and Functions

TECanalysis

public subroutine TECanalysis ()
    ! Calls: ClearImportantTECArrays, MyLineFit, SelectTriggerParticle, get_TEC_DTdistance, hf1, hf2, hreset, uv2xy
end subroutine TECanalysis

ClearImportantTECArrays

public subroutine ClearImportantTECArrays ()
end subroutine ClearImportantTECArrays

MyLineFit

public subroutine MyLineFit (N, X, Y, AA, BB, SD, IFAIL)
    integer :: N
             ============================================================          
  Fit a straight line
 ============================================================          
    real, dimension (:) :: X
    real, dimension (:) :: Y
    real :: AA
    real :: BB
    real :: SD
    integer :: IFAIL
             ============================================================          
  Fit a straight line
 ============================================================          
end subroutine MyLineFit

get_TEC_DTdistance

private subroutine get_TEC_DTdistance (time, planeNo, wireNo, distance)
    real (kind=r4), INTENT(in) :: time
    integer (kind=i4), INTENT(in) :: planeNo
    integer (kind=i4), INTENT(in) :: wireNo
    real (kind=r4), INTENT(out) :: distance
    ! Calls: kerror
end subroutine get_TEC_DTdistance