diff --git a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx index 6083052eb1168..052ccba327c37 100644 --- a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx +++ b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx @@ -1083,7 +1083,7 @@ void AODProducerWorkflowDPL::fillMCTrackLabelsTable(MCTrackLabelCursorType& mcTr }; if (GIndex::includesSource(src, mInputSources)) { - auto mcTruth = data.getTrackMCLabel(trackIndex); + const auto& mcTruth = data.getTrackMCLabel(trackIndex); MCLabels labelHolder; if ((src == GIndex::Source::MFT) || (src == GIndex::Source::MFTMCH) || (src == GIndex::Source::MCH) || (src == GIndex::Source::MCHMID)) { // treating mft and fwd labels separately if (!needToStore(src == GIndex::Source::MFT ? mGIDToTableMFTID : mGIDToTableFwdID)) { @@ -1113,30 +1113,30 @@ void AODProducerWorkflowDPL::fillMCTrackLabelsTable(MCTrackLabelCursorType& mcTr labelHolder.labelID = (mToStore[mcTruth.getSourceID()][mcTruth.getEventID()])[mcTruth.getTrackID()]; } // treating possible mismatches and fakes for global tracks - auto contributorsGID = data.getSingleDetectorRefs(trackIndex); - bool isSetTPC = contributorsGID[GIndex::Source::TPC].isIndexSet(); - bool isSetITS = contributorsGID[GIndex::Source::ITS].isIndexSet(); - bool isSetTOF = contributorsGID[GIndex::Source::TOF].isIndexSet(); + const auto& contributorsGID = data.getSingleDetectorRefs(trackIndex); + const bool isSetTPC = contributorsGID[GIndex::Source::TPC].isIndexSet(); + const bool isSetITS = contributorsGID[GIndex::Source::ITS].isIndexSet(); + const bool isSetTOF = contributorsGID[GIndex::Source::TOF].isIndexSet(); bool isTOFFake = true; if (isSetTPC && (isSetITS || isSetTOF)) { - auto mcTruthTPC = data.getTrackMCLabel(contributorsGID[GIndex::Source::TPC]); + const auto& mcTruthTPC = data.getTrackMCLabel(contributorsGID[GIndex::Source::TPC]); if (mcTruthTPC.isValid()) { labelHolder.labelTPC = (mToStore[mcTruthTPC.getSourceID()][mcTruthTPC.getEventID()])[mcTruthTPC.getTrackID()]; labelHolder.labelID = labelHolder.labelTPC; } if (isSetITS) { - auto mcTruthITS = data.getTrackMCLabel(contributorsGID[GIndex::Source::ITS]); + const auto& mcTruthITS = data.getTrackMCLabel(contributorsGID[GIndex::Source::ITS]); if (mcTruthITS.isValid()) { labelHolder.labelITS = (mToStore[mcTruthITS.getSourceID()][mcTruthITS.getEventID()])[mcTruthITS.getTrackID()]; } if (labelHolder.labelITS != labelHolder.labelTPC) { LOG(debug) << "ITS-TPC MCTruth: labelIDs do not match at " << trackIndex.getIndex() << ", src = " << src; - labelHolder.labelMask |= (0x1 << 13); + labelHolder.labelMask |= o2::aod::mctracklabel::McMaskEnum::MismatchInITS0; } } if (isSetTOF) { const auto& labelsTOF = data.getTOFClustersMCLabels()->getLabels(contributorsGID[GIndex::Source::TOF]); - for (auto& mcLabel : labelsTOF) { + for (const auto& mcLabel : labelsTOF) { if (!mcLabel.isValid()) { continue; } @@ -1145,13 +1145,16 @@ void AODProducerWorkflowDPL::fillMCTrackLabelsTable(MCTrackLabelCursorType& mcTr break; } } + if (isTOFFake) { + labelHolder.labelMask |= o2::aod::mctracklabel::McMaskEnum::MismatchInTOF; + } } } - if (mcTruth.isFake() || (isSetTOF && isTOFFake)) { - labelHolder.labelMask |= (0x1 << 15); + if (mcTruth.isFake()) { + labelHolder.labelMask |= o2::aod::mctracklabel::McMaskEnum::Fake; } if (mcTruth.isNoise()) { - labelHolder.labelMask |= (0x1 << 14); + labelHolder.labelMask |= o2::aod::mctracklabel::McMaskEnum::Noise; } mcTrackLabelCursor(labelHolder.labelID, labelHolder.labelMask); @@ -2493,6 +2496,8 @@ AODProducerWorkflowDPL::TrackExtraInfo AODProducerWorkflowDPL::processBarrelTrac if (contributorsGID[GIndex::Source::TOF].isIndexSet()) { // ITS-TPC-TRD-TOF, ITS-TPC-TOF, TPC-TRD-TOF, TPC-TOF const auto& tofMatch = data.getTOFMatch(trackIndex); extraInfoHolder.tofChi2 = tofMatch.getChi2(); + // const auto& patternUpDown = tofMatch.getHitPatternUpDown(); + // const auto& patternLeftRight = tofMatch.getHitPatternLeftRight(); const auto& tofInt = tofMatch.getLTIntegralOut(); float intLen = tofInt.getL(); extraInfoHolder.length = intLen; diff --git a/Framework/Core/include/Framework/DataTypes.h b/Framework/Core/include/Framework/DataTypes.h index 0a96ab49059fe..d5a6de79177b2 100644 --- a/Framework/Core/include/Framework/DataTypes.h +++ b/Framework/Core/include/Framework/DataTypes.h @@ -134,6 +134,30 @@ constexpr std::array trackQAScaleGloP1{0.183731, 0.409071, 0.00621802, constexpr std::array trackQAScaledTOF{1.1, 0.33}; } // namespace o2::aod::track +namespace o2::aod::mctracklabel +{ +// ! Bit mask to indicate detector mismatches (bit ON means mismatch). Bit 0-6: mismatch at ITS layer. Bit 7-9: # of TPC mismatches in the ranges 0, 1, 2-3, 4-7, 8-15, 16-31, 32-63, >64. Bit 10: TRD, bit 11: TOF, bit 15: indicates negative label +enum McMaskEnum : uint16_t { + MismatchInITS0 = 0x1, // BIT(0) Mismatch in the layer 0 of ITS + MismatchInITS1 = 0x2, // BIT(1) Mismatch in the layer 1 of ITS + MismatchInITS2 = 0x4, // BIT(2) Mismatch in the layer 2 of ITS + MismatchInITS3 = 0x8, // BIT(3) Mismatch in the layer 3 of ITS + MismatchInITS4 = 0x10, // BIT(4) Mismatch in the layer 4 of ITS + MismatchInITS5 = 0x20, // BIT(5) Mismatch in the layer 5 of ITS + MismatchInITS6 = 0x40, // BIT(6) Mismatch in the layer 6 of ITS + MismatchInTPC0 = 0x80, // BIT(7) Mismatch in the 0 of TPC + MismatchInTPC1 = 0x100, // BIT(8) Mismatch in the 1 of TPC + MismatchInTPC2 = 0x200, // BIT(9) Mismatch in the 2 of TPC + MismatchInTRD = 0x400, // BIT(10) Mismatch in the TRD + MismatchInTOF = 0x800, // BIT(11) Mismatch in the TOF + Noise = 0x1000, // BIT(12) + Fake = 0x2000, // BIT(13) + // MatchTPC0 = 0x4000, // BIT(14) + NegativeLabel = 0x8000 // BIT(15) Negative label +}; + +} // namespace o2::aod::mctracklabel + namespace o2::aod::fwdtrack { enum ForwardTrackTypeEnum : uint8_t {