@@ -109,6 +109,7 @@ using PVertex = o2::dataformats::PrimaryVertex;
109109using GIndex = o2::dataformats::VtxTrackIndex;
110110using DataRequest = o2::globaltracking::DataRequest;
111111using GID = o2::dataformats::GlobalTrackID;
112+ using DetID = o2::detectors::DetID;
112113using SMatrix55Sym = ROOT::Math::SMatrix<double , 5 , 5 , ROOT::Math::MatRepSym<double , 5 >>;
113114
114115namespace 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