Belle II Software development
|
Track finding algorithm class for linear tracks produced by cosmics in the VXD without magnetic field. More...
#include <StandaloneCosmicsCollector.h>
Public Member Functions | |
StandaloneCosmicsCollector ()=default | |
Constructor. | |
~StandaloneCosmicsCollector ()=default | |
Destructor. | |
void | setSortingMode (unsigned short index) |
Set sorting mode used in addSpacePoints. | |
void | addSpacePoints (std::vector< StoreArray< SpacePoint > > SPs) |
Function to initialize the track finder anew for an event with its set of SpacePoints provided via their StoreArray. | |
bool | doFit (double qualityCut, int maxRejected, int minSPs) |
Function to perform the actual line fit based on the StoreArray of SpacePoints provided. | |
std::pair< std::vector< double >, std::vector< double > > | getResult () |
Getter for the position and momentum seed resulting from the linear fit. | |
std::vector< const SpacePoint * > | getSPTC () |
Getter for the sorted list of SpacePoints used for the final fit which met the given requirements. | |
double | getReducedChi2 () |
Getter for the final reduced chi squared value obtained for the set of SpacePoints used for the last performed fit. | |
Private Member Functions | |
void | addSpacePoint (const SpacePoint *SP) |
Adding single SpacePoint to the sorted member vector m_spacePoints, beginning with the SpacePoint with the smallest radius sqrt(x^2 + y^2). | |
bool | doLineFit (int minSPs) |
Function performing the actual line fit via a principal component analysis method yielding a direction vector based on the eigen vector corresponding to the largest eigenvalue and a seed position calculated as the mean of all given SpacePoints. | |
bool | compareRads (const SpacePoint *a, const SpacePoint *b) |
Compare function used by addSpacePoint to sort the member vector of SpacePoints m_spacePoints by the radius calculated with x^2 + y^2. | |
void | resortHits () |
Function to resort the member vector of SpacePoints m_spacePoints based on the members m_start and m_direction obtained by the fit, so that the track candidate starts form the outermost hit and the following hits are sorted following the direction m_direction. | |
bool | comparePars (const SpacePoint *a, const SpacePoint *b) |
Comparison function to compare two SpacePoints based on the distance between the start point of the fitted line m_start and their intersect with the fitted line. | |
Private Attributes | |
std::vector< const SpacePoint * > | m_spacePoints |
Member vector of SpacePoints holding the SpacePoints considered for the track candidate. | |
unsigned short | m_sortingMode = 1 |
Storing identifier for sorting algorithm to be used for the function addSpacePoint. | |
double | m_reducedChi2 = 10 |
Member variable containing the reduced chi squared value of the current line fit. | |
std::pair< double, int > | m_largestChi2 = std::pair<double, int>(0., 0) |
Pair containing the index of the vector m_spacePoints for the SpacePoint with the largest contribution to the chi2 value of the last fit and the respectiv contribution first: contribution to the total chi2 value of the last fit second: index of the SpacePoint with this largest contribution in the vector m_spacePoints. | |
std::vector< double > | m_start {0., 0., 0.} |
Start point obtained by the last performed line fit. | |
std::vector< double > | m_direction {0., 0., 0.} |
Direction of the line obtained by the last performed line fit. | |
Track finding algorithm class for linear tracks produced by cosmics in the VXD without magnetic field.
The algorithm uses a simple principal component analysis approach to find a momentum and position seed assuming the presence of only the one track produced by the cosmic in the detector. SpacePoints produced by detector noise can be discarded by the TF by removing the biggest outlier until an adequate reduced chi squared value is reached. The track finder requires a minimal number of SpacePoints for a track, a reduced chi squared value below a given threshold, and the number of rejected SpacePoints to be below a given maximum.
Definition at line 33 of file StandaloneCosmicsCollector.h.
|
inlineprivate |
Adding single SpacePoint to the sorted member vector m_spacePoints, beginning with the SpacePoint with the smallest radius sqrt(x^2 + y^2).
SP |
Definition at line 158 of file StandaloneCosmicsCollector.h.
|
inline |
Function to initialize the track finder anew for an event with its set of SpacePoints provided via their StoreArray.
This also resets all internal variables for the new event.
SPs | StoreArray of SpacePoints of the event to be analyzed. |
Definition at line 66 of file StandaloneCosmicsCollector.h.
|
inlineprivate |
Comparison function to compare two SpacePoints based on the distance between the start point of the fitted line m_start and their intersect with the fitted line.
a | left hand side SpacePoint |
b | right hand side SpacePoint |
Definition at line 318 of file StandaloneCosmicsCollector.h.
|
inlineprivate |
Compare function used by addSpacePoint to sort the member vector of SpacePoints m_spacePoints by the radius calculated with x^2 + y^2.
The square root is omitted, as it does not matter for the comparison.
a | left hand side SpacePoint |
b | right hand side SpacePoint |
Definition at line 270 of file StandaloneCosmicsCollector.h.
|
inline |
Function to perform the actual line fit based on the StoreArray of SpacePoints provided.
The fit performs a principal component analysis based on the provided 3D-points, refitting the SpacePoints again with the worst Point removed, if the given qualityCut on the reduced chi squared value is not reached. This is done until the requirement is met, or a maximal number of rejected SpacePoints (maxRejected) is reached. Furthermore the fitting is aborted, if not a minimal number of SpacePoints (minSPs) is provided. The function returns true, if a track candidate fulfilling these requirements is found.
qualityCut | |
maxRejected | |
minSPs |
Definition at line 92 of file StandaloneCosmicsCollector.h.
|
inlineprivate |
Function performing the actual line fit via a principal component analysis method yielding a direction vector based on the eigen vector corresponding to the largest eigenvalue and a seed position calculated as the mean of all given SpacePoints.
The function sets the member m_reducedChi2 which is calculated based on the distance of all given points to the fitted line. The final value is divided by the number of SPs in the track candidate, yielding a reduced chi2. If the provided SpacePoints are less than a given minimal length the fit will be aborted returning false. If enough SpacePoints are provided, the function returns true independent from the value of the calculated reduced chi2.
minSPs |
Definition at line 179 of file StandaloneCosmicsCollector.h.
|
inline |
Getter for the final reduced chi squared value obtained for the set of SpacePoints used for the last performed fit.
Definition at line 145 of file StandaloneCosmicsCollector.h.
|
inline |
Getter for the position and momentum seed resulting from the linear fit.
The momentum is rather only a vector giving the direction of the straight fit with a sufficiently large magnitude. The position seed is set to be the outermost SpacePoint with the direction seed pointing towards the next inner hit. If the fit does not meet the given requirements, the result of the last try for this event is returned. If the event does not have the required minimal number of SpacePoints, vectors with zeros are returned.
Definition at line 122 of file StandaloneCosmicsCollector.h.
|
inline |
Getter for the sorted list of SpacePoints used for the final fit which met the given requirements.
The SpacePoints are sorted, starting at the position seed and towards the direction obtained by the final fit. If the fit did not meet the requirements, the last set which was used for the current event is returned.
Definition at line 134 of file StandaloneCosmicsCollector.h.
|
inlineprivate |
Function to resort the member vector of SpacePoints m_spacePoints based on the members m_start and m_direction obtained by the fit, so that the track candidate starts form the outermost hit and the following hits are sorted following the direction m_direction.
This sorting is done using the comparison function comparePars.
Definition at line 297 of file StandaloneCosmicsCollector.h.
|
inline |
Set sorting mode used in addSpacePoints.
One can choose to sort 1: by radius 2: by x-coordinate 3: by y-coordinate by calling this function with the respective index. If the function is not used, the default set at the declaration of m_sortingMode is used.
Definition at line 51 of file StandaloneCosmicsCollector.h.
|
private |
Direction of the line obtained by the last performed line fit.
Definition at line 364 of file StandaloneCosmicsCollector.h.
|
private |
Pair containing the index of the vector m_spacePoints for the SpacePoint with the largest contribution to the chi2 value of the last fit and the respectiv contribution first: contribution to the total chi2 value of the last fit second: index of the SpacePoint with this largest contribution in the vector m_spacePoints.
Definition at line 358 of file StandaloneCosmicsCollector.h.
|
private |
Member variable containing the reduced chi squared value of the current line fit.
The value is obtained by dividing the actual chi2 value by the number of SPs in the track candidate. Is reset to 10 in addSpacePoints.
Definition at line 350 of file StandaloneCosmicsCollector.h.
|
private |
Storing identifier for sorting algorithm to be used for the function addSpacePoint.
1: by radius (default) 2: by x-value 3: by y-value
Definition at line 344 of file StandaloneCosmicsCollector.h.
|
private |
Member vector of SpacePoints holding the SpacePoints considered for the track candidate.
Definition at line 337 of file StandaloneCosmicsCollector.h.
|
private |
Start point obtained by the last performed line fit.
Definition at line 361 of file StandaloneCosmicsCollector.h.