diff --git a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/NameConf.h b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/NameConf.h index e455a4d465bfa..b903c673490a1 100644 --- a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/NameConf.h +++ b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/NameConf.h @@ -91,11 +91,6 @@ class NameConf // public standard CTF dictionary static constexpr std::string_view CTFDICT = "ctf_dictionary"; // hardcoded - // Block for ITS/TPC matching - static constexpr std::string_view TPCITS_TracksBranchName = "TPCITS"; ///< name of branch containing output matched tracks - static constexpr std::string_view TPCITS_TPCMCTruthBranchName = "MatchTPCMCTruth"; ///< name of branch for output matched tracks TPC MC - static constexpr std::string_view TPCITS_ITSMCTruthBranchName = "MatchITSMCTruth"; ///< name of branch for output matched tracks ITS MC - // CTF tree name static constexpr std::string_view CTFTREENAME = "ctf"; // hardcoded diff --git a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx index c9228c8f7d69e..07f13f1db0f42 100644 --- a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx +++ b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx @@ -297,8 +297,6 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc) auto tracksTPC = pc.inputs().get>("trackTPC"); auto tracksTPCMCTruth = pc.inputs().get>("trackTPCMCTruth"); auto tracksITSMCTruth = pc.inputs().get>("trackITSMCTruth"); - auto tracksITSTPC_ITSMC = pc.inputs().get>("tracksITSTPC_ITSMC"); - auto tracksITSTPC_TPCMC = pc.inputs().get>("tracksITSTPC_TPCMC"); LOG(DEBUG) << "FOUND " << tracksTPC.size() << " TPC tracks"; LOG(DEBUG) << "FOUND " << tracksITS.size() << " ITS tracks"; @@ -650,8 +648,9 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc) if (mFillTracksITSTPC) { fillTracksTable(tracksITSTPC, vCollRefsTPCITS, tracksCursor, o2::vertexing::GIndex::Source::ITSTPC); // fTrackType = 0 for (int i = 0; i < tracksITSTPC.size(); i++) { - auto& mcTruthITS = tracksITSTPC_ITSMC[i]; - auto& mcTruthTPC = tracksITSTPC_TPCMC[i]; + const auto& trc = tracksITSTPC[i]; + auto mcTruthITS = tracksITSMCTruth[trc.getRefITS()]; + auto mcTruthTPC = tracksTPCMCTruth[trc.getRefTPC()]; labelID = std::numeric_limits::max(); labelITS = std::numeric_limits::max(); labelTPC = std::numeric_limits::max(); @@ -710,8 +709,6 @@ DataProcessorSpec getAODProducerWorkflowSpec() inputs.emplace_back("trackTPC", "TPC", "TRACKS", 0, Lifetime::Timeframe); inputs.emplace_back("trackTPCMCTruth", "TPC", "TRACKSMCLBL", 0, Lifetime::Timeframe); inputs.emplace_back("trackITSMCTruth", "ITS", "TRACKSMCTR", 0, Lifetime::Timeframe); - inputs.emplace_back("tracksITSTPC_ITSMC", "GLO", "TPCITS_ITSMC", 0, Lifetime::Timeframe); - inputs.emplace_back("tracksITSTPC_TPCMC", "GLO", "TPCITS_TPCMC", 0, Lifetime::Timeframe); outputs.emplace_back(OutputLabel{"O2bc"}, "AOD", "BC", 0, Lifetime::Timeframe); outputs.emplace_back(OutputLabel{"O2collision"}, "AOD", "COLLISION", 0, Lifetime::Timeframe); diff --git a/Detectors/GlobalTracking/src/MatchTPCITS.cxx b/Detectors/GlobalTracking/src/MatchTPCITS.cxx index 64b656d00ab0d..08f8bcbc7a4f5 100644 --- a/Detectors/GlobalTracking/src/MatchTPCITS.cxx +++ b/Detectors/GlobalTracking/src/MatchTPCITS.cxx @@ -1475,7 +1475,6 @@ bool MatchTPCITS::refitTrackTPCITS(int iTPC, int& iITS) if (mMCTruthON) { // store MC info: we assign TPC track label and declare the match fake if the ITS and TPC labels are different (their fake flag is ignored) auto& lbl = mOutLabels.emplace_back(mTPCLblWork[iTPC]); lbl.setFakeFlag(mITSLblWork[iITS] != mTPCLblWork[iTPC]); - LOG(INFO) << "ITS: " << mITSLblWork[iITS] << " TPC: " << mTPCLblWork[iTPC] << " -> " << lbl; } // if requested, fill the difference of ITS and TPC tracks tgl for vdrift calibation diff --git a/Detectors/GlobalTrackingWorkflow/src/PrimaryVertexingSpec.cxx b/Detectors/GlobalTrackingWorkflow/src/PrimaryVertexingSpec.cxx index ddcab00e7125a..c3c68e87b7750 100644 --- a/Detectors/GlobalTrackingWorkflow/src/PrimaryVertexingSpec.cxx +++ b/Detectors/GlobalTrackingWorkflow/src/PrimaryVertexingSpec.cxx @@ -62,10 +62,9 @@ void PrimaryVertexingSpec::run(ProcessingContext& pc) double timeCPU0 = mTimer.CpuTime(), timeReal0 = mTimer.RealTime(); mTimer.Start(false); const auto tracksITSTPC = pc.inputs().get>("match"); - gsl::span lblITS, lblTPC; + gsl::span lblTPCITS; if (mUseMC) { - lblITS = pc.inputs().get>("lblITS"); - lblTPC = pc.inputs().get>("lblTPC"); + lblTPCITS = pc.inputs().get>("lblTPCITS"); } std::vector vertices; std::vector vertexTrackIDs; @@ -94,7 +93,7 @@ void PrimaryVertexingSpec::run(ProcessingContext& pc) } } - mVertexer.process(tracksITSTPC, idxVec, ft0Data, vertices, vertexTrackIDs, v2tRefs, lblITS, lblTPC, lblVtx); + mVertexer.process(tracksITSTPC, idxVec, ft0Data, vertices, vertexTrackIDs, v2tRefs, lblTPCITS, lblVtx); pc.outputs().snapshot(Output{"GLO", "PVTX", 0, Lifetime::Timeframe}, vertices); pc.outputs().snapshot(Output{"GLO", "PVTX_CONTIDREFS", 0, Lifetime::Timeframe}, v2tRefs); pc.outputs().snapshot(Output{"GLO", "PVTX_CONTID", 0, Lifetime::Timeframe}, vertexTrackIDs); @@ -129,8 +128,7 @@ DataProcessorSpec getPrimaryVertexingSpec(bool validateWithFT0, bool useMC) outputs.emplace_back("GLO", "PVTX_CONTIDREFS", 0, Lifetime::Timeframe); if (useMC) { - inputs.emplace_back("lblITS", "GLO", "TPCITS_ITSMC", 0, Lifetime::Timeframe); - inputs.emplace_back("lblTPC", "GLO", "TPCITS_TPCMC", 0, Lifetime::Timeframe); + inputs.emplace_back("lblTPCITS", "GLO", "TPCITS_MC", 0, Lifetime::Timeframe); outputs.emplace_back("GLO", "PVTX_MCTR", 0, Lifetime::Timeframe); } diff --git a/Detectors/GlobalTrackingWorkflow/tofworkflow/src/RecoWorkflowWithTPCSpec.cxx b/Detectors/GlobalTrackingWorkflow/tofworkflow/src/RecoWorkflowWithTPCSpec.cxx index d9622404d4fc5..6b91514c3d3f2 100644 --- a/Detectors/GlobalTrackingWorkflow/tofworkflow/src/RecoWorkflowWithTPCSpec.cxx +++ b/Detectors/GlobalTrackingWorkflow/tofworkflow/src/RecoWorkflowWithTPCSpec.cxx @@ -167,8 +167,6 @@ o2::framework::DataProcessorSpec getTOFRecoWorkflowWithTPCSpec(bool useMC, bool if (useMC) { outputs.emplace_back(o2::header::gDataOriginTOF, "MCMATCHTOF_TPC", 0, Lifetime::Timeframe); - outputs.emplace_back(o2::header::gDataOriginTOF, "MCMATCHTPC_TPC", 0, Lifetime::Timeframe); - outputs.emplace_back(o2::header::gDataOriginTOF, "MCMATCHITS_TPC", 0, Lifetime::Timeframe); } outputs.emplace_back(o2::header::gDataOriginTOF, "CALIBDATA_TPC", 0, Lifetime::Timeframe); diff --git a/Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/src/TPCInterpolationSpec.cxx b/Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/src/TPCInterpolationSpec.cxx index 5199a2808c786..dddd04f23781b 100644 --- a/Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/src/TPCInterpolationSpec.cxx +++ b/Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/src/TPCInterpolationSpec.cxx @@ -96,12 +96,6 @@ DataProcessorSpec getTPCInterpolationSpec(bool useMC, const std::vector& tp if (useMC) { LOG(FATAL) << "MC usage must be disabled for this workflow, since it is not yet implemented"; - // are the MC inputs from ITS-TPC matching and TOF matching duplicates? if trackITSMCTR == matchTOFMCITS one of them should be removed - inputs.emplace_back("trackITSMCTR", "GLO", "TPCITS_ITSMC", 0, Lifetime::Timeframe); - inputs.emplace_back("trackTPCMCTR", "GLO", "TPCITSMC", 0, Lifetime::Timeframe); - inputs.emplace_back("matchTOFMC", o2::header::gDataOriginTOF, "MCMATCHTOF", 0, Lifetime::Timeframe); - inputs.emplace_back("matchTOFMCTPC", o2::header::gDataOriginTOF, "MCMATCHTPC", 0, Lifetime::Timeframe); - inputs.emplace_back("matchTOFMCITS", o2::header::gDataOriginTOF, "MCMATCHITS", 0, Lifetime::Timeframe); } outputs.emplace_back("GLO", "TPCINT_TRK", 0, Lifetime::Timeframe); diff --git a/Detectors/TRD/workflow/src/TRDGlobalTrackingSpec.cxx b/Detectors/TRD/workflow/src/TRDGlobalTrackingSpec.cxx index 6081c105da61b..37c02358ccf3a 100644 --- a/Detectors/TRD/workflow/src/TRDGlobalTrackingSpec.cxx +++ b/Detectors/TRD/workflow/src/TRDGlobalTrackingSpec.cxx @@ -175,8 +175,6 @@ DataProcessorSpec getTRDGlobalTrackingSpec(bool useMC) if (useMC) { LOG(FATAL) << "MC usage must be disabled for this workflow, since it is not yet implemented"; - //inputs.emplace_back("itstracklabel", "GLO", "TPCITS_ITSMC", 0, Lifetime::Timeframe); - //inputs.emplace_back("tpctracklabel", "GLO", "TPCITS_TPCMC", 0, Lifetime::Timeframe); } outputs.emplace_back(o2::header::gDataOriginTRD, "MATCHTRD", 0, Lifetime::Timeframe); diff --git a/Detectors/Vertexing/include/DetectorsVertexing/PVertexer.h b/Detectors/Vertexing/include/DetectorsVertexing/PVertexer.h index 14d6067d476fd..3124928daf23a 100644 --- a/Detectors/Vertexing/include/DetectorsVertexing/PVertexer.h +++ b/Detectors/Vertexing/include/DetectorsVertexing/PVertexer.h @@ -54,11 +54,11 @@ class PVertexer template int process(const TR& tracks, const gsl::span gids, const BC& bcData, std::vector& vertices, std::vector& vertexTrackIDs, std::vector& v2tRefs, - gsl::span lblITS, gsl::span lblTPC, std::vector& lblVtx) + gsl::span lblTracks, std::vector& lblVtx) { auto nv = process(tracks, gids, bcData, vertices, vertexTrackIDs, v2tRefs); - if (lblITS.size() && lblTPC.size()) { - createMCLabels(lblITS, lblTPC, vertices, vertexTrackIDs, v2tRefs, lblVtx); + if (lblTracks.size()) { + createMCLabels(lblTracks, vertices, vertexTrackIDs, v2tRefs, lblVtx); } return nv; } @@ -67,7 +67,7 @@ class PVertexer int process(const TR& tracks, const gsl::span gids, const BC& bcData, std::vector& vertices, std::vector& vertexTrackIDs, std::vector& v2tRefs); - static void createMCLabels(gsl::span lblITS, gsl::span lblTPC, + static void createMCLabels(gsl::span lblTracks, const std::vector vertices, const std::vector vertexTrackIDs, const std::vector v2tRefs, std::vector& lblVtx); bool findVertex(const VertexingInput& input, PVertex& vtx); diff --git a/Detectors/Vertexing/src/PVertexer.cxx b/Detectors/Vertexing/src/PVertexer.cxx index 92680c190d032..422a25ac5cf76 100644 --- a/Detectors/Vertexing/src/PVertexer.cxx +++ b/Detectors/Vertexing/src/PVertexer.cxx @@ -373,17 +373,17 @@ void PVertexer::finalizeVertex(const VertexingInput& input, const PVertex& vtx, } //___________________________________________________________________ -void PVertexer::createMCLabels(gsl::span lblITS, gsl::span lblTPC, - const std::vector vertices, const std::vector vertexTrackIDs, const std::vector v2tRefs, +void PVertexer::createMCLabels(gsl::span lblTracks, const std::vector vertices, + const std::vector vertexTrackIDs, const std::vector v2tRefs, std::vector& lblVtx) { lblVtx.clear(); int nv = vertices.size(); - if (lblITS.size() != lblITS.size() || !lblITS.size()) { - LOG(ERROR) << "labels are not provided or incorrect"; + if (!lblTracks.size()) { + LOG(ERROR) << "Track labels are not provided"; return; } - std::unordered_map labelOccurenceCorr, labelOccurenceITS; + std::unordered_map labelOccurenceCorr; auto bestLbl = [](std::unordered_map mp, int norm) -> o2::MCEventLabel { o2::MCEventLabel best; @@ -403,25 +403,19 @@ void PVertexer::createMCLabels(gsl::span lblITS, gsl::spa for (const auto& v2t : v2tRefs) { int tref = v2t.getFirstEntry(), last = tref + v2t.getEntries(); labelOccurenceCorr.clear(); - labelOccurenceITS.clear(); o2::MCEventLabel winner; // unset at the moment for (; tref < last; tref++) { int tid = vertexTrackIDs[tref].getIndex(); - const auto& lITS = lblITS[tid]; - const auto& lTPC = lblTPC[tid]; - if (!lITS.isSet() || !lTPC.isSet()) { + const auto& lbl = lblTracks[tid]; + if (!lbl.isSet()) { break; } - if (lITS.getTrackID() == lTPC.getTrackID() && lITS.getEventID() == lTPC.getEventID() && lITS.getSourceID() == lTPC.getSourceID()) { - labelOccurenceCorr[{lITS.getEventID(), lITS.getSourceID(), 0.}]++; - } else { - labelOccurenceITS[{lITS.getEventID(), lITS.getSourceID(), 0.}]++; + if (!lbl.isFake()) { + labelOccurenceCorr[{lbl.getEventID(), lbl.getSourceID(), 0.}]++; } } if (labelOccurenceCorr.size()) { winner = bestLbl(labelOccurenceCorr, v2t.getEntries()); - } else if (labelOccurenceITS.size()) { - winner = bestLbl(labelOccurenceITS, 0); // in absence of correct matches, set the ITS only label but set its weight to 0 } lblVtx.push_back(winner); }