Relies on: Nothing
C include file: evsubs.h
FORTRAN include file: n/a
The package may not be accessed directly from FORTRAN.
This package handles converting detector hit positions to and from 3d vectors. Detector coordinates are specified by an x, y pair with x and y being 0 at the centre of the detector and having a range of -0.5 to 0.5.
The following structure is used to pass coordinates on a detector surface to some of the routines:
struct xy { double x; double y; };
Tell the package to reserve enough space to save the details of n detectors. It returns 0 if all went well, 1 if it couldn't get the memory.
Read the coordinates of the corners of detector n from the file specified by fp. The corners should be specified as four lines each of the form:
x y z
Where x, y and z are relative to the origin of the coordinate system, which should be the target for routines in the EV package to work.
Read the position of detector n from the file specified by fp. The detector position should be specified as:
thx thy w h r
Where thx and thy are the angle of the centre of the detector specified as axial coordinates. w is the width of the detector, h is its height and r is the distance from the origin of the coordinate system (the target).
Convert the detector hit position *cp on detector dt into a 3d vector in hp.
To do: Decide if passing the hit location as a structure is overkill.
Given a direction in spherical polar coordinates, calculate which detector it hits from the detectors in the range 1..ndet. The return value is the number of the detector that was hit.
To do: Provide some way of returning the position of the hit.
Given a direction in spherical polar coordinates, calculate if it hits detector i. Returns 1 for a hit, zero for a miss.
To do:
Initialise the hitbins array used by gethitbin. ts and ps specify the number of bins per degree of theta and phi respectively. If this function is called more than once it automatically frees the memory for the old array and initialises the new one to zero.
Frees the hitbins array to save memory.
Convert floating point theta and phi into a pointer to a bin. If inithitbins hasn't been called, then this routine will automatically call it specifying 2 bins per degree.
To do: Decide if this routine (and inithitbins and freehitbins) should be part of the coord package, or if they should be made into their own package.