module chambers_mod
! Uses
use physicalconstants_mod
use precision_mod
use det_geom_mod
! Types
public type dir_type
public type stream_type
public type plane_type
public type point3_type
public type wire_type
public type scint_type
! Variables
type (dir_type), public, PARAMETER :: dir = dir_type (1, 2, 3, 4)
type (stream_type), public, PARAMETER :: stream = stream_type (1, 2)
integer, public, PARAMETER :: MAX_MULTIPLEXING = 4
type (plane_type), public, ALLOCATABLE, TARGET, dimension (:) :: DCplane
type (plane_type), public, ALLOCATABLE, TARGET, dimension (:) :: PCplane
type (plane_type), public, ALLOCATABLE, TARGET, dimension (:) :: TCplane
type (wire_type), public, ALLOCATABLE, TARGET, dimension (:,:) :: DCwire
type (wire_type), public, ALLOCATABLE, TARGET, dimension (:,:) :: PCwire
type (wire_type), public, ALLOCATABLE, TARGET, dimension (:,:) :: PCPhysWire
type (wire_type), public, ALLOCATABLE, TARGET, dimension (:,:) :: TCWire
integer, public :: NumSCdisk
type (scint_type), public, TARGET, dimension (MAX_SCINTS) :: SCdisk
integer, public, dimension (MAX_PLANES_P,MAX_WIRES_P) :: PC_MXing = -1
integer, public, dimension (MAX_PLANES_P,MAX_WIRES_P) :: PCwire_to_mcell = 0
! Subroutines and functions
public subroutine SetupChambers ()
private subroutine SetupDCplanes ()
private subroutine SetupPCPlanes ()
public subroutine xyz2uvz3 (xyz, uvz)
public subroutine uvz2xyz3 (uvz, xyz)
public subroutine xy2uv (x, y, u, v)
public subroutine uv2xy (u, v, x, y)
private subroutine testUVZ1 (u, v, z)
private subroutine testUVZ ()
private subroutine setupPlane (plane)
private subroutine SetupPlaneWires (plane, wirecorr, wires)
private subroutine SetupPlaneFoils (plane, nfoils, foils)
private subroutine SetupDCwires ()
private subroutine SetupPCWires ()
private subroutine SetupSCdisks ()
private subroutine SetupTCplanes ()
private subroutine SetupTCwires ()
private subroutine setupTCP (plane)
private subroutine SetupTCPW (plane, wires)
public subroutine PrintGeom ()
private subroutine PrintDCplanes ()
private subroutine PrintDCwires ()
private subroutine PrintPCPlanes ()
private subroutine PrintPCWires ()
private subroutine PrintPCCells ()
private subroutine PrintPCMap ()
private subroutine PrintSCdisks ()
public subroutine SetupPCcells ()
public subroutine TestGeomHists ()
end module chambers_mod
====================================================================
version September,1999
--------------------------------------------------------------------
This module creates the plane and wire geometry structures.
The first entry point, SetupChambers, contains the list of
subroutines called for setting up the chamber, i.e.
calculating and filling the geometry structures. Its second
entry, PrintGeom, creates output files containing the
geometry info and maybe executed for purposes of testing the
geometry..
Note:
Plane and wire position corrections are installed in this module,
UV shift corrections are installed first then rotation corrections,
so the order is: shift plane then rotate around the shifted center.
This means that when we compute the corrections we should first
compute the UV shift corrections, install them, and then compute
the rotation corrections.
Update: Roy Wilds - April 26, 2001
Added in creation of the Scintillator geometry.
No position corrections are presently implemented in the scintillators.
====================================================================
Author: Maher Quraan, K. Olchanski
Version: October, 2001.
public type dir_type
integer (kind=i4) :: u
integer (kind=i4) :: v
integer (kind=i4) :: x
integer (kind=i4) :: y
end type dir_type
public type stream_type
integer (kind=i4) :: up
integer (kind=i4) :: down
end type stream_type
public type plane_type
integer :: dir
u or v plane (dir_type)
integer :: stream
upstream or downstream (stream_type)
integer :: minwire
first cell
integer :: maxwire
last cell
integer :: nwires
number of cells
integer :: iplane
plane number
real :: z
plane Z coordinate
real :: shift
plane offset
real :: rotation
plane rotation, degrees (+/- 45)
logical :: FullyInstrumented
real (kind=R8), dimension (3) :: wvector
wire direction vector
real (kind=R8), dimension (3) :: nvector
vector normal to the plane
real (kind=R8), dimension (3) :: mvector
measurement vector
real :: wireSpacing
plane wire spacing
real, dimension (3) :: center
plane center
real :: radius
plane radius
integer :: minPhysWire
first physical wire (no multiplexing)
integer :: maxPhysWire
last physical wire
integer :: nPhysWires
number of physical wires
logical :: MXingSetup
has multiplexing been setup for this plane
real :: entranceFoilZ
z coordinate of the entrance foil
real :: exitFoilZ
z coordinate of the exit foil (entranceFoilZ < exitFoilZ)
end type plane_type
public type point3_type
real (kind=r4) :: u
real (kind=r4) :: v
real (kind=r4) :: z
end type point3_type
Drift chamber wire
public type wire_type
type (point3_type) :: center
wire center coordinates
type (point3_type) :: bottom
wire end coordinates
type (point3_type) :: top
wire end coordinates
integer :: iwire
cell number
real :: t0
what is this?
type (plane_type), POINTER :: planeP
plane pointer
integer (kind=i4) :: nMXd_wires
# of wires MXd together. 1-> non-MXd wire
integer (kind=i4), dimension (MAX_MULTIPLEXING) :: wires
wire #s that are MXd together
end type wire_type
public type scint_type
integer :: numwires
number of signals from this SC
integer :: iscint
scintillator number
integer :: stream
stream%up or stream%down
real :: shift
real :: inner_rad
inner radius, 0 for mu scintillators.
real :: outer_rad
real :: thickness
type (point3_type) :: center
character :: sctype
'm' for MU scints, 't' for T0 scints, 'o' for other scints
end type scint_type
scintillator geometry.
type (dir_type), public, PARAMETER :: dir = dir_type (1, 2, 3, 4)
type (stream_type), public, PARAMETER :: stream = stream_type (1, 2)
integer, public, PARAMETER :: MAX_MULTIPLEXING = 4
type (plane_type), public, ALLOCATABLE, TARGET, dimension (:) :: DCplane
type (plane_type), public, ALLOCATABLE, TARGET, dimension (:) :: PCplane
type (plane_type), public, ALLOCATABLE, TARGET, dimension (:) :: TCplane
type (wire_type), public, ALLOCATABLE, TARGET, dimension (:,:) :: DCwire
type (wire_type), public, ALLOCATABLE, TARGET, dimension (:,:) :: PCwire
type (wire_type), public, ALLOCATABLE, TARGET, dimension (:,:) :: PCPhysWire
type (wire_type), public, ALLOCATABLE, TARGET, dimension (:,:) :: TCWire
integer, public :: NumSCdisk
type (scint_type), public, TARGET, dimension (MAX_SCINTS) :: SCdisk
integer, public, dimension (MAX_PLANES_P,MAX_WIRES_P) :: PC_MXing = -1
integer, public, dimension (MAX_PLANES_P,MAX_WIRES_P) :: PCwire_to_mcell = 0
public subroutine SetupChambers ()
! Calls: SetupDCplanes, SetupDCwires, SetupPCplanes, SetupPCwires, SetupSCdisks, SetupTCplanes, SetupTCwires, TestUVZ, kerror
end subroutine SetupChambers
=============================================================
-------------------------------------------------------------
First entry.
This is the entry subroutine to the setup part of the module
=============================================================
Author: Maher Quraan
Version: September, 1999.
private subroutine SetupDCplanes ()
! Calls: kerror, setupPlane, setupPlaneFoils
end subroutine SetupDCplanes
=============================================================
-------------------------------------------------------------
This subroutine fills the DC geometry structures.
=============================================================
Author: Maher Quraan, version September, 1999., K. Olchanski,
Version: October, 2001.
private subroutine SetupPCPlanes ()
! Calls: kerror, setupPlane, setupPlaneFoils
end subroutine SetupPCPlanes
=============================================================
version September, 1999.
version October, 2001.
PC mxed wires are now computed here
-------------------------------------------------------------
This subroutine fills the PC plane geometry structures.
=============================================================
Author: Maher Quraan, K. Olchanski, Marc Lalancette
Version: June 2002
public subroutine xyz2uvz3 (xyz, uvz)
real (kind=R8), INTENT(in), dimension (3) :: xyz
real (kind=R8), INTENT(out), dimension (3) :: uvz
end subroutine xyz2uvz3
public subroutine uvz2xyz3 (uvz, xyz)
real (kind=R8), INTENT(in), dimension (3) :: uvz
real (kind=R8), INTENT(out), dimension (3) :: xyz
end subroutine uvz2xyz3
public subroutine xy2uv (x, y, u, v)
real, INTENT(in) :: x
real, INTENT(in) :: y
real, INTENT(out) :: u
real, INTENT(out) :: v
end subroutine xy2uv
public subroutine uv2xy (u, v, x, y)
real, INTENT(in) :: u
real, INTENT(in) :: v
real, INTENT(out) :: x
real, INTENT(out) :: y
end subroutine uv2xy
private subroutine testUVZ1 (u, v, z)
real, INTENT(in) :: u
real, INTENT(in) :: v
real, INTENT(in) :: z
! Calls: uv2xy, uvz2xyz3, xy2uv, xyz2uvz3
end subroutine testUVZ1
private subroutine testUVZ ()
! Calls: testuvz1
end subroutine testUVZ
private subroutine setupPlane (plane)
type (plane_type), INTENT(inout) :: plane
! Calls: xyz2uvz3
end subroutine setupPlane
private subroutine SetupPlaneWires (plane, wirecorr, wires)
type (plane_type), TARGET, INTENT(in) :: plane
=============================================================
-------------------------------------------------------------
This subroutine calculates DC wire geometry and fills the
Dc wire structures.
=============================================================
Author: K. Olchanski,
Version: October, 2001.
type (corrections_type), INTENT(in), dimension (:) :: wirecorr
type (wire_type), INTENT(out), dimension (:) :: wires
end subroutine SetupPlaneWires
private subroutine SetupPlaneFoils (plane, nfoils, foils)
type (plane_type), TARGET, INTENT(inout) :: plane
=============================================================
-------------------------------------------------------------
This subroutine finds plane entrance and exit foils
=============================================================
Author: K. Olchanski,
Version: April, 2003.
integer, INTENT(in) :: nfoils
real, INTENT(in), dimension (nfoils) :: foils
! Calls: kerror
end subroutine SetupPlaneFoils
private subroutine SetupDCwires ()
! Calls: SetupPlaneWires
end subroutine SetupDCwires
private subroutine SetupPCWires ()
! Calls: SetupPlaneWires
end subroutine SetupPCWires
private subroutine SetupSCdisks ()
! Calls: kerror2
end subroutine SetupSCdisks
private subroutine SetupTCplanes ()
! Calls: kerror, setupTCP
end subroutine SetupTCplanes
=============================================================
-------------------------------------------------------------
This subroutine fills the TEC geometry structures.
=============================================================
Author: Jingliang Hu, based on Maher's SetupDCplanes
Version: Feb., 2004.
private subroutine SetupTCwires ()
! Calls: SetupTCPW
end subroutine SetupTCwires
private subroutine setupTCP (plane)
type (plane_type), INTENT(inout) :: plane
end subroutine setupTCP
private subroutine SetupTCPW (plane, wires)
type (plane_type), TARGET, INTENT(in) :: plane
type (wire_type), INTENT(out), dimension (:) :: wires
end subroutine SetupTCPW
public subroutine PrintGeom ()
! Calls: PrintDCplanes, PrintDCwires, PrintPCcells, PrintPCmap, PrintPCplanes, PrintPCwires, PrintSCdisks
end subroutine PrintGeom
=============================================================
-------------------------------------------------------------
Second entry
This is the entry subroutine to the printing part of the
module. The subroutines called below create output files
containing the chamber geometry info. This only needs to be
done for testing purposes. To execute this subroutine type
'func 6' at the MOFIA command line.
=============================================================
Author: Maher Quraan
Version: September, 1999.
private subroutine PrintDCplanes ()
! Calls: Fdate, RITE
end subroutine PrintDCplanes
=============================================================
-------------------------------------------------------------
This subroutine prints out the DC planes geometry. The output
file "dc_planes_geom.out" is created.
=============================================================
Author: Maher Quraan
Version: September, 1999.
private subroutine PrintDCwires ()
! Calls: Fdate, RITE
end subroutine PrintDCwires
=============================================================
-------------------------------------------------------------
This subroutine prints out the DC wire geometry. The output
file "dc_wires_geom.out" is created.
=============================================================
Author: Maher Quraan
Version: September, 1999.
private subroutine PrintPCPlanes ()
! Calls: Fdate, Rite
end subroutine PrintPCPlanes
private subroutine PrintPCWires ()
! Calls: Fdate, RITE
end subroutine PrintPCWires
=============================================================
-------------------------------------------------------------
This subroutine prints out the PC wire geometry. The output
file "pc_wires_geom.out" is created.
=============================================================
Author: Maher Quraan
Version: September, 1999.
private subroutine PrintPCCells ()
! Calls: Fdate, RITE
end subroutine PrintPCCells
=============================================================
-------------------------------------------------------------
This subroutine prints out the PC cell geometry. The output
file "pc_cells_geom.out" is created.
=============================================================
Author: Marc Lalancette (copied from Maher's PrintPCwires)
Version: May 2002
private subroutine PrintPCMap ()
! Calls: RITE
end subroutine PrintPCMap
private subroutine PrintSCdisks ()
! Calls: Fdate, RITE
end subroutine PrintSCdisks
public subroutine SetupPCcells ()
! Calls: kerror
end subroutine SetupPCcells
-----------------------------------------------------------------------
This routine overwrites the data in the PCplane and PCwire structures
to reflect the multiplexing configuration read from the FBC maps and
recorded in the array PC_MXing(plane,wire) by the function tdcmap_read.
PC_MXing is defined and initialized to -1's in det_geom_mod.
tdcmap_read then processes the planes associated with one fbc at a time.
Each group of multiplexed cell is assigned a unique positive number.
In the code and comments, wire refers to a single physical wire,
multiplexed cell refers to a group of multiplexed wires,
and cell is either a multiplexed cell or a individual wire cell.
This routine only assumes that contiguous wires are multiplexed.
The first individual wire cell keeps the same index as
the corresponding wire (except if only the last cell is an individual
wire), the rest of the cell indexes are adjusted accordingly to form
a continuous range.
Example:
m m m m m m m m i i i i i i i i m m m m m m m m
wire 1 2 3 4 5 6 7 8 9101112131415161718192021222324
cell 7 8 910111213141516 17 18
-----------------------------------------------------------------------
Author: Marc Lalancette
Version: May 30 2002
public subroutine TestGeomHists ()
! Calls: HBOOK2, HF2
end subroutine TestGeomHists
============================================================
------------------------------------------------------------
The next histograms are for testing the geometry. They only
get defined and filled when "func 6" is issued at the MOFIA
command line.
============================================================
Author: Maher Quraan
Version: September 1999