Skip to content

Commit 14d161c

Browse files
authored
feat: add ActsTrajectoriesMerger (#1824)
### Briefly, what does this PR introduce? This PR pulls the ActsTrajectoriesMerger and non-owning JOmniFactory Output support out of #1744. ### What kind of change does this PR introduce? - [ ] Bug fix (issue #__) - [x] New feature (issue #1744) - [ ] Documentation update - [ ] Other: __ ### Please check if this PR fulfills the following: - [ ] Tests for the changes have been added - [ ] Documentation has been added / updated - [ ] Changes have been communicated to collaborators ### Does this PR introduce breaking changes? What changes might users need to make to their code? No. ### Does this PR change default behavior? No.
1 parent 734cd48 commit 14d161c

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

src/extensions/jana/JOmniFactory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class JOmniFactory : public JMultifactory {
171171
fac.SetData<T>(this->collection_names[0], this->m_data);
172172
}
173173

174-
void Reset() override {}
174+
void Reset() override { m_data.clear(); }
175175
};
176176

177177
template <typename PodioT> class PodioOutput : public OutputBase {
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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

Comments
 (0)