Skip to content

Adapt global reco code to ITS per layer stream of clusters - #55

Open
shahor02 wants to merge 1 commit into
shahor02:devfrom
mpuccio:reco_container
Open

shahor02 wants to merge 1 commit into
shahor02:devfrom
mpuccio:reco_container

Conversation

@shahor02

Copy link
Copy Markdown
Owner

No description provided.

@shahor02 shahor02 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +29 to +34
#include "DataFormatsITS/TrackITS.h"
#include "DataFormatsITSMFT/DPLAlpideParam.h"
#include "DataFormatsITSMFT/CompCluster.h"
#include "DataFormatsITSMFT/ROFRecord.h"
#include "DataFormatsITSMFT/TrkClusRef.h"
#include "DetectorsCommonDataFormats/DetID.h"

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

convert to fwd declarations

Comment on lines +337 to +340
struct ITSClusterReference {
int layer = -1;
int index = -1;
};

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +349 to +351
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;

@shahor02 shahor02 Sep 27, 2026 •

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Comment on lines +526 to +530
auto getITSClusters() const
{
checkFlatITSClusterAccess();
return getSpan<o2::itsmft::CompClusterExt>(GTrackID::ITS, CLUSTERS);
}

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]; }

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.e. simply

auto getITSClustersROFRecords(int layer=0) const {   
  return itsClustersROFRecordsPerLayer[layer]; 
}

Comment on lines +558 to +597
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());

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants