9 template <
int mainGr
idSize,
int trkGr
idSize,
typename vfitter_t>
11 const std::vector<const InputTrack_t*>& trackVector,
15 if (m_cfg.cacheGridStateForTrackRemoval && state.isInitialized &&
16 !state.tracksToRemove.empty()) {
18 bool couldRemoveTracks =
false;
19 for (
auto trk : state.tracksToRemove) {
20 if (not state.trackSelectionMap.at(trk)) {
24 couldRemoveTracks =
true;
25 auto binAndTrackGrid = state.binAndTrackGridMap.at(trk);
26 m_cfg.gridDensity.removeTrackGridFromMainGrid(
27 binAndTrackGrid.first, binAndTrackGrid.second, state.mainGrid);
29 if (not couldRemoveTracks) {
33 std::vector<Vertex<InputTrack_t>> seedVec{
34 vertexingOptions.vertexConstraint};
40 for (
auto trk : trackVector) {
43 if (not doesPassTrackSelection(trkParams)) {
44 if (m_cfg.cacheGridStateForTrackRemoval) {
45 state.trackSelectionMap[trk] =
false;
49 auto binAndTrackGrid =
50 m_cfg.gridDensity.addTrack(trkParams, state.mainGrid);
52 if (m_cfg.cacheGridStateForTrackRemoval) {
53 state.binAndTrackGridMap[trk] = binAndTrackGrid;
54 state.trackSelectionMap[trk] =
true;
57 state.isInitialized =
true;
63 if (not m_cfg.estimateSeedWidth) {
65 auto maxZres = m_cfg.gridDensity.getMaxZPosition(state.mainGrid);
68 return maxZres.error();
73 auto maxZres = m_cfg.gridDensity.getMaxZPositionAndWidth(state.mainGrid);
76 return maxZres.error();
79 width = (*maxZres).second;
85 vertexingOptions.vertexConstraint.position() +
Vector3D(0., 0., z);
94 seedCov(2, 2) = width *
width;
99 std::vector<Vertex<InputTrack_t>> seedVec{returnVertex};
104 template <
int mainGr
idSize,
int trkGr
idSize,
typename vfitter_t>
111 const auto perigeeCov = *(trk.covariance());
118 const double covDeterminant = covDD * covZZ - covDZ * covDZ;
121 if ((covDD <= 0) || (d0 * d0 / covDD > m_cfg.d0SignificanceCut) ||
122 (covZZ <= 0) || (covDeterminant <= 0)) {
127 double constantTerm =
128 -(d0 * d0 * covZZ + z0 * z0 * covDD + 2. * d0 * z0 * covDZ) /
129 (2. * covDeterminant);
130 const double linearTerm = (d0 * covDZ + z0 * covDD) / covDeterminant;
131 const double quadraticTerm = -covDD / (2. * covDeterminant);
132 double discriminant =
133 linearTerm * linearTerm -
134 4. * quadraticTerm * (constantTerm + 2. * m_cfg.z0SignificanceCut);
135 if (discriminant < 0) {