File indexing completed on 2026-05-07 08:04:16
0001
0002
0003
0004 #pragma once
0005
0006 #include <ActsExamples/EventData/Track.hpp>
0007 #include <JANA/JEvent.h>
0008 #include <cassert>
0009 #include <edm4eic/Vertex.h>
0010 #include <edm4eic/TrackParameters.h>
0011 #include <memory>
0012 #include <string>
0013 #include <utility>
0014 #include <vector>
0015
0016 #include "algorithms/tracking/SecondaryVertexFinderConfig.h"
0017 #include "algorithms/tracking/SecondaryVertexFinder.h"
0018 #include "extensions/jana/JOmniFactory.h"
0019
0020 namespace eicrecon {
0021
0022 class SecondaryVertexFinder_factory
0023 : public JOmniFactory<SecondaryVertexFinder_factory, SecondaryVertexFinderConfig> {
0024
0025 private:
0026 using AlgoT = eicrecon::SecondaryVertexFinder;
0027 std::unique_ptr<AlgoT> m_algo;
0028
0029 PodioInput<edm4eic::ReconstructedParticle> m_reco_input{this};
0030 Input<Acts::ConstVectorMultiTrajectory> m_acts_track_states_input{this};
0031 Input<Acts::ConstVectorTrackContainer> m_acts_tracks_input{this};
0032 PodioOutput<edm4eic::Vertex> m_prm_vertices_output{this};
0033 PodioOutput<edm4eic::Vertex> m_sec_vertices_output{this};
0034
0035 ParameterRef<unsigned int> m_maxVertices{this, "maxVertices", config().maxVertices,
0036 "Maximum num vertices that can be found"};
0037 ParameterRef<bool> m_reassignTracksAfterFirstFit{
0038 this, "reassignTracksAfterFirstFit", config().reassignTracksAfterFirstFit,
0039 "Whether or not to reassign tracks after first fit"};
0040 ParameterRef<float> m_tracksMaxZinterval{this, "tracksMaxZinterval", config().tracksMaxZinterval,
0041 "Max z interval for Acts::AdaptiveMultiVertexFinder."};
0042 ParameterRef<unsigned int> m_maxIterations{this, "maxIterations", config().maxIterations,
0043 "Max iterations for Acts::AdaptiveMultivertexFinder"};
0044 ParameterRef<float> m_maxDistToLinPoint{
0045 this, "maxDistToLinPoint", config().maxDistToLinPoint,
0046 "Max disttance to line point (pca) for Acts::AdaptiveMultivertexFinder"};
0047
0048 Service<ACTSGeo_service> m_ACTSGeoSvc{this};
0049
0050 public:
0051 void Configure() {
0052 m_algo = std::make_unique<AlgoT>(this->GetPrefix());
0053 m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0054 m_algo->applyConfig(config());
0055 m_algo->init();
0056 }
0057
0058 void Process(int32_t, uint64_t) {
0059 auto track_states_vec = m_acts_track_states_input();
0060 auto tracks_vec = m_acts_tracks_input();
0061 assert(!track_states_vec.empty() && "ConstVectorMultiTrajectory vector should not be empty");
0062 assert(track_states_vec.front() != nullptr &&
0063 "ConstVectorMultiTrajectory pointer should not be null");
0064 assert(!tracks_vec.empty() && "ConstVectorTrackContainer vector should not be empty");
0065 assert(tracks_vec.front() != nullptr && "ConstVectorTrackContainer pointer should not be null");
0066
0067 m_algo->process(
0068 {
0069 m_reco_input(),
0070 track_states_vec.front(),
0071 tracks_vec.front(),
0072 },
0073 {
0074 m_prm_vertices_output().get(),
0075 m_sec_vertices_output().get(),
0076 });
0077 }
0078 };
0079
0080 }