module Windex_mod
        ! Uses
    use Precision_mod
    use Namelist_mod
    use Chambers_mod
    use Det_Geom_mod
    use Tdc_mod
    use Unp_mod
    use Hists_mod
    use Pattern_mod
    use Cluster_mod
    use Pattern_Log_mod
    use Xtalk_mod, ONLY: DC_IsXtalk, PC_IsXtalk
    use windowstat_mod
        ! Subroutines and functions
    public subroutine GetTriggerInfo ()
    public subroutine GetScintHits ()
    public subroutine DoClustering ()
    public subroutine DoClusteringWin (i)
    public subroutine AllEventWindowTypes ()
    private subroutine AEWT_MoreMuThanEManyPidPC ()
    private function AEWT_MMTEMPP_NotFastDecay (iwindow)
    private function AEWT_MMTEMPP_NFDK_Upstream (iwindow)
    private function AEWT_MMTEMPP_NFDK_Downstream (iwindow)
    private subroutine AEWT_MoreMuThanEOnePidPC ()
    private subroutine AEWT_MoreEThanMu ()
    public subroutine FillWindowBJhistos ()
    private subroutine BookWindowBJhistos ()
end module Windex_mod
==============================================================================
 Name: windex_mod
------------------------------------------------------------------------------
 Description:
 Final step in windowing and classification --
 change window classifications based on whole event
 information, and creates histograms by window. These subroutines
 have been pulled out of windowbj_mod, since I 
 wanted to shorten windowbj_mod so that it would
 compile more reliably without making the compiler
 core dump. ( I suspect it doesn't like such long
 pieces of code).
==============================================================================
Author: Blair Jamieson  (!! is for inclusion of comments in f90doc)
Version: Jul.2003
public subroutine GetTriggerInfo () end subroutine GetTriggerInfo SUBROUTINE GetTriggerInfo ------------------------------------------------------------------ Author: Blair Date: Jan. 2003 Description: This subroutine gets the capacitive probe time and stores it in cptime. It also gets the M scintillator 1+2 width and puts it in the variable m12width.
public subroutine GetScintHits () end subroutine GetScintHits
public subroutine DoClustering ()
    ! Calls: ClusterStat, Clustering
end subroutine DoClustering
 SUBROUTINE DoClustering
------------------------------------------------------------------
 Author: Blair
 Date: Jan. 2003
 Description:
 This subroutine calls clustering for each window and
 plane.  
 Modifications
--------------
 Mar. 2003 - ABJ:
 Don't call clustering for the odd window before
 a beam positron and decay overlap window... that was
 already done to try to extract the beam positron
public subroutine DoClusteringWin (i)
    integer (kind=i4) :: i
    ! Calls: Clustering
end subroutine DoClusteringWin
 SUBROUTINE DoClusteringWin
------------------------------------------------------------------
 Author: Blair
 Date: Mar. 2003
 Description:
 This subroutine calls clustering for each 
 plane in window i.
  
public subroutine AllEventWindowTypes ()
    ! Calls: AEWT_MoreEThanMu, AEWT_MoreMuThanEManyPidPC, AEWT_MoreMuThanEOnePidPC
end subroutine AllEventWindowTypes
 Subroutine AllEventWindowTypes
------------------------------------------------------------------
 Author: Blair
 Date: Feb. 2003
 Description:
 Check overall event to see if any of the windows could have been
 misidentified.
  
private subroutine AEWT_MoreMuThanEManyPidPC () end subroutine AEWT_MoreMuThanEManyPidPC Subroutine AEWT_MoreMuThanEManyPidPC ------------------------------------------------------------------ Author: Anthony Date: Mar. 2008 Description: See if any of the windows were identified as muon and beam positron overlaps.
private function AEWT_MMTEMPP_NotFastDecay (iwindow)
    integer (kind=i4), intent(in) :: iwindow
    logical :: AEWT_MMTEMPP_NotFastDecay
end function AEWT_MMTEMPP_NotFastDecay
 Subroutine AEWT_MMTEMPP_NotFastDecay
------------------------------------------------------------------
 Author: Anthony
 Date: Mar. 2008
 Description:
 centre of circle moved, change in hits per plane,
 and slight difference in spread in hits between
 upstream and downstream... lets call this an overlap
 of beam positron and decay
  
private function AEWT_MMTEMPP_NFDK_Upstream (iwindow)
    integer (kind=i4), intent(in) :: iwindow
    logical :: AEWT_MMTEMPP_NFDK_Upstream
end function AEWT_MMTEMPP_NFDK_Upstream
 Subroutine AEWT_MMTEMPP_NFDK_Upstream
------------------------------------------------------------------
 Author: Anthony
 Date: Mar. 2008
 Description:
 This event is apparently not a fast decay.
 It has more hits upstream so upstream decay is assumed.
 Now check if it is a delta or a scatter.
  
private function AEWT_MMTEMPP_NFDK_Downstream (iwindow)
    integer (kind=i4), intent(in) :: iwindow
    logical :: AEWT_MMTEMPP_NFDK_Downstream
end function AEWT_MMTEMPP_NFDK_Downstream
 Subroutine AEWT_MMTEMPP_NFDK_Downstream
------------------------------------------------------------------
 Author: Anthony
 Date: Mar. 2008
 Description:
 This event is apparently not a fast decay.
 It has more hits downstream so downstream decay is assumed.
 Now check if it is a delta or a scatter.
  
private subroutine AEWT_MoreMuThanEOnePidPC () end subroutine AEWT_MoreMuThanEOnePidPC Subroutine AEWT_MoreMuThanEOnePidPC ------------------------------------------------------------------ Author: Anthony Date: Mar. 2008 Description: See if this could be a fast decay upstream Characteristics: 1) could have larger radius than usual muon (poor indicator) 2) has hits with width < 150 ns (poor indicator) 3) could have larger tsig due to multiple tracks (ok indicator) 4) hitspp > 1.75 (ok indicator) use just conditions 2,3,4
private subroutine AEWT_MoreEThanMu () end subroutine AEWT_MoreEThanMu Subroutine AEWT_MoreEThanMu ------------------------------------------------------------------ Author: Anthony Date: Mar. 2008 Description:
public subroutine FillWindowBJhistos ()
    ! Calls: BookWindowBJhistos, HF1, HF2, fillskimN, hf2
end subroutine FillWindowBJhistos
private subroutine BookWindowBJhistos ()
    ! Calls: HBOOK1, HBOOK2
end subroutine BookWindowBJhistos