Select Git revision
CiDescription.md
Forked from
Computing / cbmroot
Source project has a limited visibility.
TrackingChain.h 3.89 KiB
/* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Sergei Zharko [committer] */
/// \file TrackingChain.h
/// \date 13.09.2023
/// \brief A chain class to execute CA tracking algorithm in online reconstruction (header)
/// \author S.Zharko <s.zharko@gsi.de>
#pragma once
#include "CaDataManager.h"
#include "CaFramework.h"
#include "CaInputQa.h"
#include "CaOutputQa.h"
#include "CaTrack.h"
#include "CaTrackingMonitor.h"
#include "CaVector.h"
#include "HistogramSender.h"
#include "PartitionedSpan.h"
#include "RecoResults.h"
#include "SubChain.h"
#include "TrackingDefs.h"
#include "sts/Hit.h"
#include "tof/Hit.h"
#include <memory>
#include <vector>
namespace cbm::algo
{
/// \class cbm::algo::TrackingChain
/// \brief A chain for tracking algorithm
///
/// The class executes a tracking algorithm in the online data reconstruction chain.
class TrackingChain : public SubChain {
public:
/// \brief Constructor from parameters
/// \param histoSender A shared pointer to a histogram sender
TrackingChain(std::shared_ptr<HistogramSender> histoSender = nullptr);
/// \struct Input_t
/// \brief Input to the TrackingChain
struct Input_t {
PartitionedSpan<sts::Hit> stsHits;
PartitionedSpan<tof::Hit> tofHits;
};
/// \struct Output_t
/// \brief Output from the TrackingChain
struct Output_t {
/// \brief Reconstructed tracks
ca::Vector<ca::Track> tracks;
/// \brief STS hit indices
/// \note Indexing: [trackID][localHit], value: (partitionID, hitIDinPartition)
ca::Vector<std::vector<std::pair<uint32_t, uint32_t>>> stsHitIndices;
/// \brief TOF hit indices
/// \note Indexing: [trackID][localHit], value: (partitionID, hitIDinPartition)
ca::Vector<std::vector<std::pair<uint32_t, uint32_t>>> tofHitIndices;
/// \brief Monitor data
ca::TrackingMonitorData monitorData;
};
/// \brief Gets internal monitor
const ca::TrackingMonitor& GetCaMonitor() const { return fCaMonitor; }
/// \brief Provides action in the initialization of the run void Init();
/// \brief Provides action for a given time-slice
/// \param recoResults Structure of reconstruction results
/// \return A pair (vector of tracks, tracking monitor)
Output_t Run(Input_t recoResults);
/// \brief Provides action in the end of the run
void Finalize();
private:
// *********************
// ** Utility functions
/// \brief Prepares input data
/// \param recoResults Structure of reconstruction results
void PrepareInput(Input_t recoResults);
/// \brief Prepares output data
Output_t PrepareOutput();
/// \brief Reads from different detector subsystems
/// \tparam DetID Detector ID
/// \param hits Hits vector
template<ca::EDetectorID DetID>
void ReadHits(PartitionedSpan<const ca::HitTypes_t::at<DetID>> hits);
// *************************
// ** Framework variables
ca::TrackingMonitor fCaMonitor{}; ///< CA internal monitor (debug purposes)
ca::TrackingMonitorData fCaMonitorData{}; ///< CA monitor data object
ca::Framework fCaFramework{}; ///< CA framework instance
ca::DataManager fCaDataManager{}; ///< CA data manager
ca::InputQa fInputQa; ///< CA input QA builder
ca::OutputQa fOutputQa; ///< CA output QA builder
// ************************
// ** Auxilary variables
ca::HitKeyIndex_t fNofHitKeys = 0; ///< Current number of hit keys (aux)
/// \brief External indices of used hits
/// \note Indexing: [globalHitID], value: (DetID, partitionID, hitID)
ca::Vector<std::tuple<ca::EDetectorID, uint32_t, uint32_t>> faHitExternalIndices{"faHitExternalIndices"};
static constexpr bool kDEBUG = false; ///< Debug mode
};
} // namespace cbm::algo