Skip to content

Commit

Permalink
continue
Browse files Browse the repository at this point in the history
  • Loading branch information
felix-russo committed Oct 9, 2023
1 parent 173bbfc commit 1bbe544
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 23 deletions.
4 changes: 2 additions & 2 deletions Core/include/Acts/Vertexing/AMVFInfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct VertexInfo {
VertexInfo(const Acts::Vertex<input_track_t>& vtx, const Acts::Vector4& pos)
: constraintVertex(vtx),
linPoint(pos),
oldPosition(pos),
position(pos),
seedPosition(pos) {}

// The constraint vertex
Expand All @@ -34,7 +34,7 @@ struct VertexInfo {
Acts::Vector4 linPoint{Acts::Vector4::Zero()};

// Old position from last iteration
Acts::Vector4 oldPosition{Acts::Vector4::Zero()};
Acts::Vector4 position{Acts::Vector4::Zero()};

// The seed position
Acts::Vector4 seedPosition{Acts::Vector4::Zero()};
Expand Down
31 changes: 13 additions & 18 deletions Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,18 @@ Acts::AdaptiveMultiVertexFitter<input_track_t, linearizer_t>::fitImpl(
// Store old position of vertex, i.e. seed position
// in case of first iteration or position determined
// in previous iteration afterwards
currentVtxInfo.oldPosition = currentVtx->fullPosition();
currentVtxInfo.position = currentVtx->fullPosition();

Vector4 dist = currentVtxInfo.oldPosition - currentVtxInfo.linPoint;
Vector4 dist = currentVtxInfo.position - currentVtxInfo.linPoint;
double perpDist = std::hypot(dist[0], dist[1]);
// Determine if relinearization is needed
if (perpDist > m_cfg.maxDistToLinPoint) {
// Relinearization needed, distance too big
currentVtxInfo.relinearize = true;
// Prepare for fit with new vertex position
prepareVertexForFit(state, currentVtx, vertexingOptions);
}
// Set the 3D impact parameters of all tracks
prepareVertexForFit(state, currentVtx, vertexingOptions);

// Determine if constraint vertex exist
if (state.vtxInfoMap[currentVtx].constraintVertex.fullCovariance() !=
SquareMatrix4::Zero()) {
Expand Down Expand Up @@ -122,12 +123,6 @@ Acts::AdaptiveMultiVertexFitter<input_track_t, linearizer_t>::addVtxToFit(

std::vector<Vertex<input_track_t>*> verticesToFit;

// Prepares vtx and tracks for fast estimation method of their
// compatibility with vertex
auto res = prepareVertexForFit(state, &newVertex, vertexingOptions);
if (!res.ok()) {
return res.error();
}
// List of vertices added in last iteration
std::vector<Vertex<input_track_t>*> lastIterAddedVertices = {&newVertex};
// List of vertices added in current iteration
Expand Down Expand Up @@ -194,14 +189,14 @@ Acts::Result<void> Acts::
const VertexingOptions<input_track_t>& vertexingOptions) const {
// The current vertex info object
auto& currentVtxInfo = state.vtxInfoMap[vtx];
// The seed position
const Vector3& seedPos = currentVtxInfo.seedPosition.template head<3>();
// Vertex position, i.e., point wrt which the impact parameters are estimated
const Vector3& vtxPosition = currentVtxInfo.position.template head<3>();

// Loop over all tracks at current vertex
for (const auto& trk : currentVtxInfo.trackLinks) {
auto res = m_cfg.ipEst.estimate3DImpactParameters(
vertexingOptions.geoContext, vertexingOptions.magFieldContext,
m_extractParameters(*trk), seedPos, state.ipState);
m_extractParameters(*trk), vtxPosition, state.ipState);
if (!res.ok()) {
return res.error();
}
Expand Down Expand Up @@ -241,7 +236,7 @@ Acts::AdaptiveMultiVertexFitter<input_track_t, linearizer_t>::
// Set compatibility with current vertex
auto compRes = m_cfg.ipEst.template getVertexCompatibility<3>(
vertexingOptions.geoContext, &(currentVtxInfo.ip3dParams.at(trk)),
VectorHelpers::position(currentVtxInfo.oldPosition));
VectorHelpers::position(currentVtxInfo.position));
if (!compRes.ok()) {
return compRes.error();
}
Expand All @@ -260,7 +255,7 @@ Acts::Result<void> Acts::

const std::shared_ptr<PerigeeSurface> vtxPerigeeSurface =
Surface::makeShared<PerigeeSurface>(
VectorHelpers::position(state.vtxInfoMap[vtx].oldPosition));
VectorHelpers::position(state.vtxInfoMap[vtx].position));

for (const auto& trk : currentVtxInfo.trackLinks) {
auto& trkAtVtx = state.tracksAtVerticesMap.at(std::make_pair(trk, vtx));
Expand All @@ -275,15 +270,15 @@ Acts::Result<void> Acts::
// Check if linearization state exists or need to be relinearized
if (not trkAtVtx.isLinearized || state.vtxInfoMap[vtx].relinearize) {
auto result = linearizer.linearizeTrack(
m_extractParameters(*trk), state.vtxInfoMap[vtx].oldPosition[3],
m_extractParameters(*trk), state.vtxInfoMap[vtx].position[3],
*vtxPerigeeSurface, vertexingOptions.geoContext,
vertexingOptions.magFieldContext, state.linearizerState);
if (!result.ok()) {
return result.error();
}

if (trkAtVtx.isLinearized) {
state.vtxInfoMap[vtx].linPoint = state.vtxInfoMap[vtx].oldPosition;
state.vtxInfoMap[vtx].linPoint = state.vtxInfoMap[vtx].position;
}

trkAtVtx.linearizedState = *result;
Expand Down Expand Up @@ -324,7 +319,7 @@ template <typename input_track_t, typename linearizer_t>
bool Acts::AdaptiveMultiVertexFitter<
input_track_t, linearizer_t>::checkSmallShift(State& state) const {
for (auto vtx : state.vertexCollection) {
Vector3 diff = state.vtxInfoMap[vtx].oldPosition.template head<3>() -
Vector3 diff = state.vtxInfoMap[vtx].position.template head<3>() -
vtx->fullPosition().template head<3>();
SquareMatrix3 vtxWgt =
(vtx->fullCovariance().template block<3, 3>(0, 0)).inverse();
Expand Down
3 changes: 2 additions & 1 deletion Core/include/Acts/Vertexing/ImpactPointEstimator.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ Acts::ImpactPointEstimator<input_track_t, propagator_t, propagator_options_t>::
}

// x-, y-, and possibly time-coordinate of the vertex and the track in the
// surface coordinate system
// surface coordinate system. Since the vertex is at the surface origin, its
// spatial coordinates are 0.
ActsVector<nDim - 1> localVertexCoords;
localVertexCoords.template head<2>() = Vector2(0., 0.);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_fitter_test_athena) {
vtxInfo1.linPoint.setZero();
vtxInfo1.linPoint.head<3>() = vtxPos1;
vtxInfo1.constraintVertex = vtx1Constr;
vtxInfo1.oldPosition = vtxInfo1.linPoint;
vtxInfo1.position = vtxInfo1.linPoint;
vtxInfo1.seedPosition = vtxInfo1.linPoint;

for (const auto& trk : params1) {
Expand All @@ -517,7 +517,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_fitter_test_athena) {
vtxInfo2.linPoint.setZero();
vtxInfo2.linPoint.head<3>() = vtxPos2;
vtxInfo2.constraintVertex = vtx2Constr;
vtxInfo2.oldPosition = vtxInfo2.linPoint;
vtxInfo2.position = vtxInfo2.linPoint;
vtxInfo2.seedPosition = vtxInfo2.linPoint;

for (const auto& trk : params2) {
Expand Down

0 comments on commit 1bbe544

Please sign in to comment.