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
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,25 @@ class VertexerTraits
virtual bool usesMemoryPool() const noexcept { return true; }
void setMemoryPool(std::shared_ptr<BoundedMemoryResource>& pool) { mMemoryPool = pool; }

template <typename T = o2::MCCompLabel>
static std::pair<T, float> computeMain(const bounded_vector<T>& elements)
static std::pair<o2::MCCompLabel, float> computeMain(const bounded_vector<o2::MCCompLabel>& elements)
{
T elem;
// we only care about the source&event of the tracks, not the trackId
auto composeVtxLabel = [](const o2::MCCompLabel& lbl) -> o2::MCCompLabel {
return {o2::MCCompLabel::maxTrackID(), lbl.getEventID(), lbl.getSourceID(), lbl.isFake()};
};
std::unordered_map<o2::MCCompLabel, size_t> frequency;
for (const auto& element : elements) {
++frequency[composeVtxLabel(element)];
}
o2::MCCompLabel elem{};
size_t maxCount = 0;
for (auto& element : elements) {
size_t count = std::count(elements.begin(), elements.end(), element);
for (const auto& [key, count] : frequency) {
if (count > maxCount) {
maxCount = count;
elem = element;
elem = key;
}
}
return std::make_pair(elem, static_cast<float>(maxCount) / elements.size());
return std::make_pair(elem, static_cast<float>(maxCount) / static_cast<float>(elements.size()));
}

protected:
Expand Down
18 changes: 9 additions & 9 deletions Detectors/ITSMFT/ITS/tracking/src/VertexerTraits.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -506,18 +506,18 @@ void VertexerTraits::computeVertices(const int iteration)

if (beamDistance2 < nsigmaCut && o2::gpu::GPUCommonMath::Abs(mTimeFrame->getTrackletClusters(rofId)[iCluster].getVertex()[2]) < mVrtParams[iteration].maxZPositionAllowed) {
atLeastOneFound = true;
vertices.emplace_back(o2::math_utils::Point3D<float>(mTimeFrame->getTrackletClusters(rofId)[iCluster].getVertex()[0],
mTimeFrame->getTrackletClusters(rofId)[iCluster].getVertex()[1],
mTimeFrame->getTrackletClusters(rofId)[iCluster].getVertex()[2]),
mTimeFrame->getTrackletClusters(rofId)[iCluster].getRMS2(), // Symm matrix. Diagonal: RMS2 components,
// off-diagonal: square mean of projections on planes.
mTimeFrame->getTrackletClusters(rofId)[iCluster].getSize(), // Contributors
mTimeFrame->getTrackletClusters(rofId)[iCluster].getAvgDistance2()); // In place of chi2
auto& vertex = vertices.emplace_back(o2::math_utils::Point3D<float>(mTimeFrame->getTrackletClusters(rofId)[iCluster].getVertex()[0],
mTimeFrame->getTrackletClusters(rofId)[iCluster].getVertex()[1],
mTimeFrame->getTrackletClusters(rofId)[iCluster].getVertex()[2]),
mTimeFrame->getTrackletClusters(rofId)[iCluster].getRMS2(), // Symm matrix. Diagonal: RMS2 components,
// off-diagonal: square mean of projections on planes.
mTimeFrame->getTrackletClusters(rofId)[iCluster].getSize(), // Contributors
mTimeFrame->getTrackletClusters(rofId)[iCluster].getAvgDistance2()); // In place of chi2

if (iteration) {
vertices.back().setFlags(Vertex::UPCMode);
vertex.setFlags(Vertex::UPCMode);
}
vertices.back().setTimeStamp(mTimeFrame->getTrackletClusters(rofId)[iCluster].getROF());
vertex.setTimeStamp(mTimeFrame->getTrackletClusters(rofId)[iCluster].getROF());
if (mTimeFrame->hasMCinformation()) {
bounded_vector<o2::MCCompLabel> labels(mMemoryPool.get());
for (auto& index : mTimeFrame->getTrackletClusters(rofId)[iCluster].getLabels()) {
Expand Down