|
| 1 | +// SPDX-License-Identifier: LGPL-3.0-or-later |
| 2 | +// Copyright (C) 2025 Wouter Deconinck |
| 3 | + |
| 4 | +#pragma once |
| 5 | + |
| 6 | +#include <ActsExamples/EventData/Trajectories.hpp> |
| 7 | +#include <JANA/JEvent.h> |
| 8 | +#include <memory> |
| 9 | +#include <string> |
| 10 | +#include <utility> |
| 11 | +#include <vector> |
| 12 | + |
| 13 | +#include "extensions/jana/JOmniFactory.h" |
| 14 | + |
| 15 | +namespace eicrecon { |
| 16 | + |
| 17 | +class ActsTrajectoriesMerger_factory : public JOmniFactory<ActsTrajectoriesMerger_factory> { |
| 18 | +private: |
| 19 | + Input<ActsExamples::Trajectories> m_acts_trajectories1_input{this}; |
| 20 | + Input<ActsExamples::Trajectories> m_acts_trajectories2_input{this}; |
| 21 | + Output<ActsExamples::Trajectories> m_acts_trajectories_output{this}; |
| 22 | + |
| 23 | +public: |
| 24 | + void Configure() {} |
| 25 | + |
| 26 | + void ChangeRun(int32_t /* run_number */) {} |
| 27 | + |
| 28 | + void Process(int32_t /* run_number */, uint64_t /* event_number */) { |
| 29 | + for (const auto& traj : m_acts_trajectories1_input()) { |
| 30 | + ActsExamples::Trajectories::IndexedParameters trackParameters; |
| 31 | + for (auto tip : traj->tips()) { |
| 32 | + trackParameters.insert({tip, traj->trackParameters(tip)}); |
| 33 | + } |
| 34 | + m_acts_trajectories_output().push_back( |
| 35 | + new ActsExamples::Trajectories(traj->multiTrajectory(), traj->tips(), trackParameters)); |
| 36 | + } |
| 37 | + for (const auto& traj : m_acts_trajectories2_input()) { |
| 38 | + ActsExamples::Trajectories::IndexedParameters trackParameters; |
| 39 | + for (auto tip : traj->tips()) { |
| 40 | + trackParameters.insert({tip, traj->trackParameters(tip)}); |
| 41 | + } |
| 42 | + m_acts_trajectories_output().push_back( |
| 43 | + new ActsExamples::Trajectories(traj->multiTrajectory(), traj->tips(), trackParameters)); |
| 44 | + } |
| 45 | + } |
| 46 | +}; |
| 47 | + |
| 48 | +} // namespace eicrecon |
0 commit comments