Skip to content

Commit 1d67b84

Browse files
committed
Refer ITS track cluster indices to TF start rather than ROF
Storing indices of ITS cluster indices attached to tracks wrt ROF start creates extra overheads when we need to fetch/refit clusters of particular track. All workflows are changed to store cluster indices wrt TF start.
1 parent 9e6c9a5 commit 1d67b84

5 files changed

Lines changed: 11 additions & 17 deletions

File tree

Detectors/GlobalTracking/include/GlobalTracking/MatchTPCITS.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ class MatchTPCITS
413413
int preselectChipClusters(std::vector<int>& clVecOut, const ClusRange& clRange, const ITSChipClustersRefs& itsChipClRefs,
414414
float trackY, float trackZ, float tolerY, float tolerZ) const;
415415
void fillClustersForAfterBurner(int rofStart, int nROFs, ITSChipClustersRefs& itsChipClRefs);
416-
void flagUsedITSClusters(const o2::its::TrackITS& track, int rofOffset);
416+
void flagUsedITSClusters(const o2::its::TrackITS& track);
417417

418418
void doMatching(int sec);
419419

Detectors/GlobalTracking/src/MatchCosmics.cxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,8 @@ void MatchCosmics::refitWinners(const o2::globaltracking::RecoContainer& data)
114114
auto refitITSTrack = [this, &data, &itsTracksROF, &itsClusters](o2::track::TrackParCov& trFit, GTrackID gidx, float& chi2, bool inward = false) {
115115
const auto& itsTrOrig = data.getITSTrack(gidx);
116116
int nclRefit = 0, ncl = itsTrOrig.getNumberOfClusters(), rof = itsTracksROF[gidx.getIndex()];
117-
const auto& itsClustersROFRec = data.getITSClustersROFRecords();
118117
const auto& itsTrackClusRefs = data.getITSTracksClusterRefs();
119-
int clusIndOffs = itsClustersROFRec[rof].getFirstEntry(), clEntry = itsTrOrig.getFirstClusterEntry();
118+
int clEntry = itsTrOrig.getFirstClusterEntry();
120119
const auto propagator = o2::base::Propagator::Instance();
121120
const auto geomITS = o2::its::GeometryTGeo::Instance();
122121
int from = ncl - 1, to = -1, step = -1;
@@ -126,7 +125,7 @@ void MatchCosmics::refitWinners(const o2::globaltracking::RecoContainer& data)
126125
step = 1;
127126
}
128127
for (int icl = from; icl != to; icl += step) { // ITS clusters are referred in layer decreasing order
129-
const auto& clus = itsClusters[clusIndOffs + itsTrackClusRefs[clEntry + icl]];
128+
const auto& clus = itsClusters[itsTrackClusRefs[clEntry + icl]];
130129
float alpha = geomITS->getSensorRefAlpha(clus.getSensorID()), x = clus.getX();
131130
if (!trFit.rotate(alpha) || !propagator->propagateToX(trFit, x, propagator->getNominalBz(), this->mMatchParams->maxSnp, this->mMatchParams->maxStep, this->mMatchParams->matCorr)) {
132131
break;

Detectors/GlobalTracking/src/MatchTPCITS.cxx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,6 @@ bool MatchTPCITS::prepareITSData()
569569
mITSTrackROFContMapping[irofCont] = irof;
570570
}
571571

572-
int cluROFOffset = mITSClusterROFRec[irof].getFirstEntry(); // clusters of this ROF start at this offset
573572
mITSROFTimes.emplace_back(tMin, tMax); // ITS ROF min/max time
574573

575574
for (int sec = o2::constants::math::NSectors; sec--;) { // start of sector's tracks for this ROF
@@ -580,7 +579,7 @@ bool MatchTPCITS::prepareITSData()
580579
for (int it = rofRec.getFirstEntry(); it < trlim; it++) {
581580
const auto& trcOrig = mITSTracksArray[it];
582581
if (mParams->runAfterBurner) {
583-
flagUsedITSClusters(trcOrig, cluROFOffset);
582+
flagUsedITSClusters(trcOrig);
584583
}
585584
if (trcOrig.getParamOut().getX() < 1.) {
586585
continue; // backward refit failed
@@ -1233,9 +1232,6 @@ bool MatchTPCITS::refitTrackTPCITS(int iTPC, int& iITS)
12331232
float chi2 = 0.f;
12341233
auto geom = o2::its::GeometryTGeo::Instance();
12351234
auto propagator = o2::base::Propagator::Instance();
1236-
// NOTE: the ITS cluster index is stored wrt 1st cluster of relevant ROF, while here we extract clusters from the
1237-
// buffer for the whole TF. Therefore, we should shift the index by the entry of the ROF's 1st cluster in the global cluster buffer
1238-
int clusIndOffs = mITSClusterROFRec[tITS.roFrame].getFirstEntry();
12391235
int clEntry = itsTrOrig.getFirstClusterEntry();
12401236

12411237
float addErr2 = 0;
@@ -1247,7 +1243,7 @@ bool MatchTPCITS::refitTrackTPCITS(int iTPC, int& iITS)
12471243
}
12481244

12491245
for (int icl = 0; icl < ncl; icl++) {
1250-
const auto& clus = mITSClustersArray[clusIndOffs + mITSTrackClusIdx[clEntry++]];
1246+
const auto& clus = mITSClustersArray[mITSTrackClusIdx[clEntry++]];
12511247
float alpha = geom->getSensorRefAlpha(clus.getSensorID()), x = clus.getX();
12521248
if (!trfit.rotate(alpha) ||
12531249
// note: here we also calculate the L,T integral (in the inward direction, but this is irrelevant)
@@ -2205,12 +2201,12 @@ void MatchTPCITS::removeITSfromTPC(int itsID, int tpcID)
22052201
}
22062202

22072203
//______________________________________________
2208-
void MatchTPCITS::flagUsedITSClusters(const o2::its::TrackITS& track, int rofOffset)
2204+
void MatchTPCITS::flagUsedITSClusters(const o2::its::TrackITS& track)
22092205
{
22102206
// flag clusters used by this track
22112207
int clEntry = track.getFirstClusterEntry();
22122208
for (int icl = track.getNumberOfClusters(); icl--;) {
2213-
mABClusterLinkIndex[rofOffset + mITSTrackClusIdx[clEntry++]] = MinusTen;
2209+
mABClusterLinkIndex[mITSTrackClusIdx[clEntry++]] = MinusTen;
22142210
}
22152211
}
22162212

Detectors/ITSMFT/ITS/reconstruction/include/ITSReconstruction/CookedTracker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class CookedTracker
8989
for (int i = 0; i < noc; i++) {
9090
const Cluster* c = this->getCluster(t.getClusterIndex(i));
9191
Int_t idx = c - &mClusterCache[0]; // Index of this cluster in event
92-
clusIdx.emplace_back(idx);
92+
clusIdx.emplace_back(this->mFirstInFrame + idx);
9393
}
9494
trackNew.setClusterRefs(clEntry, noc);
9595
trackNew.setPattern(0x7f); // this tracker finds only complete tracks

Detectors/ITSMFT/ITS/workflow/src/TrackerSpec.cxx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,15 @@ void TrackerDPL::run(ProcessingContext& pc)
194194
FastMultEst multEst; // mult estimator
195195

196196
// snippet to convert found tracks to final output tracks with separate cluster indices
197-
auto copyTracks = [](auto& tracks, auto& allTracks, auto& allClusIdx, int offset = 0) {
197+
auto copyTracks = [](auto& tracks, auto& allTracks, auto& allClusIdx) {
198198
for (auto& trc : tracks) {
199199
trc.setFirstClusterEntry(allClusIdx.size()); // before adding tracks, create final cluster indices
200200
int ncl = trc.getNumberOfClusters(), nclf = 0;
201201
uint8_t patt = 0;
202202
for (int ic = TrackITSExt::MaxClusters; ic--;) { // track internally keeps in->out cluster indices, but we want to store the references as out->in!!!
203203
auto clid = trc.getClusterIndex(ic);
204204
if (clid >= 0) {
205-
allClusIdx.push_back(clid + offset);
205+
allClusIdx.push_back(clid);
206206
nclf++;
207207
patt |= 0x1 << ic;
208208
}
@@ -273,10 +273,9 @@ void TrackerDPL::run(ProcessingContext& pc)
273273
LOG(INFO) << "Found tracks: " << tracks.size();
274274
int number = tracks.size();
275275
trackLabels.swap(mTracker->getTrackLabels()); /// FIXME: assignment ctor is not optimal.
276-
int shiftIdx = -rof.getFirstEntry(); // cluster entry!!!
277276
rof.setFirstEntry(first);
278277
rof.setNEntries(number);
279-
copyTracks(tracks, allTracks, allClusIdx, shiftIdx);
278+
copyTracks(tracks, allTracks, allClusIdx);
280279
std::copy(trackLabels.begin(), trackLabels.end(), std::back_inserter(allTrackLabels));
281280
trackLabels.clear();
282281
vtxROF.setNEntries(vtxVecLoc.size());

0 commit comments

Comments
 (0)