Module trackrange_mod

module trackrange_mod

        ! Uses
    use Precision_mod
    use pattern_mod
    use hists_mod
    use unp_mod
    use det_geom_mod

        ! Variables
    real (kind=R8), public, dimension (maxWindows) :: TRminZ
    real (kind=R8), public, dimension (maxWindows) :: TRmaxZ
    integer, public, dimension (maxWindows) :: TRminPlane
    integer, public, dimension (maxWindows) :: TRmaxPlane
    integer, public, dimension (maxWindows) :: TRminPlanePC
    integer, public, dimension (maxWindows) :: TRmaxPlanePC
    integer, public, dimension (maxWindows) :: TRminPlaneDC
    integer, public, dimension (maxWindows) :: TRmaxPlaneDC
    real (kind=R8), public, dimension (maxWindows) :: TRmaxR
    real (kind=R8), public :: triggerLastZ
    real, public :: mcstop_r
    integer, private, PARAMETER :: IDH_TR_T0 = IDH_TrackRange_Base + 0
    integer, private, PARAMETER :: IDH_TR_T0zoom = IDH_TrackRange_Base + 1
    integer, private, PARAMETER :: IDH_TR_NumPC = IDH_TrackRange_Base + 2
    integer, private, PARAMETER :: IDH_TR_NumDC = IDH_TrackRange_Base + 3
    integer, private, PARAMETER :: IDH_TR_Zhit = IDH_TrackRange_Base + 4
    integer, private, PARAMETER :: IDH_TR_Zplane = IDH_TrackRange_Base + 5
    integer, private, PARAMETER :: IDH_TR_LastZhit = IDH_TrackRange_Base + 6
    integer, public, PARAMETER :: IDH_TR_muLastZ = IDH_TrackRange_Base + 7
    integer, public, PARAMETER :: IDH_TR_R_muLastZ = IDH_TrackRange_Base + 8
    integer, public, PARAMETER :: IDH_TR_R_muLastZx = IDH_TrackRange_Base + 45
    integer, public, PARAMETER :: IDH_TR_R_muLastPlane = IDH_TrackRange_Base + 9
    integer, private, PARAMETER :: IDH_TR_MCmustop = IDH_TrackRange_Base + 10
    integer, private, PARAMETER :: IDH_TR_MC_R_mustop = IDH_TrackRange_Base + 11
    integer, private, PARAMETER :: IDH_TR_NextT0 = IDH_TrackRange_Base + 12
    integer, private, PARAMETER :: IDH_TR_ZdiffMC = IDH_TrackRange_Base + 13
    integer, private, PARAMETER :: IDH_TR_ZdiffZMC = IDH_TrackRange_Base + 14
    integer, public, PARAMETER :: IDH_TR_ClSizeDiff = IDH_TrackRange_Base + 20
    integer, public, PARAMETER :: IDH_TR_ClMultDiff = IDH_TrackRange_Base + 21
    integer, public, PARAMETER :: IDH_TR_ClMeanUDiff = IDH_TrackRange_Base + 22
    integer, public, PARAMETER :: IDH_TR_ClMeanVDiff = IDH_TrackRange_Base + 23
    integer, public, PARAMETER :: IDH_TR_ClMeanRDiff = IDH_TrackRange_Base + 24
    integer, public, PARAMETER :: IDH_TR_ClRMSUDiff = IDH_TrackRange_Base + 25
    integer, public, PARAMETER :: IDH_TR_ClRMSVDiff = IDH_TrackRange_Base + 26
    integer, public, PARAMETER :: IDH_TR_ClRMSRDiff = IDH_TrackRange_Base + 27
    integer, public, PARAMETER :: IDH_TR_ClRMSUFrac = IDH_TrackRange_Base + 28
    integer, public, PARAMETER :: IDH_TR_ClRMSVFrac = IDH_TrackRange_Base + 29
    integer, public, PARAMETER :: IDH_TR_FirstPCdiff = IDH_TrackRange_Base + 30
    integer, public, PARAMETER :: IDH_TR_FirstPCdiff_e = IDH_TrackRange_Base + 31
    integer, public, PARAMETER :: IDH_TR_FirstPCdiff_ne = IDH_TrackRange_Base + 32
    integer, public, PARAMETER :: IDH_TR_Nup = IDH_TrackRange_Base + 40
    integer, public, PARAMETER :: IDH_TR_Ndown = IDH_TrackRange_Base + 41
    integer, public, PARAMETER :: IDH_TR_Nupdown = IDH_TrackRange_Base + 42

        ! Subroutines and functions
    public subroutine trackrange ()
    private function PC2GlobalPlane (PCnum)
    private function DC2GlobalPlane (DCnum)

end module trackrange_mod

Description of Variables

TRminZ

real (kind=R8), public, dimension (maxWindows) :: TRminZ

TRmaxZ

real (kind=R8), public, dimension (maxWindows) :: TRmaxZ

TRminPlane

integer, public, dimension (maxWindows) :: TRminPlane

TRmaxPlane

integer, public, dimension (maxWindows) :: TRmaxPlane

TRminPlanePC

integer, public, dimension (maxWindows) :: TRminPlanePC

TRmaxPlanePC

integer, public, dimension (maxWindows) :: TRmaxPlanePC

TRminPlaneDC

integer, public, dimension (maxWindows) :: TRminPlaneDC

TRmaxPlaneDC

integer, public, dimension (maxWindows) :: TRmaxPlaneDC

TRmaxR

real (kind=R8), public, dimension (maxWindows) :: TRmaxR

triggerLastZ

real (kind=R8), public :: triggerLastZ

mcstop_r

real, public :: mcstop_r

IDH_TR_T0

integer, private, PARAMETER :: IDH_TR_T0 = IDH_TrackRange_Base + 0

IDH_TR_T0zoom

integer, private, PARAMETER :: IDH_TR_T0zoom = IDH_TrackRange_Base + 1

IDH_TR_NumPC

integer, private, PARAMETER :: IDH_TR_NumPC = IDH_TrackRange_Base + 2

IDH_TR_NumDC

integer, private, PARAMETER :: IDH_TR_NumDC = IDH_TrackRange_Base + 3

IDH_TR_Zhit

integer, private, PARAMETER :: IDH_TR_Zhit = IDH_TrackRange_Base + 4

IDH_TR_Zplane

integer, private, PARAMETER :: IDH_TR_Zplane = IDH_TrackRange_Base + 5

IDH_TR_LastZhit

integer, private, PARAMETER :: IDH_TR_LastZhit = IDH_TrackRange_Base + 6

IDH_TR_muLastZ

integer, public, PARAMETER :: IDH_TR_muLastZ = IDH_TrackRange_Base + 7

IDH_TR_R_muLastZ

integer, public, PARAMETER :: IDH_TR_R_muLastZ = IDH_TrackRange_Base + 8

IDH_TR_R_muLastZx

integer, public, PARAMETER :: IDH_TR_R_muLastZx = IDH_TrackRange_Base + 45

IDH_TR_R_muLastPlane

integer, public, PARAMETER :: IDH_TR_R_muLastPlane = IDH_TrackRange_Base + 9

IDH_TR_MCmustop

integer, private, PARAMETER :: IDH_TR_MCmustop = IDH_TrackRange_Base + 10

IDH_TR_MC_R_mustop

integer, private, PARAMETER :: IDH_TR_MC_R_mustop = IDH_TrackRange_Base + 11

IDH_TR_NextT0

integer, private, PARAMETER :: IDH_TR_NextT0 = IDH_TrackRange_Base + 12

IDH_TR_ZdiffMC

integer, private, PARAMETER :: IDH_TR_ZdiffMC = IDH_TrackRange_Base + 13

IDH_TR_ZdiffZMC

integer, private, PARAMETER :: IDH_TR_ZdiffZMC = IDH_TrackRange_Base + 14

IDH_TR_ClSizeDiff

integer, public, PARAMETER :: IDH_TR_ClSizeDiff = IDH_TrackRange_Base + 20

IDH_TR_ClMultDiff

integer, public, PARAMETER :: IDH_TR_ClMultDiff = IDH_TrackRange_Base + 21

IDH_TR_ClMeanUDiff

integer, public, PARAMETER :: IDH_TR_ClMeanUDiff = IDH_TrackRange_Base + 22

IDH_TR_ClMeanVDiff

integer, public, PARAMETER :: IDH_TR_ClMeanVDiff = IDH_TrackRange_Base + 23

IDH_TR_ClMeanRDiff

integer, public, PARAMETER :: IDH_TR_ClMeanRDiff = IDH_TrackRange_Base + 24

IDH_TR_ClRMSUDiff

integer, public, PARAMETER :: IDH_TR_ClRMSUDiff = IDH_TrackRange_Base + 25

IDH_TR_ClRMSVDiff

integer, public, PARAMETER :: IDH_TR_ClRMSVDiff = IDH_TrackRange_Base + 26

IDH_TR_ClRMSRDiff

integer, public, PARAMETER :: IDH_TR_ClRMSRDiff = IDH_TrackRange_Base + 27

IDH_TR_ClRMSUFrac

integer, public, PARAMETER :: IDH_TR_ClRMSUFrac = IDH_TrackRange_Base + 28

IDH_TR_ClRMSVFrac

integer, public, PARAMETER :: IDH_TR_ClRMSVFrac = IDH_TrackRange_Base + 29

IDH_TR_FirstPCdiff

integer, public, PARAMETER :: IDH_TR_FirstPCdiff = IDH_TrackRange_Base + 30

IDH_TR_FirstPCdiff_e

integer, public, PARAMETER :: IDH_TR_FirstPCdiff_e = IDH_TrackRange_Base + 31

IDH_TR_FirstPCdiff_ne

integer, public, PARAMETER :: IDH_TR_FirstPCdiff_ne = IDH_TrackRange_Base + 32

IDH_TR_Nup

integer, public, PARAMETER :: IDH_TR_Nup = IDH_TrackRange_Base + 40

IDH_TR_Ndown

integer, public, PARAMETER :: IDH_TR_Ndown = IDH_TrackRange_Base + 41

IDH_TR_Nupdown

integer, public, PARAMETER :: IDH_TR_Nupdown = IDH_TrackRange_Base + 42

Description of Subroutines and Functions

trackrange

public subroutine trackrange ()
    ! Calls: hbook1, hbook2, hf1, hf2
end subroutine trackrange
-------------------------------------------------------
 trackrange attempts to estimate where the track starts
 and stops, based on the first and last planes hit.  It
 makes no attempt to account for noise or inefficiency;
 short studies have shown it to work "well enough" despite
 that.

 trackrange sets the values of the following arrays for
 each window:
   TRminZ, TRmaxZ

 triggerLastZ is set to the max Z in the trigger window.
 If no trigger window is found, then window 2 is used for
 triggerLastZ.

 Two unphysical values of FirstLastZ and triggerLastZ are used as
 error codes:

  -9990. means we did nothing because the trigger window overlaps
         with the previous/next even window.
 
 RPM.  July, 2002.  Based on ko_mustop_mod.

PC2GlobalPlane

private function PC2GlobalPlane (PCnum)
    integer :: PCnum
    integer :: PC2GlobalPlane
end function PC2GlobalPlane

DC2GlobalPlane

private function DC2GlobalPlane (DCnum)
    integer :: DCnum
    integer :: DC2GlobalPlane
end function DC2GlobalPlane