Conversation
| #include "DataFormatsITS/TrackITS.h" | ||
| #include "DataFormatsITSMFT/DPLAlpideParam.h" | ||
| #include "DataFormatsITSMFT/CompCluster.h" | ||
| #include "DataFormatsITSMFT/ROFRecord.h" | ||
| #include "DataFormatsITSMFT/TrkClusRef.h" | ||
| #include "DetectorsCommonDataFormats/DetID.h" |
There was a problem hiding this comment.
convert to fwd declarations
| struct ITSClusterReference { | ||
| int layer = -1; | ||
| int index = -1; | ||
| }; |
There was a problem hiding this comment.
Why is this needed? In the staggered mode the cluster index is already ((0x1<<28) + index_in_layer), the same can be extended to refs of the ITS-TPC AB.
| std::array<gsl::span<const o2::itsmft::ROFRecord>, NITSLayers> itsClustersROFRecordsPerLayer; | ||
| std::array<gsl::span<const o2::itsmft::CompClusterExt>, NITSLayers> itsClustersPerLayer; | ||
| std::array<gsl::span<const unsigned char>, NITSLayers> itsClustersPatternsPerLayer; |
There was a problem hiding this comment.
To avoid dependencies on headers, I would use here (implementing the same also for the MFT)
o2::dataformats::AbstractRefAccessor<3, MaxITSlayers> itsClusters; // [ROF/Clus/Patt][7 slots also for non-staggered]
o2::dataformats::AbstractRefAccessor<3, MaxMFTlayers> itsClusters; // [ROF/Clus/Patt][10 slots also for non-staggered]
and for the non-staggered case would just use the 1st slot (nominally layer 0)
Can also provide getters for span of spans (span per layer)
| auto getITSClusters() const | ||
| { | ||
| checkFlatITSClusterAccess(); | ||
| return getSpan<o2::itsmft::CompClusterExt>(GTrackID::ITS, CLUSTERS); | ||
| } |
There was a problem hiding this comment.
would remove these methods w/o layer arg., which would simply default to 0.
| return getSpan<unsigned char>(GTrackID::ITS, PATTERNS); | ||
| } | ||
| bool hasITSClustersPerLayer() const { return itsClustersPerLayerLoaded; } | ||
| auto getITSClustersROFRecords(int layer) const { return itsClustersROFRecordsPerLayer[layer]; } |
There was a problem hiding this comment.
i.e. simply
auto getITSClustersROFRecords(int layer=0) const {
return itsClustersROFRecordsPerLayer[layer];
}
| ITSClusterReference getITSClusterReference(const o2::its::TrackITS& track, gsl::span<const int> clusterRefs, int clusterOrdinal) const | ||
| { | ||
| const auto clusterEntry = track.getClusterEntry(clusterOrdinal); | ||
| const auto clusterIndex = clusterRefs[clusterEntry]; | ||
| if (!hasITSClustersPerLayer()) { | ||
| return {-1, clusterIndex}; | ||
| } | ||
| return {getClusterLayer(track.getPattern(), clusterOrdinal, true), clusterIndex}; | ||
| } | ||
| ITSClusterReference getITSClusterReference(const o2::itsmft::TrkClusRef& trackletRef, gsl::span<const int> clusterRefs, int clusterOrdinal) const | ||
| { | ||
| const auto clusterEntry = trackletRef.getFirstEntry() + clusterOrdinal; | ||
| const auto clusterIndex = clusterRefs[clusterEntry]; | ||
| if (!hasITSClustersPerLayer()) { | ||
| return {-1, clusterIndex}; | ||
| } | ||
| return {getClusterLayer(trackletRef.pattern, clusterOrdinal, false), clusterIndex}; | ||
| } | ||
| template <typename TrackSpan> | ||
| std::vector<int> makeFlatITSTrackClusterRefs(TrackSpan tracks, gsl::span<const int> clusterRefs, const std::array<int, NITSLayers>& layerOffsets) const | ||
| { | ||
| if (!hasITSClustersPerLayer()) { | ||
| return {}; | ||
| } | ||
| std::vector<int> flatRefs(clusterRefs.size()); | ||
| for (const auto& track : tracks) { | ||
| for (int iCluster = 0; iCluster < track.getNumberOfClusters(); ++iCluster) { | ||
| const auto ref = getITSClusterReference(track, clusterRefs, iCluster); | ||
| flatRefs[track.getClusterEntry(iCluster)] = layerOffsets[ref.layer] + ref.index; | ||
| } | ||
| } | ||
| return flatRefs; | ||
| } | ||
| template <typename TrackletRefSpan> | ||
| std::vector<int> makeFlatITSABClusterRefs(TrackletRefSpan trackletRefs, gsl::span<const int> clusterRefs, const std::array<int, NITSLayers>& layerOffsets) const | ||
| { | ||
| if (!hasITSClustersPerLayer()) { | ||
| return {}; | ||
| } | ||
| std::vector<int> flatRefs(clusterRefs.size()); |
There was a problem hiding this comment.
See above. the cluster ref already provides the layer and index within the layer, no need in additional flat structure.
| @@ -77,6 +77,8 @@ class AlignableDetectorITS : public AlignableDetector | |||
| protected: | |||
| // | |||
| std::vector<ClusterD> mITSClustersArray; | |||
There was a problem hiding this comment.
The code in the Align can be discarded. I am developing new MP code, at the moment in a separate git repo to minimise switches. Will take care of extending to staggered version later.
No description provided.