13#ifndef TRACKINGITSU_INCLUDE_TIMEFRAME_H_
14#define TRACKINGITSU_INCLUDE_TIMEFRAME_H_
52class TopologyDictionary;
88 gsl::span<const itsmft::CompClusterExt>
clusters,
89 gsl::span<const unsigned char>::iterator& pattIt,
103 void setBeamPosition(
const float x,
const float y,
const float s2,
const float base = 50.f,
const float systematic = 0.f)
106 resetBeamXY(
x,
y, s2 / o2::gpu::CAMath::Sqrt((base * base) + systematic));
186 void initTrackerTopologies(gsl::span<const TrackingParameters> trkParams,
const int maxLayers = NLayers);
221 void setMemoryPool(std::shared_ptr<BoundedMemoryResource> pool);
264 template <
typename... T>
266 template <
typename... T>
274 std::array<const dataformats::MCTruthContainer<MCCompLabel>*, NLayers>
mClusterLabels{
nullptr};
284 std::vector<bounded_vector<CellSeed>>
mCells;
298 virtual bool isGPU() const noexcept {
return false; }
299 virtual const char*
getName() const noexcept {
return "CPU"; }
325 std::vector<bounded_vector<Line>>
mLines;
353template <
int NLayers>
356 if (rofId < 0 || rofId >= getNrof(
layer)) {
359 const auto&
entry = mROFVertexLookupTableView.getVertices(
layer, rofId);
360 return {&mPrimaryVertices[
entry.getFirstEntry()],
static_cast<gsl::span<const Vertex>::size_type
>(
entry.getEntries())};
363template <
int NLayers>
371template <
int NLayers>
374 return {&mROFramesClusters[layerId][0],
static_cast<gsl::span<const int>::size_type
>(mROFramesClusters[layerId].size())};
377template <
int NLayers>
380 if (rofId < 0 || rofId >= getNrof(layerId)) {
383 int startIdx{mROFramesClusters[layerId][rofId]};
384 return {&mClusters[layerId][startIdx],
static_cast<gsl::span<Cluster>::size_type
>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
387template <
int NLayers>
390 if (rofId < 0 || rofId >= getNrof(layerId)) {
393 int startIdx{mROFramesClusters[layerId][rofId]};
394 return {&mClusters[layerId][startIdx],
static_cast<gsl::span<const Cluster>::size_type
>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
397template <
int NLayers>
400 if (rofId < 0 || rofId >= getNrof(layerId)) {
403 int startIdx{mROFramesClusters[layerId][rofId]};
404 return {&mUsedClusters[layerId][startIdx],
static_cast<gsl::span<uint8_t>::size_type
>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
407template <
int NLayers>
410 if (rofId < 0 || rofId >= getNrof(layerId)) {
413 int startIdx{mROFramesClusters[layerId][rofId]};
414 return {&mUsedClusters[layerId][startIdx],
static_cast<gsl::span<const uint8_t>::size_type
>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
417template <
int NLayers>
420 if (rofMin < 0 || rofMin >= getNrof(layerId)) {
423 int startIdx{mROFramesClusters[layerId][rofMin]};
424 int endIdx{mROFramesClusters[layerId][o2::gpu::CAMath::Min(rofMin +
range, getNrof(layerId))]};
425 return {&mClusters[layerId][startIdx],
static_cast<gsl::span<Cluster>::size_type
>(endIdx - startIdx)};
428template <
int NLayers>
431 int chkdRange{o2::gpu::CAMath::Min(
range, getNrof(layerId) - rofMin)};
432 return {&mROFramesClusters[layerId][rofMin],
static_cast<gsl::span<int>::size_type
>(chkdRange)};
435template <
int NLayers>
438 int chkdRange{o2::gpu::CAMath::Min(
range, getNrof(layerId) - rofMin)};
439 return {&mNClustersPerROF[layerId][rofMin],
static_cast<gsl::span<int>::size_type
>(chkdRange)};
442template <
int NLayers>
445 int startIdx{rofMin};
446 int endIdx{o2::gpu::CAMath::Min(rofMin +
range, getNrof(layerId))};
447 return mROFramesClusters[layerId][endIdx] - mROFramesClusters[layerId][startIdx];
450template <
int NLayers>
453 return std::lower_bound(mROFramesClusters[iLayer].begin(), mROFramesClusters[iLayer].
end(), iCluster + 1) - mROFramesClusters[iLayer].begin() - 1;
456template <
int NLayers>
459 if (rofId < 0 || rofId >= getNrof(layerId)) {
462 int startIdx{mROFramesClusters[layerId][rofId]};
463 return {&mUnsortedClusters[layerId][startIdx],
static_cast<gsl::span<Cluster>::size_type
>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
466template <
int NLayers>
469 if (rofId < 0 || rofId >= getNrof(
layer)) {
472 const int tableSize = mIndexTableUtils.getNphiBins() * mIndexTableUtils.getNzBins() + 1;
476template <
int NLayers>
477template <
typename... T>
480 mUnsortedClusters[
layer].emplace_back(std::forward<T>(
values)...);
483template <
int NLayers>
484template <
typename... T>
487 mTrackingFrameInfo[
layer].emplace_back(std::forward<T>(
values)...);
490template <
int NLayers>
493 return {&mUsedClusters[
layer][0],
static_cast<gsl::span<uint8_t>::size_type
>(mUsedClusters[
layer].size())};
496template <
int NLayers>
499 if (rofId < 0 || rofId >= getNrof(1)) {
502 auto startIdx{mROFramesClusters[1][rofId]};
503 return {&mNTrackletsPerCluster[combId][startIdx],
static_cast<gsl::span<int>::size_type
>(mROFramesClusters[1][rofId + 1] - startIdx)};
506template <
int NLayers>
509 if (rofId < 0 || rofId >= getNrof(1)) {
512 auto clusStartIdx{mROFramesClusters[1][rofId]};
514 return {&mNTrackletsPerClusterSum[combId][clusStartIdx],
static_cast<gsl::span<int>::size_type
>(mROFramesClusters[1][rofId + 1] - clusStartIdx)};
517template <
int NLayers>
520 if (rofId < 0 || rofId >= getNrof(1) || mTracklets[combId].
empty()) {
523 auto startIdx{mNTrackletsPerROF[combId][rofId]};
524 return {&mTracklets[combId][startIdx],
static_cast<gsl::span<Tracklet>::size_type
>(mNTrackletsPerROF[combId][rofId + 1] - startIdx)};
527template <
int NLayers>
530 if (rofId < 0 || rofId >= getNrof(1)) {
533 auto startIdx{mNTrackletsPerROF[combId][rofId]};
534 return {&mTracklets[combId][startIdx],
static_cast<gsl::span<Tracklet>::size_type
>(mNTrackletsPerROF[combId][rofId + 1] - startIdx)};
537template <
int NLayers>
540 if (rofId < 0 || rofId >= getNrof(1) || !hasMCinformation()) {
543 auto startIdx{mNTrackletsPerROF[combId][rofId]};
544 return {&mTrackletLabels[combId][startIdx],
static_cast<gsl::span<Tracklet>::size_type
>(mNTrackletsPerROF[combId][rofId + 1] - startIdx)};
547template <
int NLayers>
550 size_t totalClusters{0};
551 for (
const auto&
clusters : mUnsortedClusters) {
554 return int(totalClusters);
557template <
int NLayers>
561 for (
const auto&
layer : mClusters) {
567template <
int NLayers>
571 for (
const auto&
layer : mCells) {
572 nCells +=
layer.size();
577template <
int NLayers>
580 size_t nTracklets{0};
581 for (
const auto&
layer : mTracklets) {
582 nTracklets +=
layer.size();
587template <
int NLayers>
591 for (
const auto& l : mCellsNeighbours) {
597template <
int NLayers>
600 return mTracks.size();
603template <
int NLayers>
607 for (
const auto&
layer : mUsedClusters) {
613template <
int NLayers>
616 mNExtendedTracks = 0;
617 mNExtendedClusters = 0;
620template <
int NLayers>
623 mNExtendedTracks += nTracks;
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)
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
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)
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.
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
virtual ~TimeFrame()=default
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()
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
keep track of clusters with wild coordinates
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)
auto & getCellsNeighboursLUT()
std::array< bounded_vector< int >, 2 > mNTrackletsPerCluster
size_t getNExtendedTracks() const
std::vector< Cluster > clusters