Module WindowStat_mod
module WindowStat_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
! Types
public type tbin_TYPE
public type PCpid_type
public type HitSlide_TYPE
public type CHstat_TYPE
public type updnstream_type
public type UpPC_Type
public type Stop_TYPE
public type win_TYPE
! Variables
real (kind=r4), public, dimension (3) :: cptime
real (kind=r4), public :: m12width
integer (kind=i4), private, PARAMETER :: WIN_NTIMEBINS_ARYSZ = 641
type (tbin_TYPE), public, TARGET, dimension (WIN_NTIMEBINS_ARYSZ) :: PCt
type (tbin_TYPE), public, TARGET, dimension (WIN_NTIMEBINS_ARYSZ) :: DCt
integer (kind=i4), public, PARAMETER :: MAX_PARTICLES = MAXWINDOWS
integer (kind=i4), public, PARAMETER :: MAX_TBINS = 20
integer (kind=i4), public :: NpidPC
type (PCpid_TYPE), public, TARGET, dimension (MAX_PARTICLES) :: PCpid
integer (kind=i4), public, PARAMETER :: WIN_NSLIDES = 49
integer (kind=i4), public, PARAMETER :: WIN_NRBINS = 40
integer (kind=i4), public, PARAMETER :: WIN_NWIDBINS = 4
type (win_TYPE), public, TARGET, dimension (MAX_PARTICLES) :: win
end module WindowStat_mod
Description of Types
tbin_TYPE
public type tbin_TYPE
integer (kind=i4) :: hitcount
Count of Plane hit times binned in time
integer (kind=i4) :: uhitcount
Count of Plane hit times binned in time
integer (kind=i4) :: vhitcount
Count of Plane hit times binned in time
real (kind=r4) :: timemin
Minimum of plane hit times binned in time
real (kind=r4) :: timemax
Maximum of plane hit times binned in time
real (kind=r8) :: timesum
Sum of plane hit times binned in time
real (kind=r8) :: timesum2
Sum of plane hit times binned in time
real (kind=r4) :: timeavg
Average of Plane hit times binned in time
real (kind=r4) :: timesig
SIG of Plane hit times binned in time
real (kind=r4) :: widthsums
Sum of Plane widths binned in time
real (kind=r4) :: widthavg
Average Plane width binned in time
integer (kind=i4) :: first
First Plane number hit binned in time
integer (kind=i4) :: last
Last Plane number hit binned in time
real (kind=r8) :: usum
Sum of U coordinates binned in time
real (kind=r8) :: usum2
Sum sqared of U coordinates binned in time
real (kind=r4) :: uavg
Average of U coordinates binned in time
real (kind=r4) :: umax
Maximum U coordinate binned in time
real (kind=r4) :: umin
Minimum U coordinate binned in time
real (kind=r4) :: usig
SIG of U coordinates binned in time
real (kind=r8) :: vsum
Sum of V coordinates binned in time
real (kind=r8) :: vsum2
Sum sqared of V coordinates binned in time
real (kind=r4) :: vavg
Average of V coordinates binned in time
real (kind=r4) :: vmax
Maximum V coordinate binned in time
real (kind=r4) :: vmin
Minimum V coordinate binned in time
real (kind=r4) :: vsig
SIG of V coordinates binned in time
end type tbin_TYPE
PCpid_type
public type PCpid_type
integer (kind=i4) :: Nbins
Number of tbins for this particle "window"
integer (kind=i4) :: Nhits
Number of PC hits for this particle
integer (kind=r4), dimension (MAX_TBINS) :: Tidx
Index into PCt of tbins for this particle
real (kind=r4) :: Tmin
Minimum PC time
real (kind=r4) :: Tmax
Maximum PC time
real (kind=r4) :: Tstart
Particle start time
real (kind=r4) :: Tend
Particle end time
real (kind=r8) :: TNsum
Time bin avg time * Number of hits
real (kind=r8) :: TNsum2
Time bin avg time * Number of hits squared
real (kind=r4) :: Tavg
Average particle time
real (kind=r4) :: Tsig
Sigma of pc hits for particle
integer (kind=i4) :: Npeaks
Number of peaks in PC hits spectrum
logical :: overlap
Does this look like an overlap of
logical :: dconly
2 or more particles
Pacticle track started with only DC hits
end type PCpid_type
HitSlide_TYPE
public type HitSlide_TYPE
integer (kind=i4) :: uhitcount
Count of U hits by window and slide
integer (kind=i4) :: vhitcount
Count of V hits by window and slide
real (kind=r4) :: widsum
Sum of Widths by window and slide
real (kind=r4) :: widavg
Average Width by window and slide
real (kind=r8) :: usum
Sum of U coords by window and slide
real (kind=r8) :: usum2
Sum squared of U coords by window and slide
real (kind=r4) :: uavg
Avg U coord by window and slide
real (kind=r4) :: umax
Maximum U coord by window and slide
real (kind=r4) :: umin
Minimum U coord by window and slide
real (kind=r4) :: usig
Sigma of U coords by window and slide
real (kind=r8) :: vsum
Sum of V coords by window and slide
real (kind=r8) :: vsum2
Sum squared of V coords by window and slide
real (kind=r4) :: vavg
Avg V coord by window and slide
real (kind=r4) :: vmax
Maximum V coord by window and slide
real (kind=r4) :: vmin
Minimum V coord by window and slide
real (kind=r4) :: vsig
Sigma of V coords by window and slide
real (kind=r4) :: ravg
Average hit coords by win and slide
real (kind=r4) :: rsig
Spread of hit coords by win and slide
end type HitSlide_TYPE
CHstat_TYPE
public type CHstat_TYPE
integer (kind=i4) :: hitcount
Arrays of info on CH's binned in PC windows
Count of Plane hit times binned in PC win
integer (kind=i4) :: uhitcount
Count of Plane hit times binned in PC win
integer (kind=i4) :: vhitcount
Count of Plane hit times binned in PC win
real (kind=r4) :: timemin
Minimum of plane hit times binned in PC win
real (kind=r4) :: timemax
Maximum of plane hit times binned in PC win
real (kind=r8) :: timesum
Sum of Plane hit times binned in PC win
real (kind=r8) :: timesum2
Sum of Plane hit times binned in PC win
real (kind=r4) :: timeavg
Average of Plane hit times binned in PC win
real (kind=r4) :: timesig
SIG of Plane hit times binned in PC win
real (kind=r8) :: widthsums
Sum of Plane widths binned in PC win
real (kind=r8) :: widthsum2
Sum of squared widths binned in time
real (kind=r4) :: widthavg
Average Plane width binned in PC win
real (kind=r4) :: widthsig
SIG of Plane hit widths binned in PC win
integer (kind=i4) :: first
First Plane number hit binned in PC win
integer (kind=i4) :: last
Last Plane number hit binned in PC win
real (kind=r8) :: usum
Sum of U coordinates binned in PC win
real (kind=r8) :: usum2
Sum sqared of U coordinates binned in PC win
real (kind=r4) :: uavg
Average of U coordinates binned in PC win
real (kind=r4) :: umax
Maximum U coordinate binned in PC win
real (kind=r4) :: umin
Minimum U coordinate binned in PC win
real (kind=r4) :: usig
SIG of U coordinates binned in PC win
real (kind=r8) :: vsum
Sum of V coordinates binned in PC win
real (kind=r8) :: vsum2
Sum sqared of V coordinates binned in PC win
real (kind=r4) :: vavg
Average of V coordinates binned in PC win
real (kind=r4) :: vmax
Maximum V coordinate binned in PC win
real (kind=r4) :: vmin
Minimum V coordinate binned in PC win
real (kind=r4) :: vsig
SIG of V coordinates binned in PC win
real (kind=r4) :: ravg
Average of coordinates binned in PC win
real (kind=r4) :: rsig
Spread of coordinates
end type CHstat_TYPE
Info on particle by chamber type
updnstream_type
public type updnstream_type
integer (kind=i4) :: Planes
Number of Planes Hit
real (kind=r4) :: HitsPP
Hits Per Plane
real (kind=r4), dimension (6) :: RHitsPP
integer (kind=i4) :: Ucount
Number of U hits
integer (kind=i4) :: Vcount
Number of V hits
real (kind=r8) :: Usum
Sum of U coordinates
real (kind=r8) :: Usum2
Sum squared of U coordinates
real (kind=r4) :: Uavg
Average U coordinate
real (kind=r4) :: Usig
Sigma of U coordinates
real (kind=r8) :: Vsum
sum of V coordinates
real (kind=r8) :: Vsum2
Sum squared of V coordinates
real (kind=r4) :: Vavg
Average V coordinate
real (kind=r4) :: Vsig
Sigma of V coords
real (kind=r4) :: ravg
average coordinate
real (kind=r4) :: rsig
spread of coordinates
integer (kind=i4), dimension (WIN_NRBINS) :: rwire
histogram of wire positions
real (kind=r4) :: rcut
radius at which to cut 'noise' hits
real (kind=r4) :: tsum
Sum of TDC times
real (kind=r4) :: tavg
Average TDC time
end type updnstream_type
Info on particle by stream (from target)
UpPC_Type
public type UpPC_Type
integer (kind=i4) :: hitcount
Count of upstream PC hit times binned in PC win
real (kind=r4) :: tmin
Earliest PC time
real (kind=r4) :: tmax
Latest PC time
real (kind=r8) :: tsum
sum of PC times
real (kind=r8) :: tsum2
sum squared of PC times
real (kind=r4) :: tavg
average PC time
real (kind=r4) :: tsig
sigma of PC times
real (kind=r8) :: widthsum
Sum of upstream PC widths binned in PC win
real (kind=r8) :: widthsum2
Sum squared of upstream PC widths bin in PC win
real (kind=r4) :: widthavg
Average PC upstream width binned in PC win
real (kind=r4) :: widthsig
Sigma of PC upstream width binned in PC win
integer (kind=i4), dimension (WIN_NWIDBINS) :: widthcount
count of hits in bin of width
integer (kind=i4), dimension (4) :: hits
hit count for each plane
real (kind=r4), dimension (4) :: wsum
width sum for each plane
real (kind=r4), dimension (4) :: wavg
width average for each plane
real (kind=r4), dimension (4) :: wmax
largest width for each plane (ns)
end type UpPC_Type
[0-50],[50-150],[150-200],[200+]
Info on particle from Upstream PC1-4 (Actually now grouped into
the three PC modules as three seperate instances of UpPC_Type)
Stop_TYPE
public type Stop_TYPE
integer (kind=i4), dimension (56) :: hits
number of hits in plane by window
logical, dimension (56) :: cosmic
do the hits in this plane seem
character :: stoptype
like they could be a cosmic
type of stopping plane (P or T or D)
integer (kind=i4) :: stop
stopping plane number (global plane#)
character :: starttype
type of starting plane (P or T or D)
integer (kind=i4) :: start
starting plane number (global plane#)
integer (kind=i4) :: ngaps
# of gaps of 2 or more planes missing
integer (kind=i4), dimension (20) :: gapstart
start plane number for a gap of planes
integer (kind=i4), dimension (20) :: gapstop
stop plane number for a gap of planes
logical :: noiseorcosmic
does this window look like just noise?
end type Stop_TYPE
Stop and start plane array, and plane hit counts 44+12=56
win_TYPE
public type win_TYPE
type (CHstat_TYPE) :: PC
statistics on PCs
type (CHstat_TYPE) :: DC
statistics on DCs
type (updnstream_type) :: Up
statistics on US
type (updnstream_type) :: Dn
of target
stats on DS of target
type (UpPC_Type) :: UpPC
info from US PC 1-4
type (UpPC_Type) :: DnPC
info from DS PC 9-12
type (UpPC_Type) :: TgtPC
info from TGT PC 5-8
type (Stop_TYPE) :: plane
start,stop plane info
integer (kind=i4) :: nNonZeroSlides
# of non-zero slides
integer (kind=i4), dimension (WIN_NSLIDES) :: NonZeroSlides
Array of non-zero
type (HitSlide_TYPE), dimension (WIN_NSLIDES) :: slide
slide indices
stats by slide
logical :: hitmuscint
was mu scint hit
logical :: hitt0scint
was t0 scint hit
real (kind=r4) :: muscinttime
time of mu scint hit
real (kind=r4) :: t0scinttime
time of t0 scint hit
real (kind=r4) :: tof
tof from PC info
real (kind=r4) :: hitsPP
(tof is half stack, or full stack if avail.)
all window hits per plane
real (kind=r4), dimension (6) :: RhitsPP
restricted all window hits per plane
logical :: toofewplaneshit
too few planes for tracking
logical :: toomanyhitspp
too many hits for tracking
end type win_TYPE
Win TYPE contains statistics on PC particle window
hits. Useful for deciding on the window type, and
if any plane restrictions etc. will be placed, when
sorting hits into the window structure.
Description of Variables
cptime
real (kind=r4), public, dimension (3) :: cptime
m12width
real (kind=r4), public :: m12width
WIN_NTIMEBINS_ARYSZ
integer (kind=i4), private, PARAMETER :: WIN_NTIMEBINS_ARYSZ = 641
PCt
type (tbin_TYPE), public, TARGET, dimension (WIN_NTIMEBINS_ARYSZ) :: PCt
DCt
type (tbin_TYPE), public, TARGET, dimension (WIN_NTIMEBINS_ARYSZ) :: DCt
Array of time bin info for DC's
MAX_PARTICLES
integer (kind=i4), public, PARAMETER :: MAX_PARTICLES = MAXWINDOWS
MAX_TBINS
integer (kind=i4), public, PARAMETER :: MAX_TBINS = 20
NpidPC
integer (kind=i4), public :: NpidPC
PCpid
type (PCpid_TYPE), public, TARGET, dimension (MAX_PARTICLES) :: PCpid
WIN_NSLIDES
integer (kind=i4), public, PARAMETER :: WIN_NSLIDES = 49
Arrays of info for both PC's and DC's binned in space(slides) and by window.
The order of chamber slides is:
Global Slides Plane Diagram
Plane
1 1 PC1 \
2 1,2 PC2 \ \
3 1-3 PC3 \ \ \
4 1-4 PC4 \Sl 1\ \ \
5 1-5 DC1 /PC1-4\Sl 2\ \ \
6 1-6 DC2 / DC1-4/PC2-4\Sl 3\ \ \
7 1-7 DC3 / / DC1-5/PC3-4\Sl 4\ \ \
8 1-8 DC4 / / / DC1-6/PC4 \Sl 5\ \ \
9 2-9 DC5 \ / / / DC1-7/DC1-8\Sl 6\ \
10 3-10 DC6 \ / / / /DC2-9\Sl 7 \
11 4-11 DC7 \ / / / /DC3-10\Sl 8
12 5-12 DC8 \ Slide 9 / / / /DC4-10
13 6-13 DC9 / DC5-11 / / /
14 7-14 DC10 / / /
15 8-15 DC11 / /
16 9-16 DC12 /
17 10-17 DC13 \
18 11-18 DC14 \
19 12-19 DC15 \
20 13-20 DC16 \ Slide 17
21 14-21 DC17 /
22 15-22 DC18 /
23 16-23 DC19 /
24 17-24 DC20 /
25 18-25 DC21 \
26 19-26 DC22 \
27 20-27 PC5 \
28 21-28 PC6 \ Slide 25
29 22-29 PC7 /
30 23-30 PC8 /
31 24-31 DC23 /
32 25-32 DC24 /
33 26-33 DC25 \
34 27-34 DC26 \
35 28-35 DC27 \
36 29-36 DC28 \ Slide 33
37 30-37 DC29 /
38 31-38 DC30 /
39 32-39 DC31 /
40 33-40 DC32 /
41 34-41 DC33 \
42 35-42 DC34 \
43 36-43 DC35 \
44 37-44 DC36 \ Slide 41
45 38-45 DC37 /
46 39-46 DC38 /
47 40-47 DC39 /
48 41-48 DC40 /
49 42-49 DC41 \
50 43-49 DC42 \
51 44-49 DC43 \
52 45-49 DC44 \ Slide 49
53 46-49 PC9 /
54 47-49 PC10 /
55 48-49 PC11 /
56 49 PC12 /
WIN_NRBINS
integer (kind=i4), public, PARAMETER :: WIN_NRBINS = 40
binsize of 4mm
WIN_NWIDBINS
integer (kind=i4), public, PARAMETER :: WIN_NWIDBINS = 4
number of different widths to count
win
type (win_TYPE), public, TARGET, dimension (MAX_PARTICLES) :: win
Now here it is, the main window statistics array
Note that these windows are for every integer
(as opposed to the 'window' structure which likes to
call odd windows overlaps)