Skip to content

Commit e688d41

Browse files
committed
Account for TPC clusters non-monotonous sorting
1 parent da3a178 commit e688d41

File tree

4 files changed

+67
-15
lines changed

4 files changed

+67
-15
lines changed

Detectors/GlobalTrackingWorkflow/study/include/GlobalTrackingStudy/TrackMCStudyTypes.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,28 +80,33 @@ struct RecTrack {
8080
FakeTOF = 0x1 << 3,
8181
FakeITSTPC = 0x1 << 4,
8282
FakeITSTPCTRD = 0x1 << 5,
83+
HASACSides = 0x1 << 6,
8384
FakeGLO = 0x1 << 7
8485
};
8586
o2::track::TrackParCov track{};
8687
o2::dataformats::VtxTrackIndex gid{};
8788
o2::dataformats::TimeStampWithError<float, float> ts{};
8889
o2::MCEventLabel pvLabel{};
8990
short pvID = -1;
91+
uint8_t nClTPCShared = 0;
9092
uint8_t flags = 0;
9193
uint8_t nClITS = 0;
9294
uint8_t nClTPC = 0;
9395
uint8_t pattITS = 0;
9496
int8_t lowestPadRow = -1;
9597
int8_t padFromEdge = -1;
98+
uint8_t rowMaxTPC = 0;
99+
uint8_t rowCountTPC = 0;
96100

97101
bool isFakeGLO() const { return flags & FakeGLO; }
98102
bool isFakeITS() const { return flags & FakeITS; }
99103
bool isFakeTPC() const { return flags & FakeTPC; }
100104
bool isFakeTRD() const { return flags & FakeTRD; }
101105
bool isFakeTOF() const { return flags & FakeTOF; }
102106
bool isFakeITSTPC() const { return flags & FakeITSTPC; }
107+
bool hasACSides() const { return flags & HASACSides; }
103108

104-
ClassDefNV(RecTrack, 2);
109+
ClassDefNV(RecTrack, 3);
105110
};
106111

107112
struct TrackPairInfo {
@@ -151,6 +156,13 @@ struct TrackFamily { // set of tracks related to the same MC label
151156
const RecTrack& getTrackWithTPC() const { return entTPC < 0 ? dummyRecTrack : recTracks[entTPC]; }
152157
const RecTrack& getTrackWithITSTPC() const { return entITSTPC < 0 ? dummyRecTrack : recTracks[entITSTPC]; }
153158
const RecTrack& getTrackWithITSFound() const { return entITSFound < 0 ? dummyRecTrack : recTracks[entITSFound]; }
159+
const RecTrack& getLongestTPCTrack() const
160+
{
161+
int n = getLongestTPCTrackEntry();
162+
return n < 0 ? dummyRecTrack : recTracks[n];
163+
}
164+
int getLongestTPCTrackEntry() const;
165+
int getNTPCClones() const;
154166
static RecTrack dummyRecTrack; //
155167

156168
ClassDefNV(TrackFamily, 1);

Detectors/GlobalTrackingWorkflow/study/src/TrackMCStudy.cxx

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,20 +280,33 @@ void TrackMCStudy::process(const o2::globaltracking::RecoContainer& recoData)
280280
return patt;
281281
};
282282

283-
auto getLowestPadrow = [&recoData](const o2::tpc::TrackTPC& trc, RecTrack& tref) {
283+
auto fillTPCClusterInfo = [&recoData](const o2::tpc::TrackTPC& trc, RecTrack& tref) {
284284
if (recoData.inputsTPCclusters) {
285-
uint8_t clSect = 0, clRow = 0;
285+
uint8_t clSect = 0, clRow = 0, lowestR = -1;
286286
uint32_t clIdx = 0;
287287
const auto clRefs = recoData.getTPCTracksClusterRefs();
288288
const auto tpcClusAcc = recoData.getTPCClusters();
289-
trc.getClusterReference(clRefs, trc.getNClusterReferences() - 1, clSect, clRow, clIdx);
289+
const auto shMap = recoData.clusterShMapTPC;
290+
for (int ic = 0; ic < trc.getNClusterReferences(); ic++) { // outside -> inside ordering, but on the sector boundaries backward jumps are possible
291+
trc.getClusterReference(clRefs, ic, clSect, clRow, clIdx);
292+
if (clRow < lowestR) {
293+
tref.rowCountTPC++;
294+
lowestR = clRow;
295+
}
296+
unsigned int absoluteIndex = tpcClusAcc.clusterOffset[clSect][clRow] + clIdx;
297+
if (shMap[absoluteIndex] & o2::gpu::GPUTPCGMMergedTrackHit::flagShared) {
298+
tref.nClTPCShared++;
299+
}
300+
}
301+
tref.lowestPadRow = lowestR;
290302
const auto& clus = tpcClusAcc.clusters[clSect][clRow][clIdx];
291303
int padFromEdge = int(clus.getPad()), npads = o2::gpu::GPUTPCGeometry::NPads(clRow);
292304
if (padFromEdge > npads / 2) {
293305
padFromEdge = npads - 1 - padFromEdge;
294306
}
295307
tref.padFromEdge = uint8_t(padFromEdge);
296-
tref.lowestPadRow = clRow;
308+
trc.getClusterReference(clRefs, 0, clSect, clRow, clIdx);
309+
tref.rowMaxTPC = clRow;
297310
}
298311
};
299312

@@ -557,7 +570,10 @@ void TrackMCStudy::process(const o2::globaltracking::RecoContainer& recoData)
557570
if (msk[DetID::TPC]) {
558571
const auto& trtpc = recoData.getTPCTrack(gidSet[GTrackID::TPC]);
559572
tref.nClTPC = trtpc.getNClusters();
560-
getLowestPadrow(trtpc, tref);
573+
if (trtpc.hasBothSidesClusters()) {
574+
tref.flags |= RecTrack::HASACSides;
575+
}
576+
fillTPCClusterInfo(trtpc, tref);
561577
flagTPCClusters(trtpc, entry.first);
562578
if (trackFam.entTPC < 0) {
563579
trackFam.entTPC = tcnt;

Detectors/GlobalTrackingWorkflow/study/src/TrackMCStudyTypes.cxx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,28 @@ int MCTrackInfo::getHighestITSLayer() const
7777
return -1;
7878
}
7979

80+
int TrackFamily::getLongestTPCTrackEntry() const
81+
{
82+
int n = -1, ncl = 0;
83+
int ntr = recTracks.size();
84+
for (int i = 0; i < ntr; i++) {
85+
if (recTracks[i].nClTPC > ncl) {
86+
ncl = recTracks[i].nClTPC;
87+
n = i;
88+
}
89+
}
90+
return n;
91+
}
92+
93+
int TrackFamily::getNTPCClones() const
94+
{
95+
int n = 0;
96+
for (auto& t : recTracks) {
97+
if (t.nClTPC > 0) {
98+
n++;
99+
}
100+
}
101+
return n;
102+
}
103+
80104
} // namespace o2::trackstudy

Detectors/GlobalTrackingWorkflow/study/src/TrackingStudy.cxx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -274,25 +274,25 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData)
274274
const auto clRefs = recoData.getTPCTracksClusterRefs();
275275
const auto tpcClusAcc = recoData.getTPCClusters();
276276
const auto shMap = recoData.clusterShMapTPC;
277+
277278
if (recoData.inputsTPCclusters) {
278-
uint8_t clSect = 0, clRow = 0, clRowP = -1;
279+
uint8_t clSect = 0, clRow = 0, lowestR = -1;
279280
uint32_t clIdx = 0;
280-
for (int ic = 0; ic < trc.getNClusterReferences(); ic++) {
281+
for (int ic = 0; ic < trc.getNClusterReferences(); ic++) { // outside -> inside ordering, but on the sector boundaries backward jumps are possible
281282
trc.getClusterReference(clRefs, ic, clSect, clRow, clIdx);
282-
if (clRow != clRowP) {
283+
if (clRow < lowestR) {
283284
trExt.rowCountTPC++;
284-
clRowP = clRow;
285+
lowestR = clRow;
285286
}
286287
unsigned int absoluteIndex = tpcClusAcc.clusterOffset[clSect][clRow] + clIdx;
287288
if (shMap[absoluteIndex] & o2::gpu::GPUTPCGMMergedTrackHit::flagShared) {
288289
trExt.nClTPCShared++;
289290
}
290291
}
291-
trc.getClusterReference(clRefs, trc.getNClusterReferences() - 1, clSect, clRow, clIdx);
292-
trExt.rowMinTPC = clRow;
292+
trExt.rowMinTPC = lowestR;
293293
const auto& clus = tpcClusAcc.clusters[clSect][clRow][clIdx];
294294
trExt.padFromEdge = uint8_t(clus.getPad());
295-
int npads = o2::gpu::GPUTPCGeometry::NPads(clRow);
295+
int npads = o2::gpu::GPUTPCGeometry::NPads(lowestR);
296296
if (trExt.padFromEdge > npads / 2) {
297297
trExt.padFromEdge = npads - 1 - trExt.padFromEdge;
298298
}
@@ -314,9 +314,9 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData)
314314
uint8_t clSect0 = 0, clRow0 = 0, clSect1 = 0, clRow1 = 0;
315315
uint32_t clIdx0 = 0, clIdx1 = 0;
316316
int ic1Start = 0;
317-
for (int ic0 = 0; ic0 < trc0.getNClusterReferences(); ic0++) { // outside -> inside
317+
for (int ic0 = 0; ic0 < trc0.getNClusterReferences(); ic0++) { // outside -> inside, but on the sector boundaries backward jumps are possible
318318
trc0.getClusterReference(clRefs, ic0, clSect0, clRow0, clIdx0);
319-
for (int ic1 = ic1Start; ic1 < trc1.getNClusterReferences(); ic1++) { // outside -> inside
319+
for (int ic1 = ic1Start; ic1 < trc1.getNClusterReferences(); ic1++) { // outside -> inside, but on the sector boundaries backward jumps are possible
320320
trc1.getClusterReference(clRefs, ic1, clSect1, clRow1, clIdx1);
321321
if (clRow1 > clRow0) {
322322
ic1Start = ic1 + 1;

0 commit comments

Comments
 (0)