Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions Detectors/AOD/src/AODProducerWorkflowSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding const is fine but I don't see why reference in this case is better than the value: label object is 8 bytes, the reference also but it needs dereferencing.

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)) {
Expand Down Expand Up @@ -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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why it goes to ITS0?

}
}
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;
}
Expand All @@ -1145,13 +1145,16 @@ void AODProducerWorkflowDPL::fillMCTrackLabelsTable(MCTrackLabelCursorType& mcTr
break;
}
}
if (isTOFFake) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@njacazio the line https://github.com/AliceO2Group/AliceO2/pull/13902/files#diff-6dc278732c5ed5f43d5567ad2c469ac11acf0e85339ae708bdf977ddd8fba392R1143 is simply wrong: it compares the original full MCCompLabel of TOF cluster with uint label of TPC assigned for storage in the AOD! All these manipulations with mToStore container are extremely heavy and unnecessary: the MCCompLabel are much lighter. I'll fix this part, then let's continue from that point on.

labelHolder.labelMask |= o2::aod::mctracklabel::McMaskEnum::MismatchInTOF;
}
Comment on lines +1148 to +1150
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the data I checked (when discussing with Sebastian) the TOFFake was always set to true when the TOF was present, I don't see what should be fixed here, except that it will not overwrite the general isFake bit 15 as before).

}
}
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);
Expand Down Expand Up @@ -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;
Expand Down
24 changes: 24 additions & 0 deletions Framework/Core/include/Framework/DataTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,30 @@ constexpr std::array<float, 5> trackQAScaleGloP1{0.183731, 0.409071, 0.00621802,
constexpr std::array<float, 2> 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 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the correspondence between these enums and what is actually filled? Note that the ITS track per see may have no fakes (all clusters having the same label) but can be matched to TPC track with a different label. In this case ITS-TPC label will have isFake()==true. With your PR it will be flagged in bit0, why?

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 {
Expand Down
Loading