Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IterativeVertexFinder: fill vertex-to-particle relation #1576

Merged
merged 22 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1e8ad97
- input chosen to use SeededTrajectories
Aug 16, 2024
b59ff9b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 16, 2024
97fd9b4
IterativeVertexFinder: consistent output format, output in loops is t…
veprbl Aug 16, 2024
dea0db6
IWYU
veprbl Aug 16, 2024
ab22fa7
Update src/algorithms/tracking/IterativeVertexFinder.cc
starsdong Aug 22, 2024
ac99f73
Update src/algorithms/tracking/IterativeVertexFinder.cc
starsdong Aug 22, 2024
29f3f1f
Update src/algorithms/tracking/IterativeVertexFinder.cc
starsdong Aug 22, 2024
c79ecc2
Update src/algorithms/tracking/IterativeVertexFinder.cc
starsdong Aug 22, 2024
c892608
Update src/algorithms/tracking/IterativeVertexFinder.cc
starsdong Aug 22, 2024
b3d13ed
Update src/global/tracking/IterativeVertexFinder_factory.h
starsdong Aug 22, 2024
6c63bd3
Update src/algorithms/tracking/IterativeVertexFinder.cc
starsdong Aug 22, 2024
e757c61
Update IterativeVertexFinder.cc
starsdong Aug 22, 2024
40fbba7
choose PodioInput for ReconstructedParticle input
Aug 22, 2024
16abb1f
Update src/global/tracking/tracking.cc
starsdong Aug 22, 2024
a9bce75
Merge branch 'main' into pr/ivf_assoc
starsdong Aug 22, 2024
e33115a
Update IterativeVertexFinder.cc
starsdong Aug 22, 2024
b77b249
Merge branch 'main' into pr/ivf_assoc
starsdong Aug 22, 2024
5d5dbaf
linux-eic-shell.yml: continue-on-error for graphviz rendering
veprbl Aug 22, 2024
7b6590e
Merge branch 'main' into pr/ivf_assoc
starsdong Aug 23, 2024
b71eae7
IWYU
veprbl Aug 23, 2024
1a0c37e
Merge branch 'main' into pr/ivf_assoc
veprbl Aug 26, 2024
cdeaf5b
add EPSILON definition
veprbl Aug 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 45 additions & 3 deletions src/algorithms/tracking/IterativeVertexFinder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
#include <Acts/EventData/TrackParameters.hpp>
#include <Acts/Propagator/EigenStepper.hpp>
#include <Acts/Propagator/Propagator.hpp>
#include <ActsExamples/EventData/Track.hpp>
#include <boost/move/utility_core.hpp>
#include <edm4eic/Track.h>
#include <fmt/core.h>
#include <podio/RelationRange.h>
#if Acts_VERSION_MAJOR >= 32
#include <Acts/Propagator/VoidNavigator.hpp>
#else
Expand All @@ -26,16 +30,20 @@
#include <Acts/Vertexing/HelicalTrackLinearizer.hpp>
#include <Acts/Vertexing/ImpactPointEstimator.hpp>
#include <Acts/Vertexing/IterativeVertexFinder.hpp>
#include <Acts/Vertexing/TrackAtVertex.hpp>
#include <Acts/Vertexing/Vertex.hpp>
#include <Acts/Vertexing/VertexingOptions.hpp>
#include <Acts/Vertexing/ZScanVertexFinder.hpp>
#include <ActsExamples/EventData/Trajectories.hpp>
#include <boost/container/vector.hpp>
#include <edm4eic/Cov4f.h>
#include <math.h>
#include <edm4eic/TrackParameters.h>
#include <edm4eic/Trajectory.h>
starsdong marked this conversation as resolved.
Show resolved Hide resolved
#include <edm4hep/Vector2f.h>
#include <Eigen/Core>
#include <Eigen/Geometry>
#include <Eigen/LU>
#include <cmath>
#include <algorithm>
#include <optional>
#include <tuple>
Expand All @@ -56,7 +64,8 @@ void eicrecon::IterativeVertexFinder::init(std::shared_ptr<const ActsGeometryPro
}

std::unique_ptr<edm4eic::VertexCollection> eicrecon::IterativeVertexFinder::produce(
std::vector<const ActsExamples::Trajectories*> trajectories) {
std::vector<const ActsExamples::Trajectories*> trajectories,
std::vector<const edm4eic::ReconstructedParticle*> reconParticles) {
starsdong marked this conversation as resolved.
Show resolved Hide resolved

auto outputVertices = std::make_unique<edm4eic::VertexCollection>();

Expand Down Expand Up @@ -172,11 +181,15 @@ std::unique_ptr<edm4eic::VertexCollection> eicrecon::IterativeVertexFinder::prod
}
/// CKF can provide multiple track trajectories for a single input seed
for (auto& tip : tips) {
ActsExamples::TrackParameters par = trajectory->trackParameters(tip);

#if Acts_VERSION_MAJOR >= 33
inputTracks.emplace_back(&(trajectory->trackParameters(tip)));
#else
inputTrackPointers.push_back(&(trajectory->trackParameters(tip)));
#endif
m_log->trace("Track local position at input = {}, {}", par.localPosition().x(), par.localPosition().y());

starsdong marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down Expand Up @@ -207,7 +220,36 @@ std::unique_ptr<edm4eic::VertexCollection> eicrecon::IterativeVertexFinder::prod
(float)vtx.time(),
}); // vtxposition
eicvertex.setPositionError(cov); // covariance
}

for (const auto& t : vtx.tracks()) {
#if Acts_VERSION_MAJOR >= 33
const auto& trk = &t.originalParams;
const auto& par = finderCfg.extractParameters(trk);
wdconinc marked this conversation as resolved.
Show resolved Hide resolved
#else
const auto& par = *t.originalParams;
#endif
m_log->trace("Track local position from vertex = {}, {}", par.localPosition().x(), par.localPosition().y());
starsdong marked this conversation as resolved.
Show resolved Hide resolved
float loc_a = par.localPosition().x();
float loc_b = par.localPosition().y();

for (const auto part : reconParticles) {
const auto& tracks = part->getTracks();
for (const auto trk : tracks) {
const auto& traj = trk.getTrajectory();
const auto& trkPars = traj.getTrackParameters();
for (const auto par : trkPars) {
if(fabs(par.getLoc().a - loc_a) < 1.e-4 && fabs(par.getLoc().b - loc_b) < 1.e-4) {
starsdong marked this conversation as resolved.
Show resolved Hide resolved
m_log->trace("From ReconParticles, track local position = {}, {}", par.getLoc().a, par.getLoc().b);
starsdong marked this conversation as resolved.
Show resolved Hide resolved
eicvertex.addToAssociatedParticles(*part);
} // endif
} // end for par
} // end for trk
} // end for part
} // end for t
m_log->debug("One vertex found at (x,y,z) = ({}, {}, {}) mm.", vtx.position().x(), vtx.position().y(), vtx.position().z());
starsdong marked this conversation as resolved.
Show resolved Hide resolved

} // end for vtx


return std::move(outputVertices);
}
3 changes: 2 additions & 1 deletion src/algorithms/tracking/IterativeVertexFinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <Acts/Geometry/GeometryContext.hpp>
#include <Acts/MagneticField/MagneticFieldContext.hpp>
#include <edm4eic/VertexCollection.h>
#include <edm4eic/ReconstructedParticle.h>
#include <spdlog/logger.h>
#include <memory>
#include <vector>
Expand All @@ -24,7 +25,7 @@ class IterativeVertexFinder
void init(std::shared_ptr<const ActsGeometryProvider> geo_svc,
std::shared_ptr<spdlog::logger> log);
std::unique_ptr<edm4eic::VertexCollection>
produce(std::vector<const ActsExamples::Trajectories*> trajectories);
produce(std::vector<const ActsExamples::Trajectories*> trajectories, std::vector<const edm4eic::ReconstructedParticle*> reconParticles);

private:
std::shared_ptr<spdlog::logger> m_log;
Expand Down
4 changes: 3 additions & 1 deletion src/global/tracking/IterativeVertexFinder_factory.h
starsdong marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <ActsExamples/EventData/Trajectories.hpp>
#include <JANA/JEvent.h>
#include <edm4eic/VertexCollection.h>
#include <edm4eic/ReconstructedParticle.h>
#include <memory>
#include <string>
#include <utility>
Expand All @@ -26,6 +27,7 @@ class IterativeVertexFinder_factory :
std::unique_ptr<AlgoT> m_algo;

Input<ActsExamples::Trajectories> m_acts_trajectories_input {this};
Input<edm4eic::ReconstructedParticle> m_edm4eic_reconParticles_input {this, "ReconstructedParticles"};
starsdong marked this conversation as resolved.
Show resolved Hide resolved
PodioOutput<edm4eic::Vertex> m_vertices_output {this};

ParameterRef<int> m_maxVertices {this, "maxVertices", config().maxVertices,
Expand All @@ -47,7 +49,7 @@ class IterativeVertexFinder_factory :
}

void Process(int64_t run_number, uint64_t event_number) {
m_vertices_output() = m_algo->produce(m_acts_trajectories_input());
m_vertices_output() = m_algo->produce(m_acts_trajectories_input(), m_edm4eic_reconParticles_input());
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/global/tracking/tracking.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ void InitPlugin(JApplication *app) {

app->Add(new JOmniFactoryGeneratorT<IterativeVertexFinder_factory>(
"CentralTrackVertices",
{"CentralCKFActsTrajectories"},
{"CentralCKFSeededActsTrajectories","ReconstructedSeededChargedParticles"},
starsdong marked this conversation as resolved.
Show resolved Hide resolved
{"CentralTrackVertices"},
{},
app
Expand Down
Loading