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 @@ -187,11 +187,22 @@ namespace o2
namespace globaltracking
{

// max number of layers for which the ITS/MFT clusters, ROF records and patterns can be provided separately
constexpr int MaxITSLayers = 7;
constexpr int MaxMFTLayers = 10;

// helper class to request DPL input data from the processor specs definition
struct DataRequest {
std::vector<o2::framework::InputSpec> inputs;
std::unordered_map<std::string, bool> requestMap;
MatchingType matchingInputType = MatchingType::Standard; // use subspec = 0 for inputs
bool ITSPerLayer = false; // ITS clusters, ROFs and patterns are provided per layer
bool MFTPerLayer = false; // MFT clusters, ROFs and patterns are provided per layer

auto getITSPerLayer() const { return ITSPerLayer; }
auto getMFTPerLayer() const { return MFTPerLayer; }
void setITSPerLayer(bool v = true);
void setMFTPerLayer(bool v = true);

auto getMatchingInputType() const { return matchingInputType; }
void setMatchingInputStrict() { matchingInputType = MatchingType::Strict; }
Expand Down Expand Up @@ -314,11 +325,19 @@ struct RecoContainer {
COSM_TRACKS_MC,
NCOSMSLOTS };

// slots to register ITS/MFT clusters data (per layer, or all layers together in the slot 0)
enum ITSMFTClusSlots { ITSMFT_ROF, // ROF records
ITSMFT_CLS, // compact clusters
ITSMFT_PAT, // cluster patterns
NITSMFTCLUSSLOTS };

using AccSlots = o2::dataformats::AbstractRefAccessor<int, NCOMMONSLOTS>; // int here is a dummy placeholder
using PVertexAccessor = o2::dataformats::AbstractRefAccessor<int, NPVTXSLOTS>;
using SVertexAccessor = o2::dataformats::AbstractRefAccessor<int, NSVTXSLOTS>;
using STrackAccessor = o2::dataformats::AbstractRefAccessor<int, NSTRKSLOTS>;
using CosmicsAccessor = o2::dataformats::AbstractRefAccessor<int, NCOSMSLOTS>;
using ITSClusAccessor = o2::dataformats::AbstractRefAccessor<int, MaxITSLayers>;
using MFTClusAccessor = o2::dataformats::AbstractRefAccessor<int, MaxMFTLayers>;
using GTrackID = o2::dataformats::GlobalTrackID;
using GlobalIDSet = std::array<GTrackID, GTrackID::NSources>;

Expand All @@ -332,7 +351,14 @@ struct RecoContainer {
STrackAccessor strkPool; // containers for strangeness tracking related objects
CosmicsAccessor cosmPool; // containers for cosmics track data

std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::MCCompLabel>> mcITSClusters;
bool ITSPerLayer = false; // ITS clusters, ROFs and patterns are provided per layer
bool MFTPerLayer = false; // MFT clusters, ROFs and patterns are provided per layer

std::array<ITSClusAccessor, NITSMFTCLUSSLOTS> ITSClustersData; // [ROF/Clus/Patt][MaxITSLayers slots, non-staggered == 0]
std::array<MFTClusAccessor, NITSMFTCLUSSLOTS> MFTClustersData; // [ROF/Clus/Patt][MaxMFTLayers slots, non-staggered == 0]

std::array<std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::MCCompLabel>>, MaxITSLayers> mcITSClusters;
std::array<std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::MCCompLabel>>, MaxMFTLayers> mcMFTClusters;
std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::MCCompLabel>> mcTOFClusters;
std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::MCCompLabel>> mcHMPClusters;
std::unique_ptr<const o2::dataformats::MCTruthContainer<o2::MCCompLabel>> mcCPVClusters;
Expand All @@ -350,6 +376,9 @@ struct RecoContainer {
std::unique_ptr<o2::tpc::internal::getWorkflowTPCInput_ret> inputsTPCclusters; // special struct for TPC clusters access
std::unique_ptr<o2::trd::RecoInputContainer> inputsTRD; // special struct for TRD tracklets, trigger records

auto getITSPerLayer() const { return ITSPerLayer; }
auto getMFTPerLayer() const { return MFTPerLayer; }

void collectData(o2::framework::ProcessingContext& pc, const DataRequest& request);
void createTracks(std::function<bool(const o2::track::TrackParCov&, GTrackID)> const& creator) const;
template <class T>
Expand Down Expand Up @@ -497,11 +526,11 @@ struct RecoContainer {
auto getITSABClusterRefs() const { return getSpan<int>(GTrackID::ITSAB, INDICES); }
auto getITSABMCLabels() const { return getSpan<o2::MCCompLabel>(GTrackID::ITSAB, MCLABELS); }

// ITS clusters
auto getITSClustersROFRecords() const { return getSpan<o2::itsmft::ROFRecord>(GTrackID::ITS, CLUSREFS); }
auto getITSClusters() const { return getSpan<o2::itsmft::CompClusterExt>(GTrackID::ITS, CLUSTERS); }
auto getITSClustersPatterns() const { return getSpan<unsigned char>(GTrackID::ITS, PATTERNS); }
auto getITSClustersMCLabels() const { return mcITSClusters.get(); }
// ITS clusters (layer is ignored unless the data was provided per layer)
auto getITSClustersROFRecords(int layer = 0) const { return ITSClustersData[ITSMFT_ROF].getSpan<o2::itsmft::ROFRecord>(layer); }
auto getITSClusters(int layer = 0) const { return ITSClustersData[ITSMFT_CLS].getSpan<o2::itsmft::CompClusterExt>(layer); }
auto getITSClustersPatterns(int layer = 0) const { return ITSClustersData[ITSMFT_PAT].getSpan<unsigned char>(layer); }
auto getITSClustersMCLabels(int layer = 0) const { return mcITSClusters[layer].get(); }

// MFT
const o2::mft::TrackMFT& getMFTTrack(GTrackID gid) const { return getTrack<o2::mft::TrackMFT>(gid); }
Expand All @@ -510,10 +539,11 @@ struct RecoContainer {
auto getMFTTracksClusterRefs() const { return getSpan<int>(GTrackID::MFT, INDICES); }
auto getMFTTracksMCLabels() const { return getSpan<o2::MCCompLabel>(GTrackID::MFT, MCLABELS); }

// MFT clusters
auto getMFTClustersROFRecords() const { return getSpan<o2::itsmft::ROFRecord>(GTrackID::MFT, CLUSREFS); }
auto getMFTClusters() const { return getSpan<o2::itsmft::CompClusterExt>(GTrackID::MFT, CLUSTERS); }
auto getMFTClustersPatterns() const { return getSpan<unsigned char>(GTrackID::MFT, PATTERNS); }
// MFT clusters (layer is ignored unless the data was provided per layer)
auto getMFTClustersROFRecords(int layer = 0) const { return MFTClustersData[ITSMFT_ROF].getSpan<o2::itsmft::ROFRecord>(layer); }
auto getMFTClusters(int layer = 0) const { return MFTClustersData[ITSMFT_CLS].getSpan<o2::itsmft::CompClusterExt>(layer); }
auto getMFTClustersPatterns(int layer = 0) const { return MFTClustersData[ITSMFT_PAT].getSpan<unsigned char>(layer); }
auto getMFTClustersMCLabels(int layer = 0) const { return mcMFTClusters[layer].get(); }

// MCH
const o2::mch::TrackMCH& getMCHTrack(GTrackID gid) const { return getTrack<o2::mch::TrackMCH>(gid); }
Expand Down
102 changes: 69 additions & 33 deletions DataFormats/Detectors/GlobalTracking/src/RecoContainer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@ using DetID = o2::detectors::DetID;
RecoContainer::RecoContainer() = default;
RecoContainer::~RecoContainer() = default;

void DataRequest::setITSPerLayer(bool v)
{
if (requestMap.find("clusITS") != requestMap.end()) {
LOGP(fatal, "setITSPerLayer must be called before request ITS clusters");
}
ITSPerLayer = v;
}

void DataRequest::setMFTPerLayer(bool v)
{
if (requestMap.find("clusMFT") != requestMap.end()) {
LOGP(fatal, "setMFTPerLayer must be called before requesting MFT clusters");
}
MFTPerLayer = v;
}
void DataRequest::addInput(const InputSpec&& isp)
{
if (std::find(inputs.begin(), inputs.end(), isp) == inputs.end()) {
Expand Down Expand Up @@ -228,42 +243,51 @@ void DataRequest::requestTOFMatches(o2::dataformats::GlobalTrackID::mask_t src,

void DataRequest::requestITSClusters(bool mc)
{
addInput({"clusITS", "ITS", "COMPCLUSTERS", 0, Lifetime::Timeframe});
addInput({"clusITSPatt", "ITS", "PATTERNS", 0, Lifetime::Timeframe});
addInput({"clusITSROF", "ITS", "CLUSTERSROF", 0, Lifetime::Timeframe});
addInput({"alpparITS", "ITS", "ALPIDEPARAM", 0, Lifetime::Condition, ccdbParamSpec("ITS/Config/AlpideParam")});
if (mc) {
addInput({"clusITSMC", "ITS", "CLUSTERSMCTR", 0, Lifetime::Timeframe});
uint16_t nInp = ITSPerLayer ? MaxITSLayers : 1;
for (uint16_t il = 0; il < nInp; ++il) {
addInput({"clusITS" + std::to_string(il), "ITS", "COMPCLUSTERS", il, Lifetime::Timeframe});
addInput({"clusITSPatt" + std::to_string(il), "ITS", "PATTERNS", il, Lifetime::Timeframe});
addInput({"clusITSROF" + std::to_string(il), "ITS", "CLUSTERSROF", il, Lifetime::Timeframe});
if (mc) {
addInput({"clusITSMC" + std::to_string(il), "ITS", "CLUSTERSMCTR", il, Lifetime::Timeframe});
}
}
addInput({"alpparITS", "ITS", "ALPIDEPARAM", 0, Lifetime::Condition, ccdbParamSpec("ITS/Config/AlpideParam")});
addInput({"cldictITS", "ITS", "CLUSDICT", 0, Lifetime::Condition, ccdbParamSpec("ITS/Calib/ClusterDictionary")});
requestMap["clusITS"] = mc;
}

#ifdef ENABLE_UPGRADES
void DataRequest::requestIT3Clusters(bool mc)
{
addInput({"clusITS", "ITS", "COMPCLUSTERS", 0, Lifetime::Timeframe});
addInput({"clusITSPatt", "ITS", "PATTERNS", 0, Lifetime::Timeframe});
addInput({"clusITSROF", "ITS", "CLUSTERSROF", 0, Lifetime::Timeframe});
addInput({"alpparITS", "ITS", "ALPIDEPARAM", 0, Lifetime::Condition, ccdbParamSpec("ITS/Config/AlpideParam")});
if (mc) {
addInput({"clusITSMC", "ITS", "CLUSTERSMCTR", 0, Lifetime::Timeframe});
uint16_t nInp = ITSPerLayer ? MaxITSLayers : 1;
for (uint16_t il = 0; il < nInp; ++il) {
addInput({"clusITS" + std::to_string(il), "ITS", "COMPCLUSTERS", il, Lifetime::Timeframe});
addInput({"clusITSPatt" + std::to_string(il), "ITS", "PATTERNS", il, Lifetime::Timeframe});
addInput({"clusITSROF" + std::to_string(il), "ITS", "CLUSTERSROF", il, Lifetime::Timeframe});
if (mc) {
addInput({"clusITSMC" + std::to_string(il), "ITS", "CLUSTERSMCTR", il, Lifetime::Timeframe});
}
}
addInput({"alpparITS", "ITS", "ALPIDEPARAM", 0, Lifetime::Condition, ccdbParamSpec("ITS/Config/AlpideParam")});
addInput({"cldictIT3", "IT3", "CLUSDICT", 0, Lifetime::Condition, ccdbParamSpec("IT3/Calib/ClusterDictionary")});
requestMap["clusIT3"] = mc;
}
#endif

void DataRequest::requestMFTClusters(bool mc)
{
addInput({"clusMFT", "MFT", "COMPCLUSTERS", 0, Lifetime::Timeframe});
addInput({"clusMFTPatt", "MFT", "PATTERNS", 0, Lifetime::Timeframe});
addInput({"clusMFTROF", "MFT", "CLUSTERSROF", 0, Lifetime::Timeframe});
uint16_t nInp = MFTPerLayer ? MaxMFTLayers : 1;
for (uint16_t il = 0; il < nInp; ++il) {
addInput({"clusMFT" + std::to_string(il), "MFT", "COMPCLUSTERS", il, Lifetime::Timeframe});
addInput({"clusMFTPatt" + std::to_string(il), "MFT", "PATTERNS", il, Lifetime::Timeframe});
addInput({"clusMFTROF" + std::to_string(il), "MFT", "CLUSTERSROF", il, Lifetime::Timeframe});
if (mc) {
addInput({"clusMFTMC" + std::to_string(il), "MFT", "CLUSTERSMCTR", il, Lifetime::Timeframe});
}
}
addInput({"cldictMFT", "MFT", "CLUSDICT", 0, Lifetime::Condition, ccdbParamSpec("MFT/Calib/ClusterDictionary")});
addInput({"alpparMFT", "MFT", "ALPIDEPARAM", 0, Lifetime::Condition, ccdbParamSpec("MFT/Config/AlpideParam")});
if (mc) {
addInput({"clusMFTMC", "MFT", "CLUSTERSMCTR", 0, Lifetime::Timeframe});
}
requestMap["clusMFT"] = mc;
}

Expand Down Expand Up @@ -616,6 +640,9 @@ void RecoContainer::collectData(ProcessingContext& pc, const DataRequest& reques
{
auto& reqMap = requests.requestMap;

ITSPerLayer = requests.getITSPerLayer();
MFTPerLayer = requests.getMFTPerLayer();

startIR = {0, pc.services().get<o2::framework::TimingInfo>().firstTForbit};

auto req = reqMap.find("trackITS");
Expand Down Expand Up @@ -1074,11 +1101,14 @@ void RecoContainer::addITSClusters(ProcessingContext& pc, bool mc)
pc.inputs().get<o2::itsmft::TopologyDictionary*>("cldictITS"); // just to trigger the finaliseCCDB
pc.inputs().get<o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>*>("alpparITS"); // note: configurable param does not need finaliseCCDB
}
commonPool[GTrackID::ITS].registerContainer(pc.inputs().get<gsl::span<o2::itsmft::ROFRecord>>("clusITSROF"), CLUSREFS);
commonPool[GTrackID::ITS].registerContainer(pc.inputs().get<gsl::span<o2::itsmft::CompClusterExt>>("clusITS"), CLUSTERS);
commonPool[GTrackID::ITS].registerContainer(pc.inputs().get<gsl::span<unsigned char>>("clusITSPatt"), PATTERNS);
if (mc) {
mcITSClusters = pc.inputs().get<const dataformats::MCTruthContainer<MCCompLabel>*>("clusITSMC");
uint16_t nInp = ITSPerLayer ? MaxITSLayers : 1;
for (uint16_t il = 0; il < nInp; ++il) {
ITSClustersData[ITSMFT_ROF].registerContainer(pc.inputs().get<gsl::span<o2::itsmft::ROFRecord>>("clusITSROF" + std::to_string(il)), il);
ITSClustersData[ITSMFT_CLS].registerContainer(pc.inputs().get<gsl::span<o2::itsmft::CompClusterExt>>("clusITS" + std::to_string(il)), il);
ITSClustersData[ITSMFT_PAT].registerContainer(pc.inputs().get<gsl::span<unsigned char>>("clusITSPatt" + std::to_string(il)), il);
if (mc) {
mcITSClusters[il] = pc.inputs().get<const dataformats::MCTruthContainer<MCCompLabel>*>("clusITSMC" + std::to_string(il));
}
}
}

Expand All @@ -1089,11 +1119,14 @@ void RecoContainer::addIT3Clusters(ProcessingContext& pc, bool mc)
pc.inputs().get<o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>*>("alpparITS"); // note: configurable param does not need finaliseCCDB
pc.inputs().get<o2::its3::TopologyDictionary*>("cldictIT3"); // just to trigger the finaliseCCDB
}
commonPool[GTrackID::ITS].registerContainer(pc.inputs().get<gsl::span<o2::itsmft::ROFRecord>>("clusITSROF"), CLUSREFS);
commonPool[GTrackID::ITS].registerContainer(pc.inputs().get<gsl::span<o2::itsmft::CompClusterExt>>("clusITS"), CLUSTERS);
commonPool[GTrackID::ITS].registerContainer(pc.inputs().get<gsl::span<unsigned char>>("clusITSPatt"), PATTERNS);
if (mc) {
mcITSClusters = pc.inputs().get<const dataformats::MCTruthContainer<MCCompLabel>*>("clusITSMC");
uint16_t nInp = ITSPerLayer ? MaxITSLayers : 1;
for (uint16_t il = 0; il < nInp; ++il) {
ITSClustersData[ITSMFT_ROF].registerContainer(pc.inputs().get<gsl::span<o2::itsmft::ROFRecord>>("clusITSROF" + std::to_string(il)), il);
ITSClustersData[ITSMFT_CLS].registerContainer(pc.inputs().get<gsl::span<o2::itsmft::CompClusterExt>>("clusITS" + std::to_string(il)), il);
ITSClustersData[ITSMFT_PAT].registerContainer(pc.inputs().get<gsl::span<unsigned char>>("clusITSPatt" + std::to_string(il)), il);
if (mc) {
mcITSClusters[il] = pc.inputs().get<const dataformats::MCTruthContainer<MCCompLabel>*>("clusITSMC" + std::to_string(il));
}
}
}
#endif
Expand All @@ -1105,11 +1138,14 @@ void RecoContainer::addMFTClusters(ProcessingContext& pc, bool mc)
pc.inputs().get<o2::itsmft::TopologyDictionary*>("cldictMFT"); // just to trigger the finaliseCCDB
pc.inputs().get<o2::itsmft::DPLAlpideParam<o2::detectors::DetID::MFT>*>("alpparMFT"); // note: configurable param does not need finaliseCCDB
}
commonPool[GTrackID::MFT].registerContainer(pc.inputs().get<gsl::span<o2::itsmft::ROFRecord>>("clusMFTROF"), CLUSREFS);
commonPool[GTrackID::MFT].registerContainer(pc.inputs().get<gsl::span<o2::itsmft::CompClusterExt>>("clusMFT"), CLUSTERS);
commonPool[GTrackID::MFT].registerContainer(pc.inputs().get<gsl::span<unsigned char>>("clusMFTPatt"), PATTERNS);
if (mc) {
mcITSClusters = pc.inputs().get<const dataformats::MCTruthContainer<MCCompLabel>*>("clusMFTMC");
uint16_t nInp = MFTPerLayer ? MaxMFTLayers : 1;
for (uint16_t il = 0; il < nInp; ++il) {
MFTClustersData[ITSMFT_ROF].registerContainer(pc.inputs().get<gsl::span<o2::itsmft::ROFRecord>>("clusMFTROF" + std::to_string(il)), il);
MFTClustersData[ITSMFT_CLS].registerContainer(pc.inputs().get<gsl::span<o2::itsmft::CompClusterExt>>("clusMFT" + std::to_string(il)), il);
MFTClustersData[ITSMFT_PAT].registerContainer(pc.inputs().get<gsl::span<unsigned char>>("clusMFTPatt" + std::to_string(il)), il);
if (mc) {
mcMFTClusters[il] = pc.inputs().get<const dataformats::MCTruthContainer<MCCompLabel>*>("clusMFTMC" + std::to_string(il));
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion Detectors/GlobalTracking/src/MatchTPCITS.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ bool MatchTPCITS::prepareITSData()
}

if (mMCTruthON) {
mITSClsLabels = inp.mcITSClusters.get();
mITSClsLabels = inp.getITSClustersMCLabels();
}

// ITS tracks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ bool StrangenessTracker::loadData(const o2::globaltracking::RecoContainer& recoD
}

if (mMCTruthON) {
mITSClsLabels = recoData.mcITSClusters.get();
mITSClsLabels = recoData.getITSClustersMCLabels();
mITSTrkLabels = recoData.getITSTracksMCLabels();
}

Expand Down
2 changes: 1 addition & 1 deletion GPU/Workflow/helper/src/GPUWorkflowHelper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ std::shared_ptr<const GPUWorkflowHelper::tmpDataContainer> GPUWorkflowHelper::fi
ioPtr.nItsClusterROF = ITSClusterROFRec.size();
ioPtr.itsClusterROF = ITSClusterROFRec.data();
if (useMC) {
const auto& ITSClsLabels = recoCont.mcITSClusters.get();
const auto* ITSClsLabels = recoCont.getITSClustersMCLabels();
ioPtr.itsClusterMC = ITSClsLabels;
}
}
Expand Down
Loading