|
10 | 10 | // or submit itself to any jurisdiction. |
11 | 11 | /// |
12 | 12 | /// \file TimeFrame.h |
13 | | -/// \brief TRK TimeFrame class derived from ITS TimeFrame |
| 13 | +/// \brief CPU TRK TimeFrame wrapper. |
14 | 14 | /// |
15 | 15 |
|
16 | 16 | #ifndef ALICEO2_ALICE3GLOBALRECONSTRUCTION_TIMEFRAME_H |
17 | 17 | #define ALICEO2_ALICE3GLOBALRECONSTRUCTION_TIMEFRAME_H |
18 | 18 |
|
19 | | -#include "CommonDataFormat/InteractionRecord.h" |
| 19 | +#include "ALICE3GlobalReconstruction/TimeFrameMixin.h" |
20 | 20 | #include "ITStracking/TimeFrame.h" |
21 | | -#include "ITStracking/Constants.h" |
22 | | -#include "ITStracking/Configuration.h" |
23 | | -#include "SimulationDataFormat/MCCompLabel.h" |
24 | | -#include "SimulationDataFormat/MCTruthContainer.h" |
25 | | -#include "DataFormatsTRK/Cluster.h" |
26 | | -#include "DataFormatsTRK/ROFRecord.h" |
27 | | -#include <array> |
28 | | -#include <gsl/span> |
29 | | -#include <vector> |
30 | | -#include <unordered_map> |
31 | | -#include <bitset> |
32 | | -#include <cstdint> |
33 | 21 |
|
34 | | -#include <nlohmann/json.hpp> |
35 | | - |
36 | | -class TTree; |
37 | | - |
38 | | -namespace o2 |
39 | | -{ |
40 | | -namespace trk |
| 22 | +namespace o2::trk |
41 | 23 | { |
42 | | -class GeometryTGeo; |
43 | 24 |
|
44 | | -/// TRK TimeFrame class that extends ITS TimeFrame functionality |
45 | | -/// This allows for customization of tracking algorithms specific to the TRK detector |
46 | 25 | template <int nLayers = 11> |
47 | | -class TimeFrame : public o2::its::TimeFrame<nLayers> |
| 26 | +class TimeFrame : public TimeFrameMixin<nLayers, o2::its::TimeFrame<nLayers>> |
48 | 27 | { |
49 | 28 | public: |
50 | 29 | TimeFrame() = default; |
51 | 30 | ~TimeFrame() override = default; |
52 | | - |
53 | | - /// Override methods if needed for TRK-specific behavior |
54 | | - /// For now, we inherit all functionality from ITS TimeFrame |
55 | | - |
56 | | - /// Process hits from TTree to initialize ROFs |
57 | | - /// \param hitsTree Tree containing TRK hits |
58 | | - /// \param mcHeaderTree Tree containing MC event headers |
59 | | - /// \param nEvents Number of events to process |
60 | | - /// \param gman TRK geometry manager instance |
61 | | - /// \param config Configuration parameters for hit reconstruction |
62 | | - int loadROFsFromHitTree(TTree* hitsTree, GeometryTGeo* gman, const nlohmann::json& config); |
63 | | - |
64 | | - /// Load ROF data from TRK clustered inputs (without topology dictionary for the time being). |
65 | | - /// Patterns are expected as [rowSpan, colSpan, bitmap...] for each cluster. |
66 | | - int loadROFrameData(gsl::span<const o2::trk::ROFRecord> rofs, |
67 | | - gsl::span<const o2::trk::Cluster> clusters, |
68 | | - gsl::span<const unsigned char> patterns, |
69 | | - const dataformats::MCTruthContainer<MCCompLabel>* mcLabels = nullptr, |
70 | | - float yPlaneMLOT = 0.f); |
71 | | - |
72 | | - /// Add primary vertices from MC headers for each ROF |
73 | | - /// \param mcHeaderTree Tree containing MC event headers |
74 | | - /// \param nRofs Number of ROFs (Read-Out Frames) |
75 | | - /// \param nEvents Number of events to process |
76 | | - /// \param inROFpileup Number of events per ROF |
77 | | - void getPrimaryVerticesFromMC(TTree* mcHeaderTree, int nRofs, Long64_t nEvents, int inROFpileup); |
78 | | - |
79 | | - /// Add primary vertices using truth seeding from the DigitizationContext (collisioncontext.root). |
80 | | - /// Maps each MC collision to its ROF via the ROF BCData timestamps (TRK digitising timing). |
81 | | - /// \param rofs Span of TRK ROF records used to determine which ROF each collision falls into |
82 | | - void addTruthSeedingVertices(gsl::span<const o2::trk::ROFRecord> rofs); |
83 | | - |
84 | | - /// Derive the per-layer LayerTiming from the per-layer ROF spans and initialise |
85 | | - /// the ROF lookup tables. Each layer can have its own mROFLength and mROFBias, |
86 | | - /// so staggered TRK readouts are handled naturally as long as the input |
87 | | - /// ROFRecords carry the right BCData. The TF anchor (used to keep timing |
88 | | - /// values bounded when expressed as BC offsets) is set to the earliest |
89 | | - /// rofs[0].BCData across layers; consumers can read it back via getTFAnchorIR(). |
90 | | - /// Idempotent — must be called before loadROFrameData() in the cluster path. |
91 | | - /// \param layerROFs One ROFRecord span per layer. |
92 | | - void deriveAndInitTiming(const std::array<gsl::span<const o2::trk::ROFRecord>, nLayers>& layerROFs); |
93 | | - |
94 | | - /// TF anchor IR: the earliest first-ROF BCData seen across all layers when |
95 | | - /// deriveAndInitTiming() was called. All LayerTiming BC values (and any BC |
96 | | - /// the tracker emits via clockLayer.getROFStartInBC) are offsets from this |
97 | | - /// anchor — add anchor.toLong() to convert back to absolute BC. |
98 | | - const o2::InteractionRecord& getTFAnchorIR() const noexcept { return mTFAnchorIR; } |
99 | | - |
100 | | - private: |
101 | | - /// One-shot setup of the per-layer LayerTiming and the three ROF lookup tables |
102 | | - /// (overlap, vertex lookup, multiplicity mask). Idempotent: subsequent calls are |
103 | | - /// no-ops, so the data-loading entry points may invoke it on every TF without |
104 | | - /// rebuilding the tables. Mirrors the initOnceDone gate in |
105 | | - /// ITSTrackingInterface::updateTimeDependentParams. |
106 | | - void initTimingTables(const std::array<o2::its::LayerTiming, nLayers>& timings); |
107 | | - |
108 | | - bool mTimingTablesInitialised{false}; |
109 | | - o2::InteractionRecord mTFAnchorIR{0, 0}; |
110 | 31 | }; |
111 | 32 |
|
112 | | -} // namespace trk |
113 | | -} // namespace o2 |
| 33 | +} // namespace o2::trk |
114 | 34 |
|
115 | 35 | #endif // ALICEO2_ALICE3GLOBALRECONSTRUCTION_TIMEFRAME_H |
0 commit comments