Skip to content

Commit 8234357

Browse files
Francesco Mazzaschishahor02
authored andcommitted
[StrangenessTracking] Pass ITS cluster info to AO2Ds
1 parent 05f1457 commit 8234357

File tree

3 files changed

+51
-14
lines changed

3 files changed

+51
-14
lines changed

DataFormats/Reconstruction/include/ReconstructionDataFormats/StrangeTrack.h

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,49 @@ struct StrangeTrack {
3535
unsigned int mDecayRef = -1;
3636
std::array<float, 3> mDecayVtx;
3737
std::array<float, 3> mDecayMom;
38-
std::array<float, 2> mMasses; // V0: hypertriton and hyperhydrongen4, cascade: Xi and Omega.
39-
float mITSClusSize;
38+
std::array<float, 2> mMasses; // V0: hypertriton and hyperhydrongen4, cascade: Xi and Omega.
39+
unsigned int mClusterSizes = 0u; // same encoding used for the ITS track
4040
float mMatchChi2;
4141
float mTopoChi2;
42+
43+
void setClusterSize(int l, int size)
44+
{
45+
if (l >= 8) {
46+
return;
47+
}
48+
if (size > 15) {
49+
size = 15;
50+
}
51+
mClusterSizes &= ~(0xf << (l * 4));
52+
mClusterSizes |= (size << (l * 4));
53+
}
54+
55+
int getClusterSize(int l) const
56+
{
57+
if (l >= 7) {
58+
return 0;
59+
}
60+
return (mClusterSizes >> (l * 4)) & 0xf;
61+
}
62+
63+
int getClusterSizes() const
64+
{
65+
return mClusterSizes;
66+
}
67+
68+
float getAverageClusterSize() const
69+
{
70+
int nClusters = 0;
71+
int nClustersSize = 0;
72+
for (int i = 0; i < 7; ++i) {
73+
int size = getClusterSize(i);
74+
if (size > 0) {
75+
nClustersSize += size;
76+
nClusters++;
77+
}
78+
}
79+
return nClusters > 0 ? static_cast<float>(nClustersSize) / nClusters : 0.f;
80+
}
4281
};
4382

4483
} // namespace dataformats

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,7 @@ void AODProducerWorkflowDPL::fillTrackTablesPerCollision(int collisionID,
545545
auto& sTrk = sTracks[collStrTrk.second];
546546
TrackExtraInfo extraInfo;
547547
extraInfo.itsChi2NCl = sTrk.mTopoChi2; // TODO: this is the total chi2 of adding the ITS clusters, the topology chi2 meaning might change in the future
548+
extraInfo.itsClusterSizes = sTrk.getClusterSizes();
548549
addToTracksTable(tracksCursor, tracksCovCursor, sTrk.mMother, collisionID, aod::track::StrangeTrack);
549550
addToTracksExtraTable(tracksExtraCursor, extraInfo);
550551
mStrTrkIndices[collStrTrk.second] = mTableTrID;
@@ -1378,7 +1379,7 @@ void AODProducerWorkflowDPL::fillStrangenessTrackingTables(const o2::globaltrack
13781379
sTrk.mMasses[1],
13791380
sTrk.mMatchChi2,
13801381
sTrk.mTopoChi2,
1381-
sTrk.mITSClusSize);
1382+
sTrk.getAverageClusterSize());
13821383
} else if (sTrk.mPartType == dataformats::kStrkCascade) {
13831384
cascCurs(mStrTrkIndices[sTrkID++],
13841385
itsTableIdx,
@@ -1390,7 +1391,7 @@ void AODProducerWorkflowDPL::fillStrangenessTrackingTables(const o2::globaltrack
13901391
sTrk.mMasses[1],
13911392
sTrk.mMatchChi2,
13921393
sTrk.mTopoChi2,
1393-
sTrk.mITSClusSize);
1394+
sTrk.getAverageClusterSize());
13941395
} else {
13951396
d3BodyCurs(mStrTrkIndices[sTrkID++],
13961397
itsTableIdx,
@@ -1402,7 +1403,7 @@ void AODProducerWorkflowDPL::fillStrangenessTrackingTables(const o2::globaltrack
14021403
sTrk.mMasses[1],
14031404
sTrk.mMatchChi2,
14041405
sTrk.mTopoChi2,
1405-
sTrk.mITSClusSize);
1406+
sTrk.getAverageClusterSize());
14061407
}
14071408
}
14081409
}

Detectors/Vertexing/StrangenessTracking/src/StrangenessTracker.cxx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,6 @@ bool StrangenessTracker::matchDecayToITStrack(float decayR, StrangeTrack& strang
351351
auto nMinClusMother = trackClusters.size() < 4 ? 2 : mStrParams->mMinMotherClus;
352352

353353
std::vector<ITSCluster> motherClusters;
354-
std::vector<int> motherClusSizes;
355354
std::array<unsigned int, 7> nAttachments;
356355
nAttachments.fill(-1); // fill arr with -1
357356

@@ -365,14 +364,15 @@ bool StrangenessTracker::matchDecayToITStrack(float decayR, StrangeTrack& strang
365364
double clusRad = sqrt(clus.getX() * clus.getX() - clus.getY() * clus.getY());
366365
auto diffR = decayR - clusRad;
367366
auto relDiffR = diffR / decayR;
367+
auto lay = geom->getLayer(clus.getSensorID());
368368
// Look for the Mother if the Decay radius allows for it, within a tolerance
369369
LOG(debug) << "decayR: " << decayR << ", diffR: " << diffR << ", clus rad: " << clusRad << ", radTol: " << radTol;
370370
if (relDiffR > -radTol) {
371-
LOG(debug) << "Try to attach cluster to Mother, layer: " << geom->getLayer(clus.getSensorID());
371+
LOG(debug) << "Try to attach cluster to Mother, layer: " << lay;
372372
if (updateTrack(clus, strangeTrack.mMother)) {
373373
motherClusters.push_back(clus);
374-
motherClusSizes.push_back(compClus);
375-
nAttachments[geom->getLayer(clus.getSensorID())] = 0;
374+
strangeTrack.setClusterSize(lay, compClus);
375+
nAttachments[lay] = 0;
376376
isMotherUpdated = true;
377377
nUpdates++;
378378
LOG(debug) << "Cluster attached to Mother";
@@ -383,11 +383,11 @@ bool StrangenessTracker::matchDecayToITStrack(float decayR, StrangeTrack& strang
383383
// if Mother is not found, check for V0 daughters compatibility
384384
if (relDiffR < radTol && !isMotherUpdated) {
385385
bool isDauUpdated = false;
386-
LOG(debug) << "Try to attach cluster to Daughters, layer: " << geom->getLayer(clus.getSensorID());
386+
LOG(debug) << "Try to attach cluster to Daughters, layer: " << lay;
387387
for (int iDau{0}; iDau < daughterTracks.size(); iDau++) {
388388
auto& dauTrack = daughterTracks[iDau];
389389
if (updateTrack(clus, dauTrack)) {
390-
nAttachments[geom->getLayer(clus.getSensorID())] = iDau + 1;
390+
nAttachments[lay] = iDau + 1;
391391
isDauUpdated = true;
392392
break;
393393
}
@@ -419,9 +419,6 @@ bool StrangenessTracker::matchDecayToITStrack(float decayR, StrangeTrack& strang
419419
}
420420
}
421421

422-
// compute mother average cluster size
423-
strangeTrack.mITSClusSize = float(std::accumulate(motherClusSizes.begin(), motherClusSizes.end(), 0)) / motherClusSizes.size();
424-
425422
LOG(debug) << "Inward-outward refit finished, starting final topology refit";
426423
// final Topology refit
427424

0 commit comments

Comments
 (0)