|
| 1 | +// Copyright CERN and copyright holders of ALICE O2. This software is |
| 2 | +// distributed under the terms of the GNU General Public License v3 (GPL |
| 3 | +// Version 3), copied verbatim in the file "COPYING". |
| 4 | +// |
| 5 | +// See http://alice-o2.web.cern.ch/license for full licensing information. |
| 6 | +// |
| 7 | +// In applying this license CERN does not waive the privileges and immunities |
| 8 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 9 | +// or submit itself to any jurisdiction. |
| 10 | + |
| 11 | +#include "GPUWorkflowHelper/GPUWorkflowHelper.h" |
| 12 | +#include "ITStracking/IOUtils.h" |
| 13 | +using namespace o2::globaltracking; |
| 14 | +using namespace o2::gpu; |
| 15 | + |
| 16 | +struct GPUWorkflowHelper::tmpDataContainer { |
| 17 | + std::vector<o2::BaseCluster<float>> ITSClustersArray; |
| 18 | +}; |
| 19 | + |
| 20 | +std::unique_ptr<const GPUWorkflowHelper::tmpDataContainer> GPUWorkflowHelper::fillIOPtr(GPUTrackingInOutPointers& ioPtr, const o2::globaltracking::RecoContainer& recoCont, const GPUCalibObjectsConst* calib, o2::dataformats::GlobalTrackID::mask_t maskCl, o2::dataformats::GlobalTrackID::mask_t maskTrk, o2::dataformats::GlobalTrackID::mask_t maskMatch) |
| 21 | +{ |
| 22 | + auto retVal = std::make_unique<tmpDataContainer>(); |
| 23 | + |
| 24 | + if (maskCl[GID::ITS] && ioPtr.nItsClusters == 0) { |
| 25 | + const auto& ITSClusterROFRec = recoCont.getITSClustersROFRecords<o2::itsmft::ROFRecord>(); |
| 26 | + const auto& clusITS = recoCont.getITSClusters<o2::itsmft::CompClusterExt>(); |
| 27 | + if (clusITS.size() && ITSClusterROFRec.size()) { |
| 28 | + if (calib && calib->itsPatternDict) { |
| 29 | + const auto& patterns = recoCont.getITSClustersPatterns(); |
| 30 | + auto pattIt = patterns.begin(); |
| 31 | + retVal->ITSClustersArray.reserve(clusITS.size()); |
| 32 | + o2::its::ioutils::convertCompactClusters(clusITS, pattIt, retVal->ITSClustersArray, *calib->itsPatternDict); |
| 33 | + ioPtr.itsClusters = retVal->ITSClustersArray.data(); |
| 34 | + } |
| 35 | + const auto& ITSClsLabels = recoCont.mcITSClusters.get(); |
| 36 | + ioPtr.nItsClusters = clusITS.size(); |
| 37 | + ioPtr.itsCompClusters = clusITS.data(); |
| 38 | + ioPtr.nItsClusterROF = ITSClusterROFRec.size(); |
| 39 | + ioPtr.itsClusterROF = ITSClusterROFRec.data(); |
| 40 | + ioPtr.itsClusterMC = ITSClsLabels; |
| 41 | + } |
| 42 | + } |
| 43 | + if (maskTrk[GID::ITS] && ioPtr.nItsTracks == 0) { |
| 44 | + const auto& ITSTracksArray = recoCont.getITSTracks<o2::its::TrackITS>(); |
| 45 | + const auto& ITSTrackROFRec = recoCont.getITSTracksROFRecords<o2::itsmft::ROFRecord>(); |
| 46 | + if (ITSTracksArray.size() && ITSTrackROFRec.size()) { |
| 47 | + const auto& ITSTrackClusIdx = recoCont.getITSTracksClusterRefs(); |
| 48 | + const auto& ITSTrkLabels = recoCont.getITSTracksMCLabels(); |
| 49 | + ioPtr.nItsTracks = ITSTracksArray.size(); |
| 50 | + ioPtr.itsTracks = ITSTracksArray.data(); |
| 51 | + ioPtr.itsTrackClusIdx = ITSTrackClusIdx.data(); |
| 52 | + ioPtr.nItsTrackROF = ITSTrackROFRec.size(); |
| 53 | + ioPtr.itsTrackROF = ITSTrackROFRec.data(); |
| 54 | + ioPtr.itsTrackMC = ITSTrkLabels.data(); |
| 55 | + } |
| 56 | + } |
| 57 | + |
| 58 | + if (maskTrk[GID::ITSTPC] && ioPtr.nTracksTPCITSO2 == 0) { |
| 59 | + const auto& trkITSTPC = recoCont.getTPCITSTracks<o2d::TrackTPCITS>(); |
| 60 | + if (trkITSTPC.size()) { |
| 61 | + ioPtr.nTracksTPCITSO2 = trkITSTPC.size(); |
| 62 | + ioPtr.tracksTPCITS = trkITSTPC.data(); |
| 63 | + } |
| 64 | + } |
| 65 | + |
| 66 | + if (maskCl[GID::TOF] && ioPtr.nTOFClusters == 0) { |
| 67 | + const auto& tofClusters = recoCont.getTOFClusters<o2::tof::Cluster>(); |
| 68 | + if (tofClusters.size()) { |
| 69 | + ioPtr.nTOFClusters = tofClusters.size(); |
| 70 | + ioPtr.tofClusters = tofClusters.data(); |
| 71 | + } |
| 72 | + } |
| 73 | + |
| 74 | + if (maskMatch[GID::TOF] && ioPtr.nTOFMatches == 0) { |
| 75 | + const auto& tofMatches = recoCont.getTOFMatches<o2::dataformats::MatchInfoTOF>(); |
| 76 | + if (tofMatches.size()) { |
| 77 | + ioPtr.nTOFMatches = tofMatches.size(); |
| 78 | + ioPtr.tofMatches = tofMatches.data(); |
| 79 | + } |
| 80 | + } |
| 81 | + |
| 82 | + if (maskMatch[GID::TPCTOF] && ioPtr.nTPCTOFMatches == 0) { |
| 83 | + const auto& tpctofMatches = recoCont.getTPCTOFMatches<o2::dataformats::MatchInfoTOF>(); |
| 84 | + if (tpctofMatches.size()) { |
| 85 | + ioPtr.nTPCTOFMatches = tpctofMatches.size(); |
| 86 | + ioPtr.tpctofMatches = tpctofMatches.data(); |
| 87 | + } |
| 88 | + } |
| 89 | + |
| 90 | + return std::move(retVal); |
| 91 | +} |
0 commit comments