QwAnalysis
|
#include <QwTrackingTreeSearch.h>
Public Member Functions | |
QwTrackingTreeSearch () | |
Constructor. More... | |
virtual | ~QwTrackingTreeSearch () |
Destructor. More... | |
void | SetDebugLevel (int debug) |
Set the debug level. More... | |
void | SetShowMatchingPatterns (bool show=true) |
Set the flag to show matching patterns when they are found. More... | |
std::vector< QwTreeLine * > | GetListOfTreeLines () |
Get the list of tree lines. More... | |
int | exists (int *newa, int front, int back, int offset) |
void | setpoint (double off, double h1, double res1, double h2, double res2, double width, unsigned binwidth, char *pa, char *pb, int *hasha, int *hashb) |
int | TsSetPoint (double detectorwidth, double wirespacing, QwHit *hit, char *pattern, int *hash, unsigned binwidth) |
Method to set the tree pattern. More... | |
QwTreeLine * | SearchTreeLines (QwTrackingTreeRegion *searchtree, char *pattern[16], int *hashpat[16], int maxlevel, int numwires, int numlayers) |
Search for the tree lines consistent with the hit pattern. More... | |
Private Member Functions | |
void | _setpoints (double pos_start, double pos_end, double detectorwidth, unsigned binwidth, char *pattern, int *hash) |
void | _setpoint (double position, double resolution, double detectorwidth, unsigned binwidth, char *pattern, int *hash) |
void | _SearchTreeLines (shortnode *node, int level, int offset, int row_offset, int reverse, int numwires) |
Recursive tree search algorithm. More... | |
Private Attributes | |
int | fDebug |
Debug level. More... | |
bool | fShowMatchingPatterns |
Flag to show matching patterns when found. More... | |
unsigned int | fMaxMissedPlanes |
Maximum number of missed planes in region 2. More... | |
unsigned int | fMaxMissedWires |
Maximum number of missed wires in region 3. More... | |
unsigned int | fNumLayers |
Number of detector layers (general concept) More... | |
unsigned int & | fNumPlanes |
Number of region 2 HDC planes. More... | |
unsigned int & | fNumWires |
Number of region 3 VDC wires. More... | |
char ** | static_pattern |
int ** | static_hash |
int | fMaxLevel |
Maximum level of this tree search. More... | |
unsigned int | fPattern_fMaxBins |
unsigned int | fPattern_fMaxRows |
std::vector< QwTreeLine * > | fTreeLineList |
unsigned int | fNTreeLines |
Definition at line 50 of file QwTrackingTreeSearch.h.
QwTrackingTreeSearch::QwTrackingTreeSearch | ( | ) |
Constructor.
Definition at line 141 of file QwTrackingTreeSearch.cc.
References fDebug, fMaxMissedPlanes, fMaxMissedWires, fNumLayers, QwOptions::GetValue(), gQwOptions, and MAX_LAYERS.
|
virtual |
|
private |
Recursive tree search algorithm.
This highly recursive function implements the tree search algorithm. For a specified list of nodenodes, this function examines the attached treenode. If the bit pattern in the treenode does not match the bit pattern from the event, the function looks at the next nodenode. Otherwise, the function will call itself to see if any of the sons of this treenode at the next level of bin division match the bit pattern from the event. This recursive calling will continue until a treenode at the deepest level of bin division is located inside the bit pattern from the event. Since the pattern in this treenode represents a valid treeline for the event, a treeline is constructed from the treenode and then appended to the linked list of treelines being accumulated by the tree search.
node | Pointer to the first node in the linked list |
level | Depth of the treesearch, i.e. the level of the bin-division |
offset | Offset of the treenode within the pattern |
row_offset | Offset of the wire group in region 3 |
reverse | Flag "pattern is flipped" |
numwires | Number of wires in region 3 |
Reminder about the bit pattern:
HDC planes (spaces between the 5 levels of bin division) for 16 bins in wire coordinate (e.g. 16 wires) and zero distance resolution
VDC wires (spaces between the 4 levels of bin division) for 8 bins in drift distance and zero distance resolution
Determine the rows which have hits first. This is used to determine how many wires in a region 3 group have been hit. If there are fewer than a preset number of wire hits, then the search is not even started.
Check if there was a treenode match now that the matching has been completely tested, but allow for some missing wires.
Yes, there is a match, so now check if all the levels of the tree search have been done.
If so, then we have found a valid treeline.
If not, then we descend to check the son patterns
Definition at line 561 of file QwTrackingTreeSearch.cc.
References QwLog::endl(), exists(), QwTracking::shorttree::fBit, fDebug, QwTreeLine::fHashArray, fMaxLevel, fMaxMissedPlanes, fMaxMissedWires, QwTracking::shorttree::fMinLevel, fNTreeLines, QwTreeLine::fNumMiss, fNumPlanes, fNumWires, fPattern_fMaxBins, fPattern_fMaxRows, QwTreeLine::fR3FirstWire, QwTreeLine::fR3LastWire, QwTreeLine::fR3Offset, fShowMatchingPatterns, fTreeLineList, QwTracking::shortnode::GetNext(), QwTracking::shortnode::GetTree(), MAX_LAYERS, QwTracking::shorttree::Print(), QwDebug, QwError, QwWarning, QwTreeLine::SetMatchingPattern(), QwTracking::shorttree::son, static_hash, static_pattern, and TREESEARCH_MAX_TREELINES.
Referenced by SearchTreeLines().
|
private |
_setpoint() - this function sets the bins in the hit pattern for a range of positions around a central point within a specified distance/resolution by calling the setpoint() function described above.
inputs: (1) double position - position (in cm) of the center point around which the bins are to be turned on (2) double resolution - distance (in cm) around the central point for which bins are to be turned on (3) double detectorwidth - width of the tree-detector (in cm) (4) unsigned binwidth - width of a bin at the deepest level of bin-division in the treesearch. (5) char *pattern - pointer to the hit pattern for this tree-detector (6) int *hash - ???
outputs: (1) char *pattern - pointer to the hit pattern for this tree-detector (2) int *hash - pointer to ???
Definition at line 278 of file QwTrackingTreeSearch.cc.
References _setpoints().
Referenced by setpoint().
|
private |
_setpoints() - this function sets the bins in a hit pattern for a range of positions. The range of hit patterns is specified by a start and a stop position in the detector. This function turns on the bins in the hit pattern for each level of the bin-division used in the treesearch algorithm.
inputs: (1) double posStart - position (in cm) of the start of the range for which bins are to be turned on (2) double posEnd - position (in cm) of the stop of the range for which bins are to be turned on (3) double detectorwidth - width of the tree-detector (in cm) (4) unsigned binwidth - width of a bin at the deepest level of bin-division in the treesearch. (5) char *pattern - pointer to the hit pattern for this tree-detector (6) int *hash - pointer to ???
outputs: (1) char *pattern - pointer to the hit pattern for this tree-detector (2) int *hash - pointer to ???
Definition at line 191 of file QwTrackingTreeSearch.cc.
References hashgen().
Referenced by _setpoint(), and TsSetPoint().
int QwTrackingTreeSearch::exists | ( | int * | newa, |
int | front, | ||
int | back, | ||
int | offset | ||
) |
This function searches through the link-list of valid treelines to see if the bit pattern for the specified treenode has already been accepted as a valid treeline.
newa | |
front | |
back | |
offset | |
treelinelist | Pointer to the linked list of treelines |
Definition at line 451 of file QwTrackingTreeSearch.cc.
References QwTreeLine::a_beg, QwTreeLine::a_end, QwTreeLine::b_beg, QwTreeLine::b_end, QwTreeLine::fHashArray, fNumLayers, fNumPlanes, QwTreeLine::fR3Offset, fTreeLineList, and QwTreeLine::IsVoid().
Referenced by _SearchTreeLines().
std::vector< QwTreeLine * > QwTrackingTreeSearch::GetListOfTreeLines | ( | ) |
Get the list of tree lines.
Definition at line 160 of file QwTrackingTreeSearch.cc.
References fTreeLineList.
QwTreeLine * QwTrackingTreeSearch::SearchTreeLines | ( | QwTrackingTreeRegion * | searchtree, |
char * | pattern[16], | ||
int * | hashpat[16], | ||
int | maxlevel, | ||
int | numwires, | ||
int | numlayers | ||
) |
Search for the tree lines consistent with the hit pattern.
Initiate the treesearch for a set of tree detectors by calling the recursive _SearchTreeLines() function. The tree search algorithm is explained in QwTrackingTreeSearch::_SearchTreeLine().
searchtree | Pattern search tree |
pattern | Hit pattern |
hashpat | Hash pattern |
maxlevel | Maximum number of levels |
numwires | Number of wires in region 3 |
numlayers | Number of layers in region 3 |
For every wire we perform a recursive search. For region 2 the number of wires is set to zero, so this will only execute once for every plane. For region 3 we will run over all the wires in the plane, and consider the next fNumWires wires (so we need to end early).
For region 3, we determine which groups of wires need to be considered: only those groups of numlayers wires with at least one hit are to be considered; the others are empty and the tree search should not even be started.
Definition at line 1045 of file QwTrackingTreeSearch.cc.
References _SearchTreeLines(), QwLog::endl(), fMaxLevel, fNTreeLines, fNumLayers, fPattern_fMaxBins, fPattern_fMaxRows, fTreeLineList, QwTrackingTreeRegion::GetNode(), Qw::min, QwDebug, static_hash, and static_pattern.
Referenced by QwTrackingWorker::ProcessEvent().
|
inline |
Set the debug level.
Definition at line 60 of file QwTrackingTreeSearch.h.
References fDebug.
Referenced by QwTrackingWorker::QwTrackingWorker().
void QwTrackingTreeSearch::setpoint | ( | double | off, |
double | h1, | ||
double | res1, | ||
double | h2, | ||
double | res2, | ||
double | width, | ||
unsigned | binwidth, | ||
char * | pa, | ||
char * | pb, | ||
int * | hasha, | ||
int * | hashb | ||
) |
setpoint() - this function sets the bins in the hit pattern for a range of positions specified by a center point and a half-distance around the center point by calling the _setpoint() function described above.
If hit patterns are supplied to this function for both the primed and unprimed planes, the two planes are treated as separate tree-detectors. In this case, the hit patterns are updated for each plane individually. This feature is used for the front region when the VCs are not included in the fit because, for these fits, each FC plane is treated as a single tree-detector.
Otherwise, the two planes are treated as a single tree-detector and a single hit pattern is formed from the hits seen in the two planes.
inputs: (01) double off - alignment offset of the tree-detector (in cm) (02) double h1 - center point of hit range on plane 1 (in cm) (03) double res1 - width of hit range on plane 1 (in cm) (04) double h2 - center point of hit range on plane 2 (in cm) (05) double res2 - width of hit range on plane 2 (in cm) (06) double width - width of the tree-detector (in cm) (07) unsigned binwidth - width of a bin at the deepest level of bin-division in the treesearch. (08) char *pa - pointer to the hit pattern for tree-detector 1 (09) char *pb - pointer to the hit pattern for tree-detector 2, =0 if there is no tree-detector 2 because the planes are being combined into one tree-detector (10) int *hasha - pointer to ??? (11) int *hashb - pointer to ???
outputs: (01) char *pa - pointer to the updated hit pattern for tree-detector 1 (02) char *pb - pointer to the updated hit pattern for tree-detector 2, = 0 if there is no tree-detector 2 because the planes are being combined into one tree-detector (03) int *hasha - pointer to ??? (04) int *hashb - pointer to ???
Definition at line 339 of file QwTrackingTreeSearch.cc.
References _setpoint().
|
inline |
Set the flag to show matching patterns when they are found.
Definition at line 63 of file QwTrackingTreeSearch.h.
References fShowMatchingPatterns.
Referenced by QwTrackingWorker::QwTrackingWorker().
int QwTrackingTreeSearch::TsSetPoint | ( | double | detectorwidth, |
double | wirespacing, | ||
QwHit * | hit, | ||
char * | pattern, | ||
int * | hash, | ||
unsigned | binwidth | ||
) |
Method to set the tree pattern.
TsSetPoint() - this function creates the bit patterns for two partner planes (planes with the like-pitched wires in the same chamber.
This function can treat the two planes in two different fashions, specifically:
(1) the planes can be treated as one tree-detector. In this case, a check is performed to see if a hit on one of the planes can be matched to a hit on the other plane (within the allowances of the maximum track slope specified by the HRCset parameter MaxSlope). If the hits are paired together by this search, the bit pattern is set around the allowable tracks through both hits. If a hit is not paired in this search, the bit pattern is set for the region around the hit. (This method is the standard for the back chambers since they have eight planes per treeline).
(2) the planes are treated as individual tree-detectors. In this case, a separate hit pattern is created for both planes and the above described searching for paired hits is not employed. (This method is the standard for the front chambers since they have only four planes per treeline).
inputs: (01) double detectorwidth - width of the tree-detector (in cm) (02) double zdistance - distance between the two planes forming this tree-detector (in cm) (03) Hit *Ha - linked list of hits for the unprimed plane of this tree-detector (04) Hit *Hb - linked list of hits for the primed plane of this tree-detector (05) unsigned binwidth - width of a bin (in cm) at the deepest bin-division in the treesearch.
outputs: (01) int TsSetPoint() - the number of single and paired hits processed by this return (02) char *patterna - pointer to the hit pattern for tree-detector (03) char *patternb - pointer to the hit pattern for the optional second tree-detector (04) int *hasha - pointer to ??? (05) int *hashb - pointer to ???
Definition at line 414 of file QwTrackingTreeSearch.cc.
References _setpoints(), VQwTrackingElement::GetDetectorInfo(), QwHit::GetDriftDistance(), VQwTrackingElement::GetElement(), QwDetectorInfo::GetElementSpacing(), and QwDetectorInfo::GetTrackResolution().
|
private |
Debug level.
Definition at line 87 of file QwTrackingTreeSearch.h.
Referenced by _SearchTreeLines(), QwTrackingTreeSearch(), and SetDebugLevel().
|
private |
Maximum level of this tree search.
Definition at line 103 of file QwTrackingTreeSearch.h.
Referenced by _SearchTreeLines(), and SearchTreeLines().
|
private |
Maximum number of missed planes in region 2.
Definition at line 92 of file QwTrackingTreeSearch.h.
Referenced by _SearchTreeLines(), and QwTrackingTreeSearch().
|
private |
Maximum number of missed wires in region 3.
Definition at line 93 of file QwTrackingTreeSearch.h.
Referenced by _SearchTreeLines(), and QwTrackingTreeSearch().
|
private |
Definition at line 110 of file QwTrackingTreeSearch.h.
Referenced by _SearchTreeLines(), and SearchTreeLines().
|
private |
Number of detector layers (general concept)
Definition at line 96 of file QwTrackingTreeSearch.h.
Referenced by exists(), QwTrackingTreeSearch(), and SearchTreeLines().
|
private |
Number of region 2 HDC planes.
Definition at line 97 of file QwTrackingTreeSearch.h.
Referenced by _SearchTreeLines(), and exists().
|
private |
Number of region 3 VDC wires.
Definition at line 98 of file QwTrackingTreeSearch.h.
Referenced by _SearchTreeLines().
|
private |
Definition at line 106 of file QwTrackingTreeSearch.h.
Referenced by _SearchTreeLines(), and SearchTreeLines().
|
private |
Definition at line 107 of file QwTrackingTreeSearch.h.
Referenced by _SearchTreeLines(), and SearchTreeLines().
|
private |
Flag to show matching patterns when found.
Definition at line 89 of file QwTrackingTreeSearch.h.
Referenced by _SearchTreeLines(), and SetShowMatchingPatterns().
|
private |
Definition at line 109 of file QwTrackingTreeSearch.h.
Referenced by _SearchTreeLines(), exists(), GetListOfTreeLines(), and SearchTreeLines().
|
private |
Definition at line 101 of file QwTrackingTreeSearch.h.
Referenced by _SearchTreeLines(), and SearchTreeLines().
|
private |
Definition at line 100 of file QwTrackingTreeSearch.h.
Referenced by _SearchTreeLines(), and SearchTreeLines().