13#ifndef TRACKINGITSU_INCLUDE_TIMEFRAME_H_
14#define TRACKINGITSU_INCLUDE_TIMEFRAME_H_
53class TopologyDictionary;
96 gsl::span<const itsmft::CompClusterExt>
clusters,
97 gsl::span<const unsigned char>::iterator& pattIt,
111 void setBeamPosition(
const float x,
const float y,
const float s2,
const float base = 50.f,
const float systematic = 0.f)
114 resetBeamXY(
x,
y, s2 / o2::gpu::CAMath::Sqrt((base * base) + systematic));
194 void initTrackerTopologies(gsl::span<const TrackingParameters> trkParams,
const int maxLayers = NLayers);
229 void setMemoryPool(std::shared_ptr<BoundedMemoryResource> pool);
275 template <
typename... T>
277 template <
typename... T>
285 std::array<const dataformats::MCTruthContainer<MCCompLabel>*, NLayers>
mClusterLabels{
nullptr};
295 std::vector<bounded_vector<CellSeed>>
mCells;
309 virtual bool isGPU() const noexcept {
return false; }
310 virtual const char*
getName() const noexcept {
return "CPU"; }
338 std::vector<bounded_vector<Line>>
mLines;
366template <
int NLayers>
369 if (rofId < 0 || rofId >= getNrof(
layer)) {
372 const auto&
entry = mROFVertexLookupTableView.getVertices(
layer, rofId);
373 return {&mPrimaryVertices[
entry.getFirstEntry()],
static_cast<gsl::span<const Vertex>::size_type
>(
entry.getEntries())};
376template <
int NLayers>
384template <
int NLayers>
387 return {&mROFramesClusters[layerId][0],
static_cast<gsl::span<const int>::size_type
>(mROFramesClusters[layerId].size())};
390template <
int NLayers>
393 if (rofId < 0 || rofId >= getNrof(layerId)) {
396 int startIdx{mROFramesClusters[layerId][rofId]};
397 return {&mClusters[layerId][startIdx],
static_cast<gsl::span<Cluster>::size_type
>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
400template <
int NLayers>
403 if (rofId < 0 || rofId >= getNrof(layerId)) {
406 int startIdx{mROFramesClusters[layerId][rofId]};
407 return {&mClusters[layerId][startIdx],
static_cast<gsl::span<const Cluster>::size_type
>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
410template <
int NLayers>
413 if (rofId < 0 || rofId >= getNrof(layerId)) {
416 int startIdx{mROFramesClusters[layerId][rofId]};
417 return {&mUsedClusters[layerId][startIdx],
static_cast<gsl::span<uint8_t>::size_type
>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
420template <
int NLayers>
423 if (rofId < 0 || rofId >= getNrof(layerId)) {
426 int startIdx{mROFramesClusters[layerId][rofId]};
427 return {&mUsedClusters[layerId][startIdx],
static_cast<gsl::span<const uint8_t>::size_type
>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
430template <
int NLayers>
433 if (rofMin < 0 || rofMin >= getNrof(layerId)) {
436 int startIdx{mROFramesClusters[layerId][rofMin]};
437 int endIdx{mROFramesClusters[layerId][o2::gpu::CAMath::Min(rofMin +
range, getNrof(layerId))]};
438 return {&mClusters[layerId][startIdx],
static_cast<gsl::span<Cluster>::size_type
>(endIdx - startIdx)};
441template <
int NLayers>
444 int chkdRange{o2::gpu::CAMath::Min(
range, getNrof(layerId) - rofMin)};
445 return {&mROFramesClusters[layerId][rofMin],
static_cast<gsl::span<int>::size_type
>(chkdRange)};
448template <
int NLayers>
451 int chkdRange{o2::gpu::CAMath::Min(
range, getNrof(layerId) - rofMin)};
452 return {&mNClustersPerROF[layerId][rofMin],
static_cast<gsl::span<int>::size_type
>(chkdRange)};
455template <
int NLayers>
458 int startIdx{rofMin};
459 int endIdx{o2::gpu::CAMath::Min(rofMin +
range, getNrof(layerId))};
460 return mROFramesClusters[layerId][endIdx] - mROFramesClusters[layerId][startIdx];
463template <
int NLayers>
466 return std::lower_bound(mROFramesClusters[iLayer].begin(), mROFramesClusters[iLayer].
end(), iCluster + 1) - mROFramesClusters[iLayer].begin() - 1;
469template <
int NLayers>
472 if (rofId < 0 || rofId >= getNrof(layerId)) {
475 int startIdx{mROFramesClusters[layerId][rofId]};
476 return {&mUnsortedClusters[layerId][startIdx],
static_cast<gsl::span<Cluster>::size_type
>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
479template <
int NLayers>
482 if (rofId < 0 || rofId >= getNrof(
layer)) {
485 const int tableSize = mIndexTableUtils.getNphiBins() * mIndexTableUtils.getNzBins() + 1;
489template <
int NLayers>
490template <
typename... T>
493 mUnsortedClusters[
layer].emplace_back(std::forward<T>(
values)...);
496template <
int NLayers>
497template <
typename... T>
500 mTrackingFrameInfo[
layer].emplace_back(std::forward<T>(
values)...);
503template <
int NLayers>
506 return {&mUsedClusters[
layer][0],
static_cast<gsl::span<uint8_t>::size_type
>(mUsedClusters[
layer].size())};
509template <
int NLayers>
512 if (rofId < 0 || rofId >= getNrof(1)) {
515 auto startIdx{mROFramesClusters[1][rofId]};
516 return {&mNTrackletsPerCluster[combId][startIdx],
static_cast<gsl::span<int>::size_type
>(mROFramesClusters[1][rofId + 1] - startIdx)};
519template <
int NLayers>
522 if (rofId < 0 || rofId >= getNrof(1)) {
525 auto clusStartIdx{mROFramesClusters[1][rofId]};
527 return {&mNTrackletsPerClusterSum[combId][clusStartIdx],
static_cast<gsl::span<int>::size_type
>(mROFramesClusters[1][rofId + 1] - clusStartIdx)};
530template <
int NLayers>
533 if (rofId < 0 || rofId >= getNrof(1) || mTracklets[combId].
empty()) {
536 auto startIdx{mNTrackletsPerROF[combId][rofId]};
537 return {&mTracklets[combId][startIdx],
static_cast<gsl::span<Tracklet>::size_type
>(mNTrackletsPerROF[combId][rofId + 1] - startIdx)};
540template <
int NLayers>
543 if (rofId < 0 || rofId >= getNrof(1)) {
546 auto startIdx{mNTrackletsPerROF[combId][rofId]};
547 return {&mTracklets[combId][startIdx],
static_cast<gsl::span<Tracklet>::size_type
>(mNTrackletsPerROF[combId][rofId + 1] - startIdx)};
550template <
int NLayers>
553 if (rofId < 0 || rofId >= getNrof(1) || !hasMCinformation()) {
556 auto startIdx{mNTrackletsPerROF[combId][rofId]};
557 return {&mTrackletLabels[combId][startIdx],
static_cast<gsl::span<Tracklet>::size_type
>(mNTrackletsPerROF[combId][rofId + 1] - startIdx)};
560template <
int NLayers>
563 size_t totalClusters{0};
564 for (
const auto&
clusters : mUnsortedClusters) {
567 return int(totalClusters);
570template <
int NLayers>
574 for (
const auto&
layer : mClusters) {
580template <
int NLayers>
584 for (
const auto&
layer : mCells) {
585 nCells +=
layer.size();
590template <
int NLayers>
593 size_t nTracklets{0};
594 for (
const auto&
layer : mTracklets) {
595 nTracklets +=
layer.size();
600template <
int NLayers>
604 for (
const auto& l : mCellsNeighbours) {
610template <
int NLayers>
613 return mTracks.size();
616template <
int NLayers>
620 for (
const auto&
layer : mUsedClusters) {
626template <
int NLayers>
629 mNExtendedTracks = 0;
630 mNExtendedClusters = 0;
633template <
int NLayers>
636 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::pair< o2::MCCompLabel, float > VertexLabel
std::pmr::vector< T > bounded_vector
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