Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Detectors/ITSMFT/ITS/macros/test/CheckTracks.C
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void CheckTracks(std::string tracfile = "o2trac_its.root", std::string clusfile
if (!recTree->GetEvent(frame))
continue;
int loadedEventTracks = frame;
cout << "Number of tracks in frame " << frame << ": " << recArr->size() << std::endl;
cout << "Number of tracks in frame " << frame << ": " << recArr->size() << std::endl;
for (unsigned int i = 0; i < recArr->size(); i++) { // Find the last MC event within this reconstructed entry
auto lab = (*trkLabArr)[i];
if (!lab.isValid()) {
Expand Down
4 changes: 2 additions & 2 deletions Detectors/ITSMFT/ITS/tracking/include/ITStracking/Cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ struct Cluster final {
float xCoordinate; // = -999.f;
float yCoordinate; // = -999.f;
float zCoordinate; // = -999.f;
float phi; // = -999.f;
float radius; // = -999.f;
float phi; // = -999.f;
float radius; // = -999.f;
int clusterId; // = -1;
int indexTableBinIndex; // = -1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ GPUhdi() float math_utils::hypot(const float x, const float y)

GPUhdi() constexpr float math_utils::getNormalizedPhi(const float phi)
{
return (phi < 0) ? phi + constants::math::TwoPi :
(phi > constants::math::TwoPi) ? phi - constants::math::TwoPi : phi;
return (phi < 0) ? phi + constants::math::TwoPi : (phi > constants::math::TwoPi) ? phi - constants::math::TwoPi : phi;
}

GPUhdi() constexpr float3 math_utils::crossProduct(const float3& firstVector, const float3& secondVector)
Expand Down
54 changes: 26 additions & 28 deletions Detectors/ITSMFT/ITS/tracking/include/ITStracking/TimeFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Cluster;
class CompClusterExt;
class TopologyDictionary;
class ROFRecord;
}
} // namespace itsmft

namespace its
{
Expand All @@ -63,14 +63,14 @@ class TimeFrame final
int getTotalClusters() const;
bool empty() const;

int getSortedIndex(int rof, int layer, int i) const;
int getNrof() const;
int getSortedIndex(int rof, int layer, int i) const;
int getNrof() const;
float getBeamX() const;
float getBeamY() const;

float getMinR(int layer) const { return mMinR[layer]; }
float getMaxR(int layer) const { return mMaxR[layer]; }

gsl::span<Cluster> getClustersOnLayer(int rofId, int layerId);
gsl::span<const Cluster> getClustersOnLayer(int rofId, int layerId) const;
gsl::span<const Cluster> getUnsortedClustersOnLayer(int rofId, int layerId) const;
Expand Down Expand Up @@ -121,43 +121,42 @@ class TimeFrame final
void addClusterLabelToLayer(int layer, const MCCompLabel label);
void addClusterExternalIndexToLayer(int layer, const int idx);

int mNrof = 0;
int mBeamPosWeight = 0;
float mBeamPos[2] = {0.f,0.f};
std::vector<float> mMinR;
std::vector<float> mMaxR;
std::vector<int> mROframesPV = {0};
std::vector<std::vector<int>> mROframesClusters;
std::vector<float3> mPrimaryVertices;
std::vector<std::vector<Cluster>> mClusters;
std::vector<std::vector<Cluster>> mUnsortedClusters;
std::vector<std::vector<bool>> mUsedClusters;
int mNrof = 0;
int mBeamPosWeight = 0;
float mBeamPos[2] = {0.f, 0.f};
std::vector<float> mMinR;
std::vector<float> mMaxR;
std::vector<int> mROframesPV = {0};
std::vector<std::vector<int>> mROframesClusters;
std::vector<float3> mPrimaryVertices;
std::vector<std::vector<Cluster>> mClusters;
std::vector<std::vector<Cluster>> mUnsortedClusters;
std::vector<std::vector<bool>> mUsedClusters;
std::vector<std::vector<TrackingFrameInfo>> mTrackingFrameInfo;
std::vector<std::vector<MCCompLabel>> mClusterLabels;
std::vector<std::vector<int>> mClusterExternalIndices;
std::vector<std::vector<Cell>> mCells;
std::vector<std::vector<int>> mCellsLookupTable;
std::vector<std::vector<std::vector<int>>> mCellsNeighbours;
std::vector<Road> mRoads;
std::vector<std::vector<MCCompLabel>> mClusterLabels;
std::vector<std::vector<int>> mClusterExternalIndices;
std::vector<std::vector<Cell>> mCells;
std::vector<std::vector<int>> mCellsLookupTable;
std::vector<std::vector<std::vector<int>>> mCellsNeighbours;
std::vector<Road> mRoads;

std::vector<index_table_t> mIndexTables;
std::vector<std::vector<Tracklet>> mTracklets;
std::vector<std::vector<int>> mTrackletsLookupTable;
std::vector<index_table_t> mIndexTables;
std::vector<std::vector<Tracklet>> mTracklets;
std::vector<std::vector<int>> mTrackletsLookupTable;

std::vector<std::pair<unsigned long long, bool>> mRoadLabels;
};


inline const float3& TimeFrame::getPrimaryVertex(const int vertexIndex) const { return mPrimaryVertices[vertexIndex]; }

inline gsl::span<const float3> TimeFrame::getPrimaryVertices(int tf) const
{
{
const int start = tf > 0 ? tf - 1 : 0;
const int stop = tf >= mNrof - 1 ? mNrof : tf + 2;
return {&mPrimaryVertices[start], static_cast<gsl::span<const float3>::size_type>(mROframesPV[stop] - mROframesPV[start])};
}

inline gsl::span<const float3> TimeFrame::getPrimaryVertices(int romin, int romax) const
inline gsl::span<const float3> TimeFrame::getPrimaryVertices(int romin, int romax) const
{
return {&mPrimaryVertices[romin], static_cast<gsl::span<const float3>::size_type>(mROframesPV[romax + 1] - mROframesPV[romin])};
}
Expand Down Expand Up @@ -323,7 +322,6 @@ inline std::vector<std::vector<Cluster>>& TimeFrame::getUnsortedClusters()
return mUnsortedClusters;
}


inline std::vector<std::vector<Cell>>& TimeFrame::getCells() { return mCells; }

inline std::vector<std::vector<int>>& TimeFrame::getCellsLookupTable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class Tracker
float evaluateTask(void (Tracker::*)(T...), const char*, std::ostream& ostream, T&&... args);

TrackerTraits* mTraits = nullptr; /// Observer pointer, not owned by this class
TimeFrame* mTimeFrame = nullptr; /// Observer pointer, not owned by this class
TimeFrame* mTimeFrame = nullptr; /// Observer pointer, not owned by this class

std::vector<MemoryParameters> mMemParams;
std::vector<TrackingParameters> mTrkParams;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace its
class TrackerTraitsCPU : public TrackerTraits
{
public:
TrackerTraitsCPU(TimeFrame *tf = nullptr) { mTimeFrame = tf; } //TODO: the TimeFrame pointer should be given by the tracker that is the external interface
TrackerTraitsCPU(TimeFrame* tf = nullptr) { mTimeFrame = tf; } //TODO: the TimeFrame pointer should be given by the tracker that is the external interface
~TrackerTraitsCPU() override { delete mTimeFrame; }

void computeLayerCells() final;
Expand Down
2 changes: 1 addition & 1 deletion Detectors/ITSMFT/ITS/tracking/src/Cluster.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ namespace its
{

using math_utils::computePhi;
using math_utils::hypot;
using math_utils::getNormalizedPhi;
using math_utils::hypot;

Cluster::Cluster(const float x, const float y, const float z, const int index)
: xCoordinate{x},
Expand Down
24 changes: 16 additions & 8 deletions Detectors/ITSMFT/ITS/tracking/src/TimeFrame.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -286,29 +286,37 @@ void TimeFrame::initialise(const int iteration, const MemoryParameters& memParam
}
}

void TimeFrame::printTrackletLUTonLayer(int i) {
std::cout << "--------" << std::endl << "Tracklet LUT " << i << std::endl;
void TimeFrame::printTrackletLUTonLayer(int i)
{
std::cout << "--------" << std::endl
<< "Tracklet LUT " << i << std::endl;
for (int j : mTrackletsLookupTable[i]) {
std::cout << j << "\t";
}
std::cout << "\n--------" << std::endl << std::endl;
std::cout << "\n--------" << std::endl
<< std::endl;
}

void TimeFrame::printCellLUTonLayer(int i) {
std::cout << "--------" << std::endl << "Cell LUT " << i << std::endl;
void TimeFrame::printCellLUTonLayer(int i)
{
std::cout << "--------" << std::endl
<< "Cell LUT " << i << std::endl;
for (int j : mCellsLookupTable[i]) {
std::cout << j << "\t";
}
std::cout << "\n--------" << std::endl << std::endl;
std::cout << "\n--------" << std::endl
<< std::endl;
}

void TimeFrame::printTrackletLUTs() {
void TimeFrame::printTrackletLUTs()
{
for (unsigned int i{0}; i < mTrackletsLookupTable.size(); ++i) {
printTrackletLUTonLayer(i);
}
}

void TimeFrame::printCellLUTs() {
void TimeFrame::printCellLUTs()
{
for (unsigned int i{0}; i < mCellsLookupTable.size(); ++i) {
printCellLUTonLayer(i);
}
Expand Down
6 changes: 3 additions & 3 deletions Detectors/ITSMFT/ITS/tracking/src/TrackerTraitsCPU.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void TrackerTraitsCPU::computeLayerTracklets()
maxBinIndex < 0 || maxBinIndex > tf->getIndexTables(rof1)[iLayer].size()) {
std::cout << iLayer << "\t" << iCluster << "\t" << zAtRmin << "\t" << zAtRmax << "\t" << mTrkParams.TrackletMaxDeltaZ[iLayer] << "\t" << mTrkParams.TrackletMaxDeltaPhi << std::endl;
std::cout << currentCluster.zCoordinate << "\t" << primaryVertex.z << "\t" << currentCluster.radius << std::endl;
std::cout << tf->getMinR(iLayer + 1) << "\t" << currentCluster.radius << "\t" << currentCluster.zCoordinate << std::endl;
std::cout << tf->getMinR(iLayer + 1) << "\t" << currentCluster.radius << "\t" << currentCluster.zCoordinate << std::endl;
std::cout << "Illegal access to IndexTable " << firstBinIndex << "\t" << maxBinIndex << "\t" << selectedBinsRect.z << "\t" << selectedBinsRect.x << std::endl;
exit(1);
}
Expand Down Expand Up @@ -172,7 +172,7 @@ void TrackerTraitsCPU::computeLayerCells()
cellClus1R2 - cellClus0R2};

for (int iNextTracklet{nextLayerFirstTrackletIndex}; iNextTracklet < nextLayerLastTrackletIndex; ++iNextTracklet) {

if (tf->getTracklets()[iLayer + 1][iNextTracklet].firstClusterIndex != nextLayerClusterIndex) {
break;
}
Expand Down Expand Up @@ -201,7 +201,7 @@ void TrackerTraitsCPU::computeLayerCells()
tf->getClusters()[iLayer + 2][nextTracklet.secondClusterIndex]};

const float thirdCellClusterR2{thirdCellCluster.radius *
thirdCellCluster.radius};
thirdCellCluster.radius};

const float3 secondDeltaVector{thirdCellCluster.xCoordinate - cellClus0.xCoordinate,
thirdCellCluster.yCoordinate - cellClus0.yCoordinate,
Expand Down
4 changes: 2 additions & 2 deletions macro/run_trac_ca_its.C
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void run_trac_ca_its(bool cosmics = false,
gsl::span<const unsigned char> patt(patterns->data(), patterns->size());
auto pattIt = patt.begin();
auto clSpan = gsl::span(cclusters->data(), cclusters->size());

o2::its::TimeFrame tf;
tf.loadROFrameData(rofs, clSpan, pattIt, dict, labels);
pattIt = patt.begin();
Expand All @@ -270,7 +270,7 @@ void run_trac_ca_its(bool cosmics = false,
std::vector<Vertex> vertITS = vertexer.exportVertices();
std::vector<std::pair<float3, int>> tfVert;
for (const auto& vert : vertITS) {
tfVert.push_back(std::make_pair<float3,int>({vert.getX(), vert.getY(), vert.getZ()},vert.getNContributors()));
tfVert.push_back(std::make_pair<float3, int>({vert.getX(), vert.getY(), vert.getZ()}, vert.getNContributors()));
}
tf.addPrimaryVertices(tfVert);
auto& vtxROF = vertROFvec.emplace_back(rof); // register entry and number of vertices in the
Expand Down