13#ifndef TRACKINGITSU_INCLUDE_TIMEFRAME_H_
14#define TRACKINGITSU_INCLUDE_TIMEFRAME_H_
53class TopologyDictionary;
92 gsl::span<const itsmft::CompClusterExt>
clusters,
93 gsl::span<const unsigned char>::iterator& pattIt,
107 void setBeamPosition(
const float x,
const float y,
const float s2,
const float base = 50.f,
const float systematic = 0.f)
110 resetBeamXY(
x,
y, s2 / o2::gpu::CAMath::Sqrt((base * base) + systematic));
190 void initTrackerTopologies(gsl::span<const TrackingParameters> trkParams,
const int maxLayers = NLayers);
225 void setMemoryPool(std::shared_ptr<BoundedMemoryResource> pool);
271 template <
typename... T>
273 template <
typename... T>
281 std::array<const dataformats::MCTruthContainer<MCCompLabel>*, NLayers>
mClusterLabels{
nullptr};
291 std::vector<bounded_vector<CellSeed>>
mCells;
305 virtual bool isGPU() const noexcept {
return false; }
306 virtual const char*
getName() const noexcept {
return "CPU"; }
334 std::vector<bounded_vector<Line>>
mLines;
362template <
int NLayers>
365 if (rofId < 0 || rofId >= getNrof(
layer)) {
368 const auto&
entry = mROFVertexLookupTableView.getVertices(
layer, rofId);
369 return {&mPrimaryVertices[
entry.getFirstEntry()],
static_cast<gsl::span<const Vertex>::size_type
>(
entry.getEntries())};
372template <
int NLayers>
380template <
int NLayers>
383 return {&mROFramesClusters[layerId][0],
static_cast<gsl::span<const int>::size_type
>(mROFramesClusters[layerId].size())};
386template <
int NLayers>
389 if (rofId < 0 || rofId >= getNrof(layerId)) {
392 int startIdx{mROFramesClusters[layerId][rofId]};
393 return {&mClusters[layerId][startIdx],
static_cast<gsl::span<Cluster>::size_type
>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
396template <
int NLayers>
399 if (rofId < 0 || rofId >= getNrof(layerId)) {
402 int startIdx{mROFramesClusters[layerId][rofId]};
403 return {&mClusters[layerId][startIdx],
static_cast<gsl::span<const Cluster>::size_type
>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
406template <
int NLayers>
409 if (rofId < 0 || rofId >= getNrof(layerId)) {
412 int startIdx{mROFramesClusters[layerId][rofId]};
413 return {&mUsedClusters[layerId][startIdx],
static_cast<gsl::span<uint8_t>::size_type
>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
416template <
int NLayers>
419 if (rofId < 0 || rofId >= getNrof(layerId)) {
422 int startIdx{mROFramesClusters[layerId][rofId]};
423 return {&mUsedClusters[layerId][startIdx],
static_cast<gsl::span<const uint8_t>::size_type
>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
426template <
int NLayers>
429 if (rofMin < 0 || rofMin >= getNrof(layerId)) {
432 int startIdx{mROFramesClusters[layerId][rofMin]};
433 int endIdx{mROFramesClusters[layerId][o2::gpu::CAMath::Min(rofMin +
range, getNrof(layerId))]};
434 return {&mClusters[layerId][startIdx],
static_cast<gsl::span<Cluster>::size_type
>(endIdx - startIdx)};
437template <
int NLayers>
440 int chkdRange{o2::gpu::CAMath::Min(
range, getNrof(layerId) - rofMin)};
441 return {&mROFramesClusters[layerId][rofMin],
static_cast<gsl::span<int>::size_type
>(chkdRange)};
444template <
int NLayers>
447 int chkdRange{o2::gpu::CAMath::Min(
range, getNrof(layerId) - rofMin)};
448 return {&mNClustersPerROF[layerId][rofMin],
static_cast<gsl::span<int>::size_type
>(chkdRange)};
451template <
int NLayers>
454 int startIdx{rofMin};
455 int endIdx{o2::gpu::CAMath::Min(rofMin +
range, getNrof(layerId))};
456 return mROFramesClusters[layerId][endIdx] - mROFramesClusters[layerId][startIdx];
459template <
int NLayers>
462 return std::lower_bound(mROFramesClusters[iLayer].begin(), mROFramesClusters[iLayer].
end(), iCluster + 1) - mROFramesClusters[iLayer].begin() - 1;
465template <
int NLayers>
468 if (rofId < 0 || rofId >= getNrof(layerId)) {
471 int startIdx{mROFramesClusters[layerId][rofId]};
472 return {&mUnsortedClusters[layerId][startIdx],
static_cast<gsl::span<Cluster>::size_type
>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
475template <
int NLayers>
478 if (rofId < 0 || rofId >= getNrof(
layer)) {
481 const int tableSize = mIndexTableUtils.getNphiBins() * mIndexTableUtils.getNzBins() + 1;
485template <
int NLayers>
486template <
typename... T>
489 mUnsortedClusters[
layer].emplace_back(std::forward<T>(
values)...);
492template <
int NLayers>
493template <
typename... T>
496 mTrackingFrameInfo[
layer].emplace_back(std::forward<T>(
values)...);
499template <
int NLayers>
502 return {&mUsedClusters[
layer][0],
static_cast<gsl::span<uint8_t>::size_type
>(mUsedClusters[
layer].size())};
505template <
int NLayers>
508 if (rofId < 0 || rofId >= getNrof(1)) {
511 auto startIdx{mROFramesClusters[1][rofId]};
512 return {&mNTrackletsPerCluster[combId][startIdx],
static_cast<gsl::span<int>::size_type
>(mROFramesClusters[1][rofId + 1] - startIdx)};
515template <
int NLayers>
518 if (rofId < 0 || rofId >= getNrof(1)) {
521 auto clusStartIdx{mROFramesClusters[1][rofId]};
523 return {&mNTrackletsPerClusterSum[combId][clusStartIdx],
static_cast<gsl::span<int>::size_type
>(mROFramesClusters[1][rofId + 1] - clusStartIdx)};
526template <
int NLayers>
529 if (rofId < 0 || rofId >= getNrof(1) || mTracklets[combId].
empty()) {
532 auto startIdx{mNTrackletsPerROF[combId][rofId]};
533 return {&mTracklets[combId][startIdx],
static_cast<gsl::span<Tracklet>::size_type
>(mNTrackletsPerROF[combId][rofId + 1] - startIdx)};
536template <
int NLayers>
539 if (rofId < 0 || rofId >= getNrof(1)) {
542 auto startIdx{mNTrackletsPerROF[combId][rofId]};
543 return {&mTracklets[combId][startIdx],
static_cast<gsl::span<Tracklet>::size_type
>(mNTrackletsPerROF[combId][rofId + 1] - startIdx)};
546template <
int NLayers>
549 if (rofId < 0 || rofId >= getNrof(1) || !hasMCinformation()) {
552 auto startIdx{mNTrackletsPerROF[combId][rofId]};
553 return {&mTrackletLabels[combId][startIdx],
static_cast<gsl::span<Tracklet>::size_type
>(mNTrackletsPerROF[combId][rofId + 1] - startIdx)};
556template <
int NLayers>
559 size_t totalClusters{0};
560 for (
const auto&
clusters : mUnsortedClusters) {
563 return int(totalClusters);
566template <
int NLayers>
570 for (
const auto&
layer : mClusters) {
576template <
int NLayers>
580 for (
const auto&
layer : mCells) {
581 nCells +=
layer.size();
586template <
int NLayers>
589 size_t nTracklets{0};
590 for (
const auto&
layer : mTracklets) {
591 nTracklets +=
layer.size();
596template <
int NLayers>
600 for (
const auto& l : mCellsNeighbours) {
606template <
int NLayers>
609 return mTracks.size();
612template <
int NLayers>
616 for (
const auto&
layer : mUsedClusters) {
622template <
int NLayers>
625 mNExtendedTracks = 0;
626 mNExtendedClusters = 0;
629template <
int NLayers>
632 mNExtendedTracks += nTracks;
Cross-timeframe output-size prediction.
Definition of a container to keep Monte Carlo truth external to simulation objects.
Definition of the ITS track.
HMPID cluster implementation.
GLboolean GLboolean GLboolean b
GLenum GLsizei GLsizei GLint * values
GLuint GLsizei const GLchar * label
GLenum GLuint GLint GLint layer
GLboolean GLboolean GLboolean GLboolean a
GLubyte GLubyte GLubyte GLubyte w
constexpr int UnusedIndex
std::pmr::vector< T > bounded_vector
std::pair< o2::MCCompLabel, float > VertexLabel
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
size_t mNExtendedClusters
ROFVertexLookupTable< NLayers > ROFVertexLookupTableN
virtual size_t getNumberOfCells() const
void prepareClusters(const TrackingParameters &trkParam, const int maxLayers=NLayers)
std::vector< TrackingTopologyN > mTrackerTopologies
std::vector< bounded_vector< Line > > mLines
std::vector< bounded_vector< int > > mTrackletsLookupTable
bounded_vector< int > mBogusClusters
std::array< float, NLayers > mMaxR
const TrackingFrameInfo & getClusterTrackingFrameInfo(int layerId, const Cluster &cl) const
virtual void setDevicePropagator(const o2::base::PropagatorImpl< float > *)
const auto & getROFVertexLookupTableView() const
size_t getNumberOfUsedClusters() const
std::array< bounded_vector< int >, NLayers > mIndexTables
ROFMaskTableN mUPCCutMask
gsl::span< const Cluster > getUnsortedClustersOnLayer(int rofId, int layerId) const
std::array< bounded_vector< int >, 2 > mNTrackletsPerClusterSum
size_t getNumberOfClusters() const
gsl::span< const Cluster > getClustersOnLayer(int rofId, int layerId) const
void initDefaultTrackingTopology(const TrackingParameters &trkParam, const int maxLayers=NLayers)
auto & getPositionResolutions()
bounded_vector< MCCompLabel > mTracksLabel
void useMultiplictyMask() noexcept
bool checkMemory(unsigned long max)
const auto & getTrackingFrameInfoOnLayer(int layerId) const
std::array< uint32_t, 2 > mTotalTracklets
void setMemoryPool(std::shared_ptr< BoundedMemoryResource > pool)
memory management
size_t getNumberOfTracks() const
void resetBeamXY(const float x, const float y, const float w=0)
void computeTracletsPerClusterScans()
auto & getTrackletsLabel(int layer)
ROFOverlapTableN mROFOverlapTable
std::shared_ptr< BoundedMemoryResource > mExtMemoryPool
bounded_vector< TrackITSExt > mTracks
auto getFrameworkAllocator()
virtual size_t getNumberOfNeighbours() const
ROFVertexLookupTableN::View mROFVertexLookupTableView
gsl::span< Tracklet > getFoundTracklets(int rofId, int combId)
void initVertexingTopology(const TrackingParameters &trkParam)
TrackSeed< NLayers > TrackSeedN
gsl::span< uint8_t > getUsedClustersROF(int rofId, int layerId)
std::array< const dataformats::MCTruthContainer< MCCompLabel > *, NLayers > mClusterLabels
std::vector< bounded_vector< CellSeed > > mCells
gsl::span< const MCCompLabel > getLabelsFoundTracklets(int rofId, int combId) const
void printArtefactsMemory() const
void useUPCMask() noexcept
CapacityEstimator & getCapacityEstimator() noexcept
ROFOverlapTableN::View mROFOverlapTableView
gsl::span< const Tracklet > getFoundTracklets(int rofId, int combId) const
const Vertex & getPrimaryVertex(const int ivtx) const
virtual const char * getName() const noexcept
const o2::base::PropagatorImpl< float > * getDevicePropagator() const
gsl::span< const Cluster > getClustersPerROFrange(int rofMin, int range, int layerId) const
int getClusterSize(int layer, int clusterId) const
void updateROFVertexLookupTable()
void setFrameworkAllocator(ExternalAllocator *ext)
auto & getCellsNeighboursTopology()
void setClusterSize(int layer, bounded_vector< uint8_t > &v)
void initialise(const TrackingParameters &trkParam, const int maxLayers=NLayers, const int iteration=constants::UnusedIndex)
const auto & getIndexTableUtils() const
void addPrimaryVertexLabel(const VertexLabel &label)
bool hasFrameworkAllocator() const noexcept
size_t getNExtendedClusters() const
gsl::span< const int > getNClustersROFrange(int rofMin, int range, int layerId) const
int getSortedStartIndex(const int rofId, const int layer) const
auto & getUnsortedClusters()
const auto & getROFMaskView() const
void prepareROFrameData(gsl::span< const itsmft::CompClusterExt > clusters, int layer)
TimeFrame(const TimeFrame &)=delete
gsl::span< unsigned char > getUsedClusters(const int layer)
TrackingTopologyN mDefaultTrackingTopology
auto & getLines(int rofId)
void addClusterExternalIndexToLayer(int layer, const int idx)
virtual bool isGPU() const noexcept
const auto & getPrimaryVertices() const
void markUsedCluster(int layer, int clusterId)
gsl::span< int > getIndexTable(int rofId, int layerId)
void computeTrackletsPerROFScans()
const o2::base::PropagatorImpl< float > * mPropagatorDevice
std::vector< bounded_vector< MCCompLabel > > mLinesLabels
std::array< bounded_vector< TrackingFrameInfo >, NLayers > mTrackingFrameInfo
void addPrimaryVertex(const Vertex &vertex)
int getNrof(int layer) const
int hasBogusClusters() const
std::array< bounded_vector< uint8_t >, NLayers > mUsedClusters
void loadROFrameData(gsl::span< const o2::itsmft::ROFRecord > rofs, gsl::span< const itsmft::CompClusterExt > clusters, gsl::span< const unsigned char >::iterator &pattIt, const itsmft::TopologyDictionary *dict, int layer, const dataformats::MCTruthContainer< MCCompLabel > *mcLabels=nullptr)
std::vector< bounded_vector< int > > mCellsNeighbours
std::array< float, 2 > & getBeamXY()
bounded_vector< float > mLinkPhiCuts
auto & getCellsNeighbours()
void addTrackingFrameInfoToLayer(int layer, T &&... args)
std::vector< bounded_vector< MCCompLabel > > mTrackletLabels
PV x and alpha for track propagation.
CapacityEstimator mCapacityEstimator
keep track of clusters with wild coordinates
ROFMaskTableN::View mROFMaskView
void resetROFrameData(int iLayer)
void initTrackerTopologies(gsl::span< const TrackingParameters > trkParams, const int maxLayers=NLayers)
TrackingTopologyN mVertexingTopology
int getSortedIndex(int rofId, int layer, int idx) const
auto & getCellsLookupTable()
const auto & getTrackerTopologies() const
std::array< float, 2 > mBeamPos
std::vector< bounded_vector< int > > mCellsNeighboursTopology
void setUPCCutMask(ROFMaskTableN cutMask)
void setROFVertexLookupTable(ROFVertexLookupTableN table)
unsigned int mNTotalLowPtVertices
int getTotalClusters() const
TrackingTopologyN::View mTrackingTopologyView
uint32_t getTotalTrackletsTF(const int iLayer)
std::vector< bounded_vector< int > > mNTrackletsPerROF
auto & getMemoryPool() const noexcept
gsl::span< const int > getROFramesClustersPerROFrange(int rofMin, int range, int layerId) const
ExternalAllocator * mExternalAllocator
State if memory will be externally managed by the GPU framework.
std::array< bounded_vector< int >, NLayers > mNClustersPerROF
int getClusterROF(int iLayer, int iCluster)
int getTotalClustersPerROFrange(int rofMin, int range, int layerId) const
auto getPrimaryVerticesNum()
std::array< bounded_vector< int >, 2 > mTrackletsIndexROF
void resetTrackExtensionCounters()
bounded_vector< float > mPositionResolution
std::array< bounded_vector< Cluster >, NLayers > mUnsortedClusters
std::vector< bounded_vector< Tracklet > > mTracklets
std::vector< bounded_vector< MCCompLabel > > mCellLabels
const auto & getTrackingTopologyView() const
auto & getLinesLabel(const int rofId)
void setBeamPosition(const float x, const float y, const float s2, const float base=50.f, const float systematic=0.f)
std::vector< bounded_vector< ClusterLines > > mTrackletClusters
ROFMaskTableN mMultiplicityCutMask
auto & getPrimaryVertices()
std::vector< bounded_vector< int > > mCellsNeighboursLUT
gsl::span< const MCCompLabel > getClusterLabels(int layerId, const int clId) const
void addTrackExtensionCounters(size_t nTracks, size_t nClusters)
bounded_vector< VertexLabel > mPrimaryVerticesLabels
gsl::span< const uint8_t > getUsedClustersROF(int rofId, int layerId) const
virtual size_t getNumberOfTracklets() const
bool hasMCinformation() const
TrackingTopology< NLayers > TrackingTopologyN
float getPositionResolution(int layer) const
float getLinkPhiCut(int linkId) const
std::array< bounded_vector< uint8_t >, NLayers > mClusterSize
gsl::span< const int > getROFrameClusters(int layerId) const
std::pmr::memory_resource * getMaybeFrameworkHostResource(bool forceHost=false)
std::array< bounded_vector< int >, NLayers > mClusterExternalIndices
auto & getCellsLabel(int layer)
std::shared_ptr< BoundedMemoryResource > mMemoryPool
float getMinR(int layer) const
const auto & getROFOverlapTableView() const
gsl::span< Cluster > getClustersOnLayer(int rofId, int layerId)
IndexTableUtilsN mIndexTableUtils
std::array< bounded_vector< int >, NLayers > mROFramesClusters
float getLinkMSAngle(int linkId) const
const auto & getROFVertexLookupTable() const
void setNLinesTotal(uint32_t a) noexcept
void addClusterToLayer(int layer, T &&... args)
unsigned long getArtefactsMemory() const
ROFOverlapTable< NLayers > ROFOverlapTableN
float getMaxR(int layer) const
gsl::span< const MCCompLabel > getClusterLabels(int layerId, const Cluster &cl) const
std::array< bounded_vector< Cluster >, NLayers > mClusters
std::vector< bounded_vector< int > > mCellsLookupTable
bool isBeamPositionOverridden
auto & getPrimaryVerticesLabels()
const CapacityEstimator & getCapacityEstimator() const noexcept
gsl::span< const Vertex > getPrimaryVertices(int layer, int rofId) const
void setIsStaggered(bool b) noexcept
staggering
int getNLinesTotal() const noexcept
auto & getTrackletClusters(int rofId)
bool isClusterUsed(int layer, int clusterId) const
bounded_vector< Vertex > mPrimaryVertices
void setROFOverlapTable(ROFOverlapTableN table)
gsl::span< int > getExclusiveNTrackletsCluster(int rofId, int combId)
void setMultiplicityCutMask(ROFMaskTableN cutMask)
bounded_vector< std::array< float, 2 > > mPValphaX
auto & getTrackletsLookupTable()
ROFVertexLookupTableN mROFVertexLookupTable
ROFMaskTable< NLayers > ROFMaskTableN
bounded_vector< float > mLinkMSAngles
int getClusterExternalIndex(int layerId, const int clId) const
std::array< float, NLayers > mMinR
const auto & getROFOverlapTable() const
int & getNTrackletsROF(int rofId, int combId)
gsl::span< int > getNTrackletsCluster(int rofId, int combId)
TimeFrame & operator=(const TimeFrame &)=delete
auto & getCellsNeighboursLUT()
std::array< bounded_vector< int >, 2 > mNTrackletsPerCluster
size_t getNExtendedTracks() const
std::vector< Cluster > clusters