Sgutil
SGLIB/SGUTIL package contains Dave Haddle's noise reduction software with segment finding extensions. It resides in $CODA/src/codatt/sgutil.c and is called from $CLON/src/cmon/prlib/sglib.c.
SGLIB contains following functions:
- sginit() - must be called once at initialization stage; creates differencial shift table and fills lookup tables
- sgtrigger() - works for specified sector; return 0 if sector does not have required track information, otherwise returns the number of superlayers with segments; calls function RemoveNoise() from SGUTIL
- sgremovenoise() - works for specified sector; rewrites all DC banks removing single hits; calls function RemoveNoise() from SGUTIL
- sglib() - find segments for one sector; three options can be specified: noise removing only, segment finding only, noise removing and then segment finding; calls functions RemoveNoise(), SegmentSearch128() and SegmentSearch192() from SGUTIL
- sgprint() - print results for one sector
- sgroad() - fill road finding structures, SWAPING region 1
SGUTIL contains following functions:
- BinaryPrint32(), PrintWord192(), CopyWord192(), ANDWord192(), ORWord192(), XORWord192(), CheckBitWord192(), SetBitWord192(), ClearWord192(), NegateWord192(), BleedRightWord192(), BleedLeftWord192() - functions for 192-bit words operations
- RightShiftWord192(), LeftShiftWord192(), RIGHTSHIFT(), RightShiftWord192_00(), RightShiftWord192_01(), RightShiftWord192_02(), RightShiftWord192_03(), LEFTSHIFT(), LeftShiftWord192_00(), LeftShiftWord192_01(), LeftShiftWord192_02(), LeftShiftWord192_03() - macroses for 192-bit words operations
- RemoveNoise() - works for one superlayer, removes single hits; it is very much the same as original Dave's program, with some optimization; it returns 0 if nothing left after single hits removing, or 1 otherwise
- SuperLayerSum() - used by RemoveNoise() only; does fast summing of the 6 192-bit words following algorithm suggested by Pavel Degtiarenko; output is the 192-bit word where every bit contains result of the summing of the corresponding 6-bit vertical column
ALGORITHMS DESCRIPTION
192-bit words were summed using binary numbers adding procedure. As it was suggested by Pavel Degtyarenko, simple adder was implemented, and following adding procedure was used to get a sum of 6 192-bit words representing 6 layers of the Drift Chamber superlayer. This method was used in SuperLayerSum/RemoveNoise procedure to found areas with segments, and in the first stage of SegmentSearch192 procedure.
SegmentSearch192 searches for segments in 3 steps. On the first step shift-and-sum operation is performed separately for axial and stereo superlayers. Results are stored in 3 192-bit words, where vertical 3-bit columns contains the number of hits. Using lookup tables those numbers are converted into integers to be used on following step.
On second step one of the superlayers is shifted against anothe one, and search is conducted for the region-based segments, and list of segment candidates is produced.