QwAnalysis
|
Combines track segments and performs line fitting. More...
#include <QwTrackingTreeCombine.h>
Public Member Functions | |
QwTrackingTreeCombine () | |
virtual | ~QwTrackingTreeCombine () |
void | SetDebugLevel (const int debuglevel) |
Set the debug level. More... | |
void | SetMaxRoad (const double maxroad) |
Set the maximum road width. More... | |
void | SetMaxXRoad (const double maxxroad) |
Set the maximum X road width (?) More... | |
void | SetGeometry (const QwGeometry &geometry) |
Set the geometry. More... | |
int | SelectLeftRightHit (double *xresult, double dist_cut, QwHitContainer *hitlist, QwHit **ha, double Dx=0) |
Select the left or right hit assignment for HDC hits. More... | |
QwHit * | SelectLeftRightHit (double track_position, QwHit *hit) |
Select the left or right hit assignment for VDC hits. More... | |
void | SelectPermutationOfHits (int i, int mul, int l, int *r, QwHit *hx[DLAYERS][MAXHITPERLINE], QwHit **ha) |
void | r2_TreelineFit (double &slope, double &offset, double cov[3], double &chi, QwHit **hits, int n) |
void | r3_TreelineFit (double &slope, double &offset, double cov[3], double &chi, const std::vector< QwHit * > hits, double z1, int wire_offset) |
int | selectx (double *xresult, double dist_cut, QwHit **hitarray, QwHit **ha) |
int | contains (double var, QwHit **arr, int len) |
bool | TlCheckForX (double x1, double x2, double dx1, double dx2, double Dx, double z1, double dz, QwTreeLine *treefill, QwHitContainer *hitlist, int dlayer, int tlayer, int iteration, int stay_tuned, double width) |
int | TlMatchHits (double x1, double x2, double z1, double z2, QwTreeLine *treeline, QwHitContainer *hitlist, int tlayers) |
bool | InAcceptance (EQwDetectorPackage package, EQwRegionID region, double cx, double mx, double cy, double my) |
void | TlTreeLineSort (QwTreeLine *tl, QwHitContainer *hl, EQwDetectorPackage package, EQwRegionID region, EQwDirectionID dir, unsigned long bins, int tlayer, int dlayer, double width) |
QwPartialTrack * | TcTreeLineCombine (QwTreeLine *wu, QwTreeLine *wv, QwTreeLine *wx, int tlayer, bool drop_worst_hit) |
The. More... | |
QwPartialTrack * | TcTreeLineCombine (QwTreeLine *wu, QwTreeLine *wv, int tlayer) |
std::vector< QwPartialTrack * > | TlTreeCombine (const std::vector< QwTreeLine * > &treelines_x, const std::vector< QwTreeLine * > &treelines_u, const std::vector< QwTreeLine * > &treelines_v, EQwDetectorPackage package, EQwRegionID region, int tlayer, int dlayer) |
int | r2_PartialTrackFit (const int num_hits, QwHit **hits, double *fit, double *cov, double &chi2, double *signedresidual, bool drop_worst_hit) |
QwPartialTrack * | r3_PartialTrackFit (const QwTreeLine *wu, const QwTreeLine *wv) |
Private Attributes | |
int | fDebug |
Debug level. More... | |
double | fMaxRoad |
double | fMaxXRoad |
QwGeometry | fGeometry |
int | fMaxMissedPlanes |
Maximum number of missed planes in region 2. More... | |
int | fMaxMissedWires |
Maximum number of missed wires in region 3. More... | |
bool | fDropWorstHit |
Drop the hit with largest residual and attempt partial track fit again in region 2. More... | |
Combines track segments and performs line fitting.
Treecombine performs many of the tasks involved with matching hits to track segments and combining track segments into full tracks with lab coordinates.
Definition at line 45 of file QwTrackingTreeCombine.h.
QwTrackingTreeCombine::QwTrackingTreeCombine | ( | ) |
Definition at line 61 of file QwTrackingTreeCombine.cc.
References fDebug, fDropWorstHit, fMaxMissedPlanes, fMaxMissedWires, QwOptions::GetValue(), and gQwOptions.
|
virtual |
Definition at line 76 of file QwTrackingTreeCombine.cc.
int QwTrackingTreeCombine::contains | ( | double | var, |
QwHit ** | arr, | ||
int | len | ||
) |
Definition at line 567 of file QwTrackingTreeCombine.cc.
Referenced by selectx().
bool QwTrackingTreeCombine::InAcceptance | ( | EQwDetectorPackage | package, |
EQwRegionID | region, | ||
double | cx, | ||
double | mx, | ||
double | cy, | ||
double | my | ||
) |
This method checks whether a track with the given parameters is in the geometric acceptance of all defined detector planes in the specified region and package. Geometric acceptance is calculated from the centers and widths in the geometry definition.
Returns one if in the acceptance (or always for region 2), returns zero if not in the acceptance of at least one detector plane.
Definition at line 650 of file QwTrackingTreeCombine.cc.
References fGeometry, QwDetectorInfo::GetZPosition(), QwGeometry::in(), QwDetectorInfo::InAcceptance(), kDirectionU, kDirectionV, kRegionID2, and kRegionID3.
int QwTrackingTreeCombine::r2_PartialTrackFit | ( | const int | num_hits, |
QwHit ** | hits, | ||
double * | fit, | ||
double * | cov, | ||
double & | chi2, | ||
double * | signedresidual, | ||
bool | drop_worst_hit | ||
) |
-----------------------------------------------------------------------—*\
r2_TrackFit()
This function fits a set of hits in the HDC to a 3-D track. This task is complicated by the unorthogonality of the u,v, and x wire planes. To obtain the track, the metric matrix (defined below) is calculated using the projections of each hit into the lab coordinate system. The matrix is inverted in order to solve the system of four equations for the four unknown track parameters (bx,mx,by,my). Once the fit is calculated, the chisquare value is determined so that this track may be compared to other track candidates in order to select the best fit.
metric matrix : The metric matrix is defined by the chi-squared equation for unorthogonal coordinate systems. In order to solve for the four track parameters, chi-square is differentiated with respect to the parameters, and set to zero. The metric matrix is then derived from the four equations using the standard linear algebra technique for solving systems of equations.
Definition at line 1668 of file QwTrackingTreeCombine.cc.
References QwLog::endl(), fDebug, VQwTrackingElement::GetDetectorInfo(), QwDetectorInfo::GetElementAngleCos(), QwDetectorInfo::GetElementAngleSin(), VQwTrackingElement::GetPlane(), QwDetectorInfo::GetPlaneOffset(), QwDetectorInfo::GetSpatialResolution(), QwDetectorInfo::GetXPosition(), QwDetectorInfo::GetYPosition(), QwDetectorInfo::GetZPosition(), kDirectionU, kDirectionV, kDirectionX, M_A_times_b(), M_Invert(), QwDebug, QwVerbose, and QwWarning.
Referenced by TcTreeLineCombine().
void QwTrackingTreeCombine::r2_TreelineFit | ( | double & | slope, |
double & | offset, | ||
double | cov[3], | ||
double & | chi, | ||
QwHit ** | hits, | ||
int | n | ||
) |
slope | (returns) slope of fitted track |
offset | (returns) offset of fitted track |
cov | (returns) covariance matrix of slope and offset |
chi | (returns) chi^2 of the fit |
hits | list of hits in every plane |
n | number of planes with hits |
Definition at line 276 of file QwTrackingTreeCombine.cc.
References QwHit::CalculateTreeLineResidual(), Qw::G, VQwTrackingElement::GetDetectorInfo(), QwHit::GetDriftPosition(), QwDetectorInfo::GetSpatialResolution(), QwHit::GetTreeLineResidual(), QwDetectorInfo::GetZPosition(), QwHit::SetTreeLinePosition(), and QwHit::SetUsed().
Referenced by TlCheckForX().
QwPartialTrack * QwTrackingTreeCombine::r3_PartialTrackFit | ( | const QwTreeLine * | wu, |
const QwTreeLine * | wv | ||
) |
xtrans,ytrans,ztrans are first plane's information
Definition at line 2060 of file QwTrackingTreeCombine.cc.
References QwPartialTrack::AddTreeLine(), QwLog::endl(), QwPartialTrack::fChi, QwTreeLine::fChi, QwPartialTrack::fCov, QwPartialTrack::fIsVoid, QwPartialTrack::fNumHits, QwTreeLine::fNumHits, QwTreeLine::fOffset, QwPartialTrack::fOffsetX, QwPartialTrack::fOffsetY, QwTreeLine::fSlope, QwPartialTrack::fSlopeX, QwPartialTrack::fSlopeY, Uv2xy::fXY, VQwTrackingElement::GetDetectorInfo(), QwDetectorInfo::GetDetectorPitchCos(), QwDetectorInfo::GetDetectorPitchSin(), QwDetectorInfo::GetDetectorRollCos(), QwDetectorInfo::GetDetectorRollSin(), QwDetectorInfo::GetDirection(), QwDetectorInfo::GetElementAngle(), QwTreeLine::GetHit(), QwDetectorInfo::GetPackage(), QwDetectorInfo::GetXPosition(), QwDetectorInfo::GetYPosition(), QwDetectorInfo::GetZPosition(), kDirectionU, kDirectionV, kNumDirections, kPackage1, Qw::pi, QwDebug, QwVerbose, and QwWarning.
Referenced by TlTreeCombine().
void QwTrackingTreeCombine::r3_TreelineFit | ( | double & | slope, |
double & | offset, | ||
double | cov[3], | ||
double & | chi, | ||
const std::vector< QwHit * > | hits, | ||
double | z1, | ||
int | wire_offset | ||
) |
Definition at line 454 of file QwTrackingTreeCombine.cc.
References Qw::G.
Referenced by QwTrackingTreeMatch::MatchRegion3(), and TlMatchHits().
int QwTrackingTreeCombine::SelectLeftRightHit | ( | double * | xresult, |
double | resolution, | ||
QwHitContainer * | hitlist, | ||
QwHit ** | ha, | ||
double | Dx = 0 |
||
) |
Select the left or right hit assignment for HDC hits.
Determines whether the left or right drift distance assignment is closer to the supplied track coordinate for hits in region 2.
xresult | Position of the track crossing through this plane |
resolution | Resolution in this detector plane |
hitlist | Detected hit list (left/right ambiguity not resolved yet) |
ha | Returned hit list (left/right ambiguity is now resolved) |
Dx | Detector offset in the wire plane direction (default value is zero) |
Definition at line 130 of file QwTrackingTreeCombine.cc.
References QwHit::fDriftPosition, QwHit::GetDriftPosition(), and MAXHITPERLINE.
Referenced by TlCheckForX(), and TlMatchHits().
Select the left or right hit assignment for VDC hits.
Determines whether the left or right drift distance assignment is closer to the supplied coordinate for hits in region 3.
track_position | Position of the track through this detector plane |
hit | Hit for which we want to resolve the left/right ambiguity |
Definition at line 90 of file QwTrackingTreeCombine.cc.
References QwHit::fDriftPosition, and QwHit::GetDriftDistance().
void QwTrackingTreeCombine::SelectPermutationOfHits | ( | int | i, |
int | mul, | ||
int | l, | ||
int * | r, | ||
QwHit * | hx[DLAYERS][MAXHITPERLINE], | ||
QwHit ** | ha | ||
) |
Definition at line 224 of file QwTrackingTreeCombine.cc.
Referenced by TlCheckForX().
int QwTrackingTreeCombine::selectx | ( | double * | xresult, |
double | dist_cut, | ||
QwHit ** | hitarray, | ||
QwHit ** | ha | ||
) |
Definition at line 597 of file QwTrackingTreeCombine.cc.
References contains(), DLAYERS, QwHit::GetDriftPosition(), and MAXHITPERLINE.
Referenced by TlCheckForX().
|
inline |
Set the debug level.
Definition at line 53 of file QwTrackingTreeCombine.h.
References fDebug.
Referenced by QwTrackingWorker::QwTrackingWorker().
|
inline |
Set the geometry.
Definition at line 60 of file QwTrackingTreeCombine.h.
References fGeometry.
Referenced by QwTrackingWorker::QwTrackingWorker().
|
inline |
Set the maximum road width.
Definition at line 55 of file QwTrackingTreeCombine.h.
References fMaxRoad.
Referenced by QwTrackingWorker::QwTrackingWorker().
|
inline |
Set the maximum X road width (?)
Definition at line 57 of file QwTrackingTreeCombine.h.
References fMaxXRoad.
Referenced by QwTrackingWorker::QwTrackingWorker().
QwPartialTrack * QwTrackingTreeCombine::TcTreeLineCombine | ( | QwTreeLine * | wu, |
QwTreeLine * | wv, | ||
QwTreeLine * | wx, | ||
int | tlayer, | ||
bool | drop_worst_hit | ||
) |
The.
-----------------------------------------------------------------------—*\
This function fits a set of hits in the HDC to a 3-D track. This task is complicated by the unorthogonality of the u,v, and x wire planes. To obtain the track, the metric matrix (defined below) is calculated using the projections of each hit into the lab coordinate system. The matrix is inverted in order to solve the system of four equations for the four unknown track parameters (bx,mx,by,my). Once the fit is calculated, the chisquare value is determined so that this track may be compared to other track candidates in order to select the best fit.
metric matrix : The metric matrix is defined by the chi-squared equation for unorthogonal coordinate systems. In order to solve for the four track parameters, chi-square is differentiated with respect to the parameters, and set to zero. The metric matrix is then derived from the four equations using the standard linear algebra technique for solving systems of equations.
Definition at line 2278 of file QwTrackingTreeCombine.cc.
References QwPartialTrack::AddTreeLine(), DLAYERS, QwLog::endl(), QwPartialTrack::fChi, QwPartialTrack::fCov, QwTreeLine::fHits, QwPartialTrack::fIsVoid, QwPartialTrack::fNumHits, QwTreeLine::fNumHits, QwPartialTrack::fNumMiss, QwTreeLine::fNumMiss, QwPartialTrack::fOffsetX, QwPartialTrack::fOffsetY, QwPartialTrack::fSignedResidual, QwPartialTrack::fSlopeX, QwPartialTrack::fSlopeY, QwTreeLine::GetAverageResidual(), QwHit::IsUsed(), kDirectionU, kDirectionV, kDirectionX, MAXHITPERLINE, QwWarning, r2_PartialTrackFit(), QwPartialTrack::SetAverageResidual(), and QwPartialTrack::TResidual.
Referenced by TlTreeCombine().
QwPartialTrack* QwTrackingTreeCombine::TcTreeLineCombine | ( | QwTreeLine * | wu, |
QwTreeLine * | wv, | ||
int | tlayer | ||
) |
bool QwTrackingTreeCombine::TlCheckForX | ( | double | x1, |
double | x2, | ||
double | dx1, | ||
double | dx2, | ||
double | Dx, | ||
double | z1, | ||
double | Dz, | ||
QwTreeLine * | treeline, | ||
QwHitContainer * | hitlist, | ||
int | dlayer, | ||
int | tlayer, | ||
int | iteration, | ||
int | stay_tuned, | ||
double | width | ||
) |
In TlCheckForX we search for the possible hit assignments for the treeline. While looping over the detector planes, we look at all registered hits and store 'good enough' hits in the goodHits array (indexed by plane number and hit number). Both left and right hits can be stored in goodHits, and a maximum of MAXHITPERLINE hits per detector plane is enforced.
Since only one hit per detector plane can be associated with the treeline, we determine the chi^2 for all possible hit permutations. The hit combination with the best chi^2 is stored in the treeline structure.
x1 | position at first plane |
x2 | position at last plane |
dx1 | uncertainty at first plane |
dx2 | uncertainty at last plane |
Dx | offset between first and last planes |
z1 | reference z coordinate |
Dz | distance between first and last planes |
treeline | treeline to operate on |
hitlist | hit list |
dlayer | |
tlayer | |
iteration | |
stay_tuned | |
width |
Definition at line 724 of file QwTrackingTreeCombine.cc.
References QwTreeLine::AddHit(), QwHit::CalculateTreeLineResidual(), DLAYERS, QwLog::endl(), QwTreeLine::fChi, fDebug, fGeometry, QwTreeLine::fHits, QwTreeLine::fMatchingPattern, fMaxMissedPlanes, fMaxRoad, QwTreeLine::fNumHits, QwTreeLine::fNumMiss, QwTreeLine::fOffset, QwTreeLine::fSlope, VQwTrackingElement::GetDetectorInfo(), VQwTrackingElement::GetDirection(), VQwTrackingElement::GetRegion(), QwHitContainer::GetSubList_Plane(), QwOptions::GetValue(), gQwOptions, QwGeometry::in(), kRegionID2, kRegionID3, MAGNET_CENTER, MAXHITPERLINE, QwDebug, r2_TreelineFit(), SelectLeftRightHit(), SelectPermutationOfHits(), selectx(), QwTreeLine::SetCov(), VQwTrackingElement::SetDetectorInfo(), QwHit::SetTreeLinePosition(), QwHit::SetUsed(), QwTreeLine::SetValid(), and QwTreeLine::SetVoid().
Referenced by TlTreeLineSort().
int QwTrackingTreeCombine::TlMatchHits | ( | double | x1, |
double | x2, | ||
double | z1, | ||
double | z2, | ||
QwTreeLine * | treeline, | ||
QwHitContainer * | hitlist, | ||
int | tlayers | ||
) |
x1 | x coordinates at first wire (i.e. distances) |
x2 | x coordinates at last wire (i.e. distances) |
z1 | z coordinates of first wire (i.e. wire number |
z2 | z coordinates of last wire (i.e. wire number) |
treeline | determined treeline |
hitlist | hit list |
tlayers | number of tree layers |
Definition at line 1065 of file QwTrackingTreeCombine.cc.
References QwTreeLine::AddHit(), QwTreeLine::DeleteHit(), QwLog::endl(), QwTreeLine::fNumHits, QwTreeLine::fNumMiss, QwTreeLine::fR3FirstWire, QwTreeLine::fR3LastWire, QwTreeLine::fR3Offset, QwDetectorInfo::GetCrosstalkElement(), VQwTrackingElement::GetDetectorInfo(), VQwTrackingElement::GetElement(), QwTreeLine::GetHit(), QwTreeLine::GetListOfHits(), QwTreeLine::GetNumberOfHits(), QwHit::GetTreeLineResidual(), QwDebug, QwVerbose, r3_TreelineFit(), SelectLeftRightHit(), QwTreeLine::SetChi(), QwTreeLine::SetCov(), VQwTrackingElement::SetDetectorInfo(), QwTreeLine::SetOffset(), QwTreeLine::SetSlope(), QwHit::SetUsed(), QwTreeLine::SetValid(), and QwTreeLine::SetVoid().
Referenced by TlTreeLineSort().
std::vector< QwPartialTrack * > QwTrackingTreeCombine::TlTreeCombine | ( | const std::vector< QwTreeLine * > & | treelines_x, |
const std::vector< QwTreeLine * > & | treelines_u, | ||
const std::vector< QwTreeLine * > & | treelines_v, | ||
EQwDetectorPackage | package, | ||
EQwRegionID | region, | ||
int | tlayer, | ||
int | dlayer | ||
) |
Definition at line 2411 of file QwTrackingTreeCombine.cc.
References QwPartialTrack::CalculateAverageResidual(), QwLog::endl(), QwPartialTrack::fChi, fDebug, fDropWorstHit, VQwTrackingElement::GetDetectorInfo(), QwTreeLine::GetHit(), QwTreeLine::GetNumberOfHits(), VQwTrackingElement::GetOctant(), VQwTrackingElement::GetPlane(), QwOptions::GetValue(), gQwOptions, QwPartialTrack::IsValid(), QwTreeLine::IsVoid(), kRegionID2, kRegionID3, QwDebug, QwError, QwOut, QwWarning, r3_PartialTrackFit(), QwPartialTrack::RotateCoordinates(), QwPartialTrack::RotateRotator(), QwPartialTrack::SetAlone(), VQwTrackingElement::SetOctant(), VQwTrackingElement::SetPackage(), VQwTrackingElement::SetRegion(), QwTreeLine::SetUsed(), and TcTreeLineCombine().
Referenced by QwTrackingWorker::ProcessEvent().
void QwTrackingTreeCombine::TlTreeLineSort | ( | QwTreeLine * | tl, |
QwHitContainer * | hl, | ||
EQwDetectorPackage | package, | ||
EQwRegionID | region, | ||
EQwDirectionID | dir, | ||
unsigned long | bins, | ||
int | tlayer, | ||
int | dlayer, | ||
double | width | ||
) |
Definition at line 1320 of file QwTrackingTreeCombine.cc.
References QwTreeLine::CalculateAverageResidual(), QwTreeLine::CalculateDistance(), QwLog::endl(), fDebug, fGeometry, fMaxRoad, QwTreeLine::fR3FirstWire, QwTreeLine::fR3LastWire, QwTreeLine::fR3Offset, QwDetectorInfo::GetOctant(), QwDetectorInfo::GetPlaneOffset(), QwTreeLine::GetPositionFirst(), QwTreeLine::GetPositionLast(), QwTreeLine::GetResolutionFirst(), QwTreeLine::GetResolutionLast(), QwDetectorInfo::GetZPosition(), QwGeometry::in(), QwTreeLine::IsValid(), QwTreeLine::IsVoid(), kRegionID2, kRegionID3, MAX_LAYERS, QwTreeLine::next, QwTreeLine::Print(), QwDebug, QwWarning, VQwTrackingElement::SetOctant(), TlCheckForX(), and TlMatchHits().
Referenced by QwTrackingWorker::ProcessEvent().
|
private |
Debug level.
Definition at line 132 of file QwTrackingTreeCombine.h.
Referenced by QwTrackingTreeCombine(), r2_PartialTrackFit(), SetDebugLevel(), TlCheckForX(), TlTreeCombine(), and TlTreeLineSort().
|
private |
Drop the hit with largest residual and attempt partial track fit again in region 2.
Definition at line 145 of file QwTrackingTreeCombine.h.
Referenced by QwTrackingTreeCombine(), and TlTreeCombine().
|
private |
Definition at line 137 of file QwTrackingTreeCombine.h.
Referenced by InAcceptance(), SetGeometry(), TlCheckForX(), and TlTreeLineSort().
|
private |
Maximum number of missed planes in region 2.
Definition at line 140 of file QwTrackingTreeCombine.h.
Referenced by QwTrackingTreeCombine(), and TlCheckForX().
|
private |
Maximum number of missed wires in region 3.
Definition at line 142 of file QwTrackingTreeCombine.h.
Referenced by QwTrackingTreeCombine().
|
private |
Definition at line 134 of file QwTrackingTreeCombine.h.
Referenced by SetMaxRoad(), TlCheckForX(), and TlTreeLineSort().
|
private |
Definition at line 135 of file QwTrackingTreeCombine.h.
Referenced by SetMaxXRoad().