Skip to content

Commit dff469f

Browse files
committed
Fix fake/correct status for barrel tracks
The fMcMask bit 15 (fake global track label or TOF_label != TPC_lable) was wrong since original TOF cluster label (set in the reconstruction) was compared with TPC remapped label prepared for AOD storage. In fact, we don't need to consider separately the global_label.isFake and TOF-TPC mismach: TOF is the last detector in the matching process and the global track label is determined by the TPC track label. Hence, if the TOF match is present but its cluster is not contributed by the TPC track, the global label isFake will be necessarilly true, and vice versa. Also, the status of bit 13 (flagging ITS-TPC mismatch) was covering only track-to-track matches but not those from the afterburner. Now settings of fakeness relies on the isFake status from the reconstruction.
1 parent e7179fc commit dff469f

File tree

3 files changed

+15
-45
lines changed

3 files changed

+15
-45
lines changed

DataFormats/Detectors/GlobalTracking/src/RecoContainer.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1447,7 +1447,7 @@ RecoContainer::GlobalIDSet RecoContainer::getSingleDetectorRefs(GTrackID gidx) c
14471447
table[GTrackID::MCH] = parent0.getMCHRef();
14481448
table[GTrackID::MID] = parent0.getMIDRef();
14491449
}
1450-
return std::move(table);
1450+
return table;
14511451
}
14521452

14531453
//________________________________________________________

Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,6 @@ class AODProducerWorkflowDPL : public Task
482482
// using -1 as dummies for AOD
483483
struct MCLabels {
484484
uint32_t labelID = -1;
485-
uint32_t labelITS = -1;
486-
uint32_t labelTPC = -1;
487485
uint16_t labelMask = 0;
488486
uint8_t fwdLabelMask = 0;
489487
};

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ using PVertex = o2::dataformats::PrimaryVertex;
109109
using GIndex = o2::dataformats::VtxTrackIndex;
110110
using DataRequest = o2::globaltracking::DataRequest;
111111
using GID = o2::dataformats::GlobalTrackID;
112+
using DetID = o2::detectors::DetID;
112113
using SMatrix55Sym = ROOT::Math::SMatrix<double, 5, 5, ROOT::Math::MatRepSym<double, 5>>;
113114

114115
namespace o2::aodproducer
@@ -1058,9 +1059,9 @@ void AODProducerWorkflowDPL::fillMCTrackLabelsTable(MCTrackLabelCursorType& mcTr
10581059
int vertexId)
10591060
{
10601061
// labelMask (temporary) usage:
1061-
// bit 13 -- ITS/TPC or TPC/TOF labels are not equal
1062+
// bit 13 -- ITS/TPC with ITS label (track of AB tracklet) different from TPC
10621063
// bit 14 -- isNoise() == true
1063-
// bit 15 -- isFake() == true
1064+
// bit 15 -- isFake() == true (defined by the fakeness of the top level global track, i.e. if TOF is present, fake means that the track of the TPC label does not contribute to TOF cluster)
10641065
// labelID = -1 -- label is not set
10651066

10661067
for (int src = GIndex::NSources; src--;) {
@@ -1084,7 +1085,7 @@ void AODProducerWorkflowDPL::fillMCTrackLabelsTable(MCTrackLabelCursorType& mcTr
10841085

10851086
if (GIndex::includesSource(src, mInputSources)) {
10861087
auto mcTruth = data.getTrackMCLabel(trackIndex);
1087-
MCLabels labelHolder;
1088+
MCLabels labelHolder{};
10881089
if ((src == GIndex::Source::MFT) || (src == GIndex::Source::MFTMCH) || (src == GIndex::Source::MCH) || (src == GIndex::Source::MCHMID)) { // treating mft and fwd labels separately
10891090
if (!needToStore(src == GIndex::Source::MFT ? mGIDToTableMFTID : mGIDToTableFwdID)) {
10901091
continue;
@@ -1110,51 +1111,22 @@ void AODProducerWorkflowDPL::fillMCTrackLabelsTable(MCTrackLabelCursorType& mcTr
11101111
continue;
11111112
}
11121113
if (mcTruth.isValid()) { // if not set, -1 will be stored
1113-
labelHolder.labelID = (mToStore[mcTruth.getSourceID()][mcTruth.getEventID()])[mcTruth.getTrackID()];
1114-
}
1115-
// treating possible mismatches and fakes for global tracks
1116-
auto contributorsGID = data.getSingleDetectorRefs(trackIndex);
1117-
bool isSetTPC = contributorsGID[GIndex::Source::TPC].isIndexSet();
1118-
bool isSetITS = contributorsGID[GIndex::Source::ITS].isIndexSet();
1119-
bool isSetTOF = contributorsGID[GIndex::Source::TOF].isIndexSet();
1120-
bool isTOFFake = true;
1121-
if (isSetTPC && (isSetITS || isSetTOF)) {
1122-
auto mcTruthTPC = data.getTrackMCLabel(contributorsGID[GIndex::Source::TPC]);
1123-
if (mcTruthTPC.isValid()) {
1124-
labelHolder.labelTPC = (mToStore[mcTruthTPC.getSourceID()][mcTruthTPC.getEventID()])[mcTruthTPC.getTrackID()];
1125-
labelHolder.labelID = labelHolder.labelTPC;
1126-
}
1127-
if (isSetITS) {
1128-
auto mcTruthITS = data.getTrackMCLabel(contributorsGID[GIndex::Source::ITS]);
1129-
if (mcTruthITS.isValid()) {
1130-
labelHolder.labelITS = (mToStore[mcTruthITS.getSourceID()][mcTruthITS.getEventID()])[mcTruthITS.getTrackID()];
1131-
}
1132-
if (labelHolder.labelITS != labelHolder.labelTPC) {
1133-
LOG(debug) << "ITS-TPC MCTruth: labelIDs do not match at " << trackIndex.getIndex() << ", src = " << src;
1134-
labelHolder.labelMask |= (0x1 << 13);
1135-
}
1114+
labelHolder.labelID = (mToStore[mcTruth.getSourceID()][mcTruth.getEventID()])[mcTruth.getTrackID()]; // defined by TPC if it contributes, otherwise: by ITS
1115+
if (mcTruth.isFake()) {
1116+
labelHolder.labelMask |= (0x1 << 15);
11361117
}
1137-
if (isSetTOF) {
1138-
const auto& labelsTOF = data.getTOFClustersMCLabels()->getLabels(contributorsGID[GIndex::Source::TOF]);
1139-
for (auto& mcLabel : labelsTOF) {
1140-
if (!mcLabel.isValid()) {
1141-
continue;
1142-
}
1143-
if (mcLabel == labelHolder.labelTPC) {
1144-
isTOFFake = false;
1145-
break;
1118+
if (trackIndex.includesDet(DetID::TPC) && trackIndex.getSource() != GIndex::Source::TPC) { // this is global track
1119+
auto contributorsGID = data.getSingleDetectorRefs(trackIndex);
1120+
if (contributorsGID[GIndex::Source::ITSTPC].isIndexSet()) { // there is a match to ITS tracks or ITSAB tracklet!
1121+
if (data.getTrackMCLabel(contributorsGID[GIndex::Source::ITSTPC]).isFake()) {
1122+
labelHolder.labelMask |= (0x1 << 13);
11461123
}
11471124
}
11481125
}
1149-
}
1150-
if (mcTruth.isFake() || (isSetTOF && isTOFFake)) {
1151-
labelHolder.labelMask |= (0x1 << 15);
1152-
}
1153-
if (mcTruth.isNoise()) {
1126+
} else if (mcTruth.isNoise()) {
11541127
labelHolder.labelMask |= (0x1 << 14);
11551128
}
1156-
mcTrackLabelCursor(labelHolder.labelID,
1157-
labelHolder.labelMask);
1129+
mcTrackLabelCursor(labelHolder.labelID, labelHolder.labelMask);
11581130
}
11591131
}
11601132
}

0 commit comments

Comments
 (0)