12#ifndef ALICEO2_ITSMFT_TRACKING_TEST_COMBINEDTRACKINGTESTSUPPORT_H_
13#define ALICEO2_ITSMFT_TRACKING_TEST_COMBINEDTRACKINGTESTSUPPORT_H_
38 std::array<SurfaceDescriptor, ITSNLayers + MFTNLayers> surfaces{};
51 std::vector<LayerId>
result;
53 for (uint16_t
i = 0;
i <
count; ++
i) {
62 const std::vector<uint16_t> componentOffsets = {0,
ITSNLayers};
63 const auto combine = [&] {
64 auto parameters = itsParams;
66 const auto concatenate = [](
auto&
output,
const auto& prefix,
const auto& suffix) {
68 output.insert(
output.end(), suffix.begin(), suffix.end());
74 const auto configuredSeedingLayers = [](
const auto& input) {
75 return input.SeedingLayers.empty() ? LayerMask::span(0, input.NLayers - 1) : input.SeedingLayers;
79 parameters.SeedingLayers = configuredSeedingLayers(itsParams).value() |
80 (configuredSeedingLayers(mftParams).value() << itsParams.
NLayers);
92 if (itsParams.size() != 1 || mftParams.size() != 1) {
93 throw std::invalid_argument{
"combined test application plan requires one iteration per detector"};
97 mTracker = std::make_unique<Tracker>();
98 mTraits = std::make_unique<TrackerTraits>();
107 if (!mTracker->initialize(frame, mConfiguration)) {
108 throw std::runtime_error{
"combined test application plan failed to configure the TimeFrame"};
117 mTraits->setNThreads(
n, mArena);
124 auto result = mTracker->run(*mFrame, *mTraits);
127 const auto& statistics = mTracker->getRunStatistics();
128 const auto configurations = mTracker->getIterationConfigurations();
129 std::size_t firstTrack = 0;
130 for (std::size_t
i = 0;
i < configurations.size(); ++
i) {
131 if (
i >= statistics.acceptedTrackCounts.size() ||
132 statistics.acceptedTrackCounts[
i] > mFrame->
getGenericTracks().size() - firstTrack) {
133 throw std::runtime_error{
"failed to prepare ITS shared-cluster flags"};
135 std::vector<uint32_t> selected;
136 for (std::size_t
index = 0;
index < statistics.acceptedTrackCounts[
i]; ++
index) {
137 const auto globalIndex = firstTrack +
index;
139 selected.push_back(
static_cast<uint32_t
>(globalIndex));
143 selected, configurations[
i].parameters, *mFrame,
i + 1 == configurations.size())) {
144 throw std::runtime_error{
"failed to prepare ITS shared-cluster flags"};
146 firstTrack += statistics.acceptedTrackCounts[
i];
149 mITSPublicationAdapter.
reset();
158 auto result = *mLastResult;
165 mITSPublicationAdapter.
reset();
173 throw std::runtime_error(
"Invalid ITS source");
176 throw std::runtime_error(
"Invalid MFT source");
183 auto configure = [](
auto& overlap,
auto&
vertex,
auto&
mask,
const auto& timing, uint32_t nROFs,
int layers) {
186 layerTiming.mROFLength = timing.mROFLength;
187 layerTiming.mROFDelay = timing.mROFDelay;
188 layerTiming.mROFBias = timing.mROFBias;
189 layerTiming.mROFAddTimeErr = timing.mROFAddTimeErr;
191 overlap.defineLayer(
layer, layerTiming);
196 mask = std::remove_cvref_t<
decltype(
mask)>{overlap};
199 mask.setROFsEnabled(
layer, 0,
static_cast<int>(nROFs), 1);
202 configure(mITSROFOverlapTable, mITSROFVertexLookupTable, mITSMultiplicityMask, itsSource.
timing,
static_cast<uint32_t
>(itsSource.
rofs.size()),
ITSNLayers);
203 configure(mMFTROFOverlapTable, mMFTROFVertexLookupTable, mMFTMultiplicityMask, mftSource.
timing,
static_cast<uint32_t
>(mftSource.
rofs.size()),
MFTNLayers);
216 const auto* configuration = mTracker ==
nullptr ? nullptr : mTracker->getIterationConfiguration(0);
217 return mFrame !=
nullptr && configuration !=
nullptr && mTracker->isConfiguredFor(*mFrame)
228 std::unique_ptr<Tracker> mTracker;
229 std::unique_ptr<TrackerTraits> mTraits;
230 std::optional<bool> mLastResult;
240 std::shared_ptr<tbb::task_arena> mArena;
Shared CA tracking configuration for ITS and MFT.
Passive common TimeFrame owner.
Shared cluster I/O utilities for ITS and MFT (based on ITStracking/IOUtils.h)
gsl::span< const uint8_t > sharedClusterFlags() const noexcept
bool completeAccepted(gsl::span< const uint32_t > trackIndices, const o2::itsmft::IterationParameters ¶ms, const o2::itsmft::tracking::TimeFrame &frame, bool final)
SurfaceCatalogView getSurfaceCatalog() const noexcept
TraversalTopologyView getITSLayoutView() const noexcept
RuntimeROFViews getITSROFViews() const noexcept
Tracker & mftTracker() noexcept
CombinedTrackingPlan(std::vector< TrackingParameters > itsParams, std::vector< TrackingParameters > mftParams)
Tracker & itsTracker() noexcept
CombinedTrackingPlan & operator=(const CombinedTrackingPlan &)=delete
TraversalTopologyView getMFTLayoutView() const noexcept
void clearPublicationSidecars() noexcept
void configureRofTables(const TestClusterSourceInput &itsSource, const TestClusterSourceInput &mftSource)
const TimeFrameScratch & getITSScratch() const noexcept
SurfaceCatalogView catalogView() const noexcept
gsl::span< const LayerId > getITSLayerMapping() const noexcept
gsl::span< const uint8_t > getITSSharedClusterFlags() const noexcept
void adoptFrame(TimeFrame &frame)
RuntimeROFViews getMFTROFViews() const noexcept
gsl::span< const LayerId > getMFTLayerMapping() const noexcept
void validateSources(const ClusterSourceInput &itsSource, const ClusterSourceInput &mftSource) const
CombinedTrackingPlan(const CombinedTrackingPlan &)=delete
const TimeFrameScratch & getMFTScratch() const noexcept
Shared CA tracker traits: same ITS-style tracklet/cell/road logic; MFT uses x-y LUT and forward refit...
GLenum GLuint GLint GLint layer
std::vector< LayerId > orderedSurfaceRange(uint16_t first, uint16_t count)
constexpr auto CombinedSurfaceCatalog
SurfaceCatalogView combinedCatalogView()
TrackingPlan makeTrackingPlan(const TrackingParameters ¶meters)
TrackerInitialization makeCombinedConfiguration(const TrackingParameters &itsParams, const TrackingParameters &mftParams)
uint32_t trackClusterIndicesSize noexcept
constexpr std::array< SurfaceDescriptor, MFTNLayers > kMFTSurfaces
constexpr int MFTNLayers
MFT CA half-disk layer count.
constexpr std::array< SurfaceDescriptor, ITSNLayers > kITSSurfaces
constexpr int ITSNLayers
ITS CA layer count.
std::vector< uint32_t > AddTimeError
std::vector< float > SystError2Col
std::vector< float > SystError2Row
std::vector< float > LayerResolution
tracking::LayerMask InactiveLayerMask
auto & getGenericTracks()
const DetectorConfiguration & getDetectorConfiguration() const noexcept
TimeFrameScratch & getScratch()