Skip to content
Open
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 @@ -13,6 +13,9 @@
#define ALICEO2_NBODY_INDEX_H

#include "ReconstructionDataFormats/VtxTrackIndex.h"
#include <unordered_map>
#include <vector>
#include <utility>

namespace o2::dataformats
{
Expand Down Expand Up @@ -109,6 +112,21 @@ struct PoolRejRecord {
int vtID = 0; // primary vertex ID for which the track was considered
uint16_t rej = 0; // rejection bits

// key of the rejection map: (vertexID << 32) | GlobalTrackID.getRaw()
static uint64_t getPoolRejectionKey(o2::dataformats::GlobalTrackID gid, int iv)
{
return (uint64_t(iv) << 32) | uint64_t(gid.getRaw());
}

// inverse of getPoolRejectionKey: returns the track GID and the vertex ID
static std::pair<o2::dataformats::GlobalTrackID, int> rejectionKey2GidIv(uint64_t k)
{
o2::dataformats::GlobalTrackID gid;
gid.setRaw(static_cast<o2::dataformats::GlobalTrackID::Base_t>(k & 0xffffffff));
return {gid, int(k >> 32)};
}

static std::unordered_map<uint64_t, uint16_t> vector2map(const std::vector<o2::dataformats::PoolRejRecord>& v);
ClassDefNV(PoolRejRecord, 1);
};

Expand Down
11 changes: 11 additions & 0 deletions DataFormats/Reconstruction/src/DecayNBodyIndex.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,15 @@ namespace o2::dataformats
{
template class DecayNBodyIndex<2>;
template class DecayNBodyIndex<3>;

std::unordered_map<uint64_t, uint16_t> PoolRejRecord::vector2map(const std::vector<o2::dataformats::PoolRejRecord>& v)
{
std::unordered_map<uint64_t, uint16_t> mp;
mp.reserve(v.size());
for (const auto& r : v) {
mp[getPoolRejectionKey(r.gid, r.vtID)] |= r.rej;
}
return mp;
}

} // namespace o2::dataformats
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,9 @@
#include "Framework/CCDBParamSpec.h"
#include "ReconstructionDataFormats/Decay3Body.h"
#include "DataFormatsGlobalTracking/RecoContainer.h"
#include "ReconstructionDataFormats/TrackTPCITS.h"
#include "ReconstructionDataFormats/GlobalTrackID.h"
#include "DataFormatsTPC/TrackTPC.h"
#include "DataFormatsITS/TrackITS.h"
#include "DetectorsBase/Propagator.h"
#include "DetectorsBase/GeometryManager.h"
#include "GlobalTrackingWorkflow/SecondaryVertexingSpec.h"
#include "SimulationDataFormat/MCEventLabel.h"
#include "CommonUtils/NameConf.h"
#include "DetectorsVertexing/SVertexer.h"
#include "StrangenessTracking/StrangenessTracker.h"
Expand Down Expand Up @@ -122,7 +117,7 @@ void SecondaryVertexingSpec::run(ProcessingContext& pc)
auto& poolRej = pc.outputs().make<std::vector<o2d::PoolRejRecord>>(Output{"GLO", "SVREJPOOL", 0}, rejMap.size());
size_t irec = 0;
for (const auto& [key, rej] : rejMap) {
auto [gid, iv] = o2::vertexing::SVertexer::rejectionKey2GidIv(key);
auto [gid, iv] = o2d::PoolRejRecord::rejectionKey2GidIv(key);
auto& rec = poolRej[irec++];
rec.gid = gid;
rec.vtID = iv;
Expand Down
Loading