13#ifndef TRACKINGITSU_INCLUDE_TIMEFRAME_H_
14#define TRACKINGITSU_INCLUDE_TIMEFRAME_H_
56class TopologyDictionary;
78 void addPrimaryVertices(
const std::vector<Vertex>& vertices,
const int rofId,
const int iteration);
79 void addPrimaryVertices(
const gsl::span<const Vertex>& vertices,
const int rofId,
const int iteration);
87 gsl::span<const itsmft::CompClusterExt>
clusters,
88 gsl::span<const unsigned char>::iterator& pattIt,
100 void resetBeamXY(
const float x,
const float y,
const float w = 0);
101 void setBeamPosition(
const float x,
const float y,
const float s2,
const float base = 50.f,
const float systematic = 0.f)
103 isBeamPositionOverridden =
true;
104 resetBeamXY(
x,
y, s2 / o2::gpu::CAMath::Sqrt(base * base + systematic));
136 const gsl::span<const MCCompLabel>
getClusterLabels(
int layerId,
const int clId)
const;
150 mTotVertPerIteration.resize(1);
163 std::vector<std::vector<CellSeed>>&
getCells();
170 std::vector<MCCompLabel>&
getTracksLabel(
const int rofId) {
return mTracksLabel[rofId]; }
171 std::vector<MCCompLabel>&
getLinesLabel(
const int rofId) {
return mLinesLabels[rofId]; }
193 std::vector<Line>&
getLines(
int rofId);
196 return std::accumulate(mLines.begin(), mLines.end(), 0, [](
int sum,
const auto& l) { return sum + l.size(); });
212 void setRoadLabel(
int i,
const unsigned long long& lab,
bool fake);
217 void setROFMask(
const std::vector<uint8_t>& rofMask) { mROFMask = rofMask; }
220 int hasBogusClusters()
const {
return std::accumulate(mBogusClusters.begin(), mBogusClusters.end(), 0); }
228 LOGP(
debug,
"Setting timeFrame allocator to external");
232 LOGP(
debug,
"External allocator is currently only supported for GPU");
242 template <
typename... T>
244 template <
typename... T>
290 std::vector<std::vector<CellSeed>>
mCells;
291 std::vector<std::vector<o2::track::TrackParCovF>>
mCellSeeds;
294 std::vector<std::vector<TrackITSExt>>
mTracks;
308 template <
typename T>
311 std::vector<T>().swap(
vec);
317 unsigned int mNTotalLowPtVertices = 0;
318 int mBeamPosWeight = 0;
319 std::array<float, 2> mBeamPos = {0.f, 0.f};
320 bool isBeamPositionOverridden =
false;
321 std::vector<float> mMinR;
322 std::vector<float> mMaxR;
323 std::vector<float> mMSangles;
324 std::vector<float> mPhiCuts;
325 std::vector<float> mPositionResolution;
326 std::vector<uint8_t> mClusterSize;
328 std::vector<uint8_t> mROFMask;
329 std::vector<std::array<float, 2>> mPValphaX;
330 std::vector<std::vector<MCCompLabel>> mTrackletLabels;
331 std::vector<std::vector<MCCompLabel>> mCellLabels;
332 std::vector<std::vector<int>> mCellsNeighboursLUT;
333 std::vector<std::vector<MCCompLabel>> mTracksLabel;
334 std::vector<int> mBogusClusters;
336 std::vector<std::pair<unsigned long long, bool>> mRoadLabels;
341 std::vector<std::vector<int>> mNTrackletsPerROF;
342 std::vector<std::vector<Line>> mLines;
343 std::vector<std::vector<ClusterLines>> mTrackletClusters;
344 std::vector<std::vector<int>> mTrackletsIndexROF;
345 std::vector<std::vector<MCCompLabel>> mLinesLabels;
346 std::vector<std::pair<MCCompLabel, float>> mVerticesMCRecInfo;
347 std::array<uint32_t, 2> mTotalTracklets = {0, 0};
348 unsigned int mNoVertexROF = 0;
349 std::vector<int> mTotVertPerIteration;
358 const int stop_idx = rofId >=
mNrof - 1 ?
mNrof : rofId + 1;
366 const int stop_idx = rofId >=
mNrof - 1 ?
mNrof : rofId + 1;
368 return {&(mVerticesMCRecInfo[
start]),
static_cast<gsl::span<const std::pair<MCCompLabel, float>
>::size_type>(delta)};
379 const int stop_idx = rofId >=
mNrof - 1 ?
mNrof : rofId + 1;
381 return {&(mPValphaX[
start]),
static_cast<gsl::span<const std::array<float, 2>
>::size_type>(delta)};
415 if (rofId < 0 || rofId >=
mNrof) {
416 return gsl::span<Cluster>();
419 return {&
mClusters[layerId][startIdx],
static_cast<gsl::span<Cluster>::size_type
>(
mROFramesClusters[layerId][rofId + 1] - startIdx)};
424 if (rofId < 0 || rofId >=
mNrof) {
425 return gsl::span<const Cluster>();
428 return {&
mClusters[layerId][startIdx],
static_cast<gsl::span<Cluster>::size_type
>(
mROFramesClusters[layerId][rofId + 1] - startIdx)};
433 if (rofId < 0 || rofId >=
mNrof) {
434 return gsl::span<unsigned char>();
442 if (rofId < 0 || rofId >=
mNrof) {
443 return gsl::span<const unsigned char>();
451 if (rofMin < 0 || rofMin >=
mNrof) {
452 return gsl::span<const Cluster>();
456 return {&
mClusters[layerId][startIdx],
static_cast<gsl::span<Cluster>::size_type
>(endIdx - startIdx)};
461 int chkdRange{o2::gpu::CAMath::Min(
range,
mNrof - rofMin)};
462 return {&
mROFramesClusters[layerId][rofMin],
static_cast<gsl::span<int>::size_type
>(chkdRange)};
467 int chkdRange{o2::gpu::CAMath::Min(
range,
mNrof - rofMin)};
468 return {&
mNClustersPerROF[layerId][rofMin],
static_cast<gsl::span<int>::size_type
>(chkdRange)};
473 int startIdx{rofMin};
474 int endIdx{o2::gpu::CAMath::Min(rofMin +
range,
mNrof)};
481 int chkdRange{o2::gpu::CAMath::Min(
range,
mNrof - rofMin)};
482 return {&
mIndexTables[layerId][rofMin * iTableSize],
static_cast<gsl::span<int>::size_type
>(chkdRange * iTableSize)};
492 if (rofId < 0 || rofId >=
mNrof) {
493 return gsl::span<const Cluster>();
521 return mClusterSize[clusterId];
531 if (rofId < 0 || rofId >=
mNrof) {
532 return gsl::span<int>();
540 return mLines[rofId];
545 return mTrackletClusters[rofId];
548template <
typename... T>
554template <
typename... T>
595 mRoadLabels.resize(
mRoads.size());
600 mRoadLabels[
i].first = lab;
601 mRoadLabels[
i].second = fake;
606 return mRoadLabels[
i].first;
611 if (rofId < 0 || rofId >=
mNrof) {
612 return gsl::span<int>();
620 if (rofId < 0 || rofId >=
mNrof) {
621 return gsl::span<int>();
630 return mNTrackletsPerROF[combId][rofId];
635 return mRoadLabels[
i].second;
662 if (rofId < 0 || rofId >=
mNrof) {
663 return gsl::span<Tracklet>();
665 auto startIdx{mNTrackletsPerROF[combId][rofId]};
666 return {&
mTracklets[combId][startIdx],
static_cast<gsl::span<Tracklet>::size_type
>(mNTrackletsPerROF[combId][rofId + 1] - startIdx)};
671 if (rofId < 0 || rofId >=
mNrof) {
672 return gsl::span<const Tracklet>();
674 auto startIdx{mNTrackletsPerROF[combId][rofId]};
675 return {&
mTracklets[combId][startIdx],
static_cast<gsl::span<Tracklet>::size_type
>(mNTrackletsPerROF[combId][rofId + 1] - startIdx)};
681 return gsl::span<const MCCompLabel>();
683 auto startIdx{mNTrackletsPerROF[combId][rofId]};
684 return {&mTrackletLabels[combId][startIdx],
static_cast<gsl::span<Tracklet>::size_type
>(mNTrackletsPerROF[combId][rofId + 1] - startIdx)};
700 nCells +=
layer.size();
709 nTracklets +=
layer.size();
743 int rofId =
vertex.getTimeStamp().getTimeStamp();
748 mTotVertPerIteration[iteration]++;
Definition of a container to keep Monte Carlo truth external to simulation objects.
Definition of the ITS track.
HMPID cluster implementation.
gsl::span< const Vertex > getPrimaryVertices(int rofId) const
int mNExtendedUsedClusters
std::vector< ClusterLines > & getTrackletClusters(int rofId)
std::vector< std::vector< int > > & getTrackletsLookupTable()
void resizeVectors(int nLayers)
std::vector< std::vector< int > > mCellsLookupTable
std::array< std::vector< int >, 2 > mNTrackletsPerClusterSum
void fillPrimaryVerticesXandAlpha()
gsl::span< unsigned char > getUsedClusters(const int layer)
int hasBogusClusters() const
int getTotalClustersPerROFrange(int rofMin, int range, int layerId) const
int getClusterSize(int clusterId) const
const unsigned long long & getRoadLabel(int i) const
std::vector< std::vector< int > > mROFramesClusters
void printTrackletLUTonLayer(int i)
bool isClusterUsed(int layer, int clusterId) const
IndexTableUtils mIndexTableUtils
unsigned long getArtefactsMemory()
std::vector< float > & getMSangles()
std::vector< std::vector< TrackingFrameInfo > > mTrackingFrameInfo
void addPrimaryVerticesInROF(const std::vector< Vertex > &vertices, const int rofId, const int iteration)
int getSortedIndex(int rofId, int layer, int i) const
std::vector< uint8_t > mMultiplicityCutMask
void initialise(const int iteration, const TrackingParameters &trkParam, const int maxLayers=7, bool resetVertices=true)
gsl::span< const Cluster > getUnsortedClustersOnLayer(int rofId, int layerId) const
std::vector< std::vector< int > > & getCellsLookupTable()
std::vector< std::vector< unsigned char > > mUsedClusters
void addPrimaryVerticesLabels(std::vector< std::pair< MCCompLabel, float > > &labels)
void addTrackingFrameInfoToLayer(int layer, T &&... args)
std::vector< std::vector< TrackITSExt > > mTracks
std::vector< float > & getPhiCuts()
std::vector< Vertex > mPrimaryVertices
float getPositionResolution(int layer) const
int getROFCutVertexMult() const
void setRoadLabel(int i, const unsigned long long &lab, bool fake)
void markUsedCluster(int layer, int clusterId)
std::vector< std::vector< CellSeed > > & getCells()
std::vector< MCCompLabel > & getTracksLabel(const int rofId)
void computeTrackletsPerROFScans()
bool getExtAllocator() const
bool hasMCinformation() const
int getROFCutClusterMult() const
std::vector< std::vector< Tracklet > > & getTracklets()
std::vector< std::vector< Cluster > > & getClusters()
void initialiseRoadLabels()
std::vector< std::vector< Cluster > > mUnsortedClusters
gsl::span< int > getIndexTable(int rofId, int layerId)
const dataformats::MCTruthContainer< MCCompLabel > * mClusterLabels
void removePrimaryVerticesInROf(const int rofId)
uint32_t getTotalTrackletsTF(const int iLayer)
void checkTrackletLUTs()
Debug and printing.
void resetBeamXY(const float x, const float y, const float w=0)
float getMaxR(int layer) const
std::vector< Road< 5 > > & getRoads()
std::vector< float > & getMaxRs()
size_t getNumberOfTracks() const
std::vector< std::vector< int > > mClusterExternalIndices
friend class TimeFrameGPU
std::vector< int > mROFramesPV
std::vector< std::vector< Cluster > > & getUnsortedClusters()
gsl::span< int > getExclusiveNTrackletsCluster(int rofId, int combId)
std::vector< std::vector< int > > mNClustersPerROF
int getNumberOfTracklets() const
gsl::span< unsigned char > getUsedClustersROF(int rofId, int layerId)
int getNumberOfClusters() const
gsl::span< const int > getROFrameClusters(int layerId) const
int getClusterROF(int iLayer, int iCluster)
std::vector< MCCompLabel > & getCellsLabel(int layer)
std::vector< std::vector< int > > mCellsNeighbours
const TrackingFrameInfo & getClusterTrackingFrameInfo(int layerId, const Cluster &cl) const
std::vector< TrackITSExt > & getTracks(int rofId)
gsl::span< int > getNTrackletsCluster(int rofId, int combId)
void setExtAllocator(bool ext)
int loadROFrameData(const o2::itsmft::ROFRecord &rof, gsl::span< const itsmft::Cluster > clusters, const dataformats::MCTruthContainer< MCCompLabel > *mcLabels=nullptr)
std::vector< std::vector< Tracklet > > mTracklets
std::vector< std::vector< Cluster > > mClusters
gsl::span< const int > getROFramesClustersPerROFrange(int rofMin, int range, int layerId) const
bool checkMemory(unsigned long max)
std::vector< std::vector< int > > & getCellsNeighboursLUT()
gsl::span< Cluster > getClustersOnLayer(int rofId, int layerId)
bool isRoadFake(int i) const
int getSortedStartIndex(const int, const int) const
std::vector< std::vector< int > > & getCellsNeighbours()
std::vector< float > & getPositionResolutions()
gsl::span< const int > getNClustersROFrange(int rofMin, int range, int layerId) const
void setMultiplicityCutMask(const std::vector< uint8_t > &cutMask)
const std::vector< TrackingFrameInfo > & getTrackingFrameInfoOnLayer(int layerId) const
std::vector< MCCompLabel > & getTrackletsLabel(int layer)
void addPrimaryVerticesLabelsInROF(const std::vector< std::pair< MCCompLabel, float > > &labels, const int rofId)
gsl::span< const std::array< float, 2 > > getPrimaryVerticesXAlpha(int rofId) const
std::vector< std::vector< o2::track::TrackParCovF > > mCellSeeds
std::vector< Road< 5 > > mRoads
void computeTracletsPerClusterScans()
std::vector< std::vector< int > > mIndexTables
void setClusterSize(const std::vector< uint8_t > &v)
void addClusterExternalIndexToLayer(int layer, const int idx)
const o2::base::PropagatorImpl< float > * getDevicePropagator() const
void setROFMask(const std::vector< uint8_t > &rofMask)
std::vector< MCCompLabel > & getLinesLabel(const int rofId)
gsl::span< const int > getIndexTablePerROFrange(int rofMin, int range, int layerId) const
void printCellLUTonLayer(int i)
std::vector< std::vector< int > > mTrackletsLookupTable
int getROFCutAllMult() const
std::vector< std::pair< MCCompLabel, float > > & getVerticesMCRecInfo()
void setExternalAllocator(ExternalAllocator *allocator)
gsl::span< const MCCompLabel > getLabelsFoundTracklets(int rofId, int combId) const
const Vertex & getPrimaryVertex(const int) const
int getTotalClusters() const
float getMSangle(int layer) const
void addPrimaryVertices(const std::vector< Vertex > &vertices)
unsigned int & getNoVertexROF()
gsl::span< const Tracklet > getFoundTracklets(int rofId, int combId) const
virtual void setDevicePropagator(const o2::base::PropagatorImpl< float > *)
std::vector< std::vector< CellSeed > > mCells
std::array< std::vector< int >, 2 > mNTrackletsPerCluster
size_t getNumberOfUsedClusters() const
void addClusterToLayer(int layer, T &&... args)
const o2::base::PropagatorImpl< float > * mPropagatorDevice
std::vector< int > & getIndexTableWhole(int layerId)
void insertPastVertex(const Vertex &vertex, const int refROFId)
void deepVectorClear(std::vector< T > &vec)
gsl::span< const Cluster > getClustersPerROFrange(int rofMin, int range, int layerId) const
std::array< float, 2 > & getBeamXY()
std::vector< Line > & getLines(int rofId)
int getNumberOfNeighbours() const
auto getNumberOfExtendedTracks() const
std::vector< int > & getTotVertIteration()
float getMinR(int layer) const
void setBeamPosition(const float x, const float y, const float s2, const float base=50.f, const float systematic=0.f)
int getClusterExternalIndex(int layerId, const int clId) const
ExternalAllocator * mAllocator
auto getNumberOfUsedExtendedClusters() const
float getPhiCut(int layer) const
int & getNTrackletsROF(int rofId, int combId)
std::vector< float > & getMinRs()
int getNLinesTotal() const
const gsl::span< const MCCompLabel > getClusterLabels(int layerId, const Cluster &cl) const
void printSliceInfo(const int, const int)
int getNumberOfCells() const
std::vector< std::vector< float > > mCellSeedsChi2
gsl::span< const std::pair< MCCompLabel, float > > getPrimaryVerticesMCRecInfo(const int rofId) const
int getPrimaryVerticesNum(int rofId=-1) const
float sum(float s, o2::dcs::DataPointValue v)
GLenum GLsizei GLsizei GLint * values
GLenum GLuint GLint GLint layer
GLubyte GLubyte GLubyte GLubyte w
o2::dataformats::Vertex< o2::dataformats::TimeStamp< int > > Vertex
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::vector< o2::ctf::BufferType > vec
std::vector< Cluster > clusters