Skip to content

Commit f5463d7

Browse files
committed
Fix: further cleanup of redundant labels
This is to amend #5366 Suppression of standalone track lables in the output of barrel matched tracks was not propagated everywhere
1 parent b2f7c83 commit f5463d7

File tree

9 files changed

+20
-47
lines changed

9 files changed

+20
-47
lines changed

DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/NameConf.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,6 @@ class NameConf
9191
// public standard CTF dictionary
9292
static constexpr std::string_view CTFDICT = "ctf_dictionary"; // hardcoded
9393

94-
// Block for ITS/TPC matching
95-
static constexpr std::string_view TPCITS_TracksBranchName = "TPCITS"; ///< name of branch containing output matched tracks
96-
static constexpr std::string_view TPCITS_TPCMCTruthBranchName = "MatchTPCMCTruth"; ///< name of branch for output matched tracks TPC MC
97-
static constexpr std::string_view TPCITS_ITSMCTruthBranchName = "MatchITSMCTruth"; ///< name of branch for output matched tracks ITS MC
98-
9994
// CTF tree name
10095
static constexpr std::string_view CTFTREENAME = "ctf"; // hardcoded
10196

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,6 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
297297
auto tracksTPC = pc.inputs().get<gsl::span<o2::tpc::TrackTPC>>("trackTPC");
298298
auto tracksTPCMCTruth = pc.inputs().get<gsl::span<o2::MCCompLabel>>("trackTPCMCTruth");
299299
auto tracksITSMCTruth = pc.inputs().get<gsl::span<o2::MCCompLabel>>("trackITSMCTruth");
300-
auto tracksITSTPC_ITSMC = pc.inputs().get<gsl::span<o2::MCCompLabel>>("tracksITSTPC_ITSMC");
301-
auto tracksITSTPC_TPCMC = pc.inputs().get<gsl::span<o2::MCCompLabel>>("tracksITSTPC_TPCMC");
302300

303301
LOG(DEBUG) << "FOUND " << tracksTPC.size() << " TPC tracks";
304302
LOG(DEBUG) << "FOUND " << tracksITS.size() << " ITS tracks";
@@ -650,8 +648,9 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
650648
if (mFillTracksITSTPC) {
651649
fillTracksTable(tracksITSTPC, vCollRefsTPCITS, tracksCursor, o2::vertexing::GIndex::Source::ITSTPC); // fTrackType = 0
652650
for (int i = 0; i < tracksITSTPC.size(); i++) {
653-
auto& mcTruthITS = tracksITSTPC_ITSMC[i];
654-
auto& mcTruthTPC = tracksITSTPC_TPCMC[i];
651+
const auto& trc = tracksITSTPC[i];
652+
auto mcTruthITS = tracksITSMCTruth[trc.getRefITS()];
653+
auto mcTruthTPC = tracksTPCMCTruth[trc.getRefTPC()];
655654
labelID = std::numeric_limits<uint32_t>::max();
656655
labelITS = std::numeric_limits<uint32_t>::max();
657656
labelTPC = std::numeric_limits<uint32_t>::max();
@@ -710,8 +709,6 @@ DataProcessorSpec getAODProducerWorkflowSpec()
710709
inputs.emplace_back("trackTPC", "TPC", "TRACKS", 0, Lifetime::Timeframe);
711710
inputs.emplace_back("trackTPCMCTruth", "TPC", "TRACKSMCLBL", 0, Lifetime::Timeframe);
712711
inputs.emplace_back("trackITSMCTruth", "ITS", "TRACKSMCTR", 0, Lifetime::Timeframe);
713-
inputs.emplace_back("tracksITSTPC_ITSMC", "GLO", "TPCITS_ITSMC", 0, Lifetime::Timeframe);
714-
inputs.emplace_back("tracksITSTPC_TPCMC", "GLO", "TPCITS_TPCMC", 0, Lifetime::Timeframe);
715712

716713
outputs.emplace_back(OutputLabel{"O2bc"}, "AOD", "BC", 0, Lifetime::Timeframe);
717714
outputs.emplace_back(OutputLabel{"O2collision"}, "AOD", "COLLISION", 0, Lifetime::Timeframe);

Detectors/GlobalTracking/src/MatchTPCITS.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,6 @@ bool MatchTPCITS::refitTrackTPCITS(int iTPC, int& iITS)
14751475
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)
14761476
auto& lbl = mOutLabels.emplace_back(mTPCLblWork[iTPC]);
14771477
lbl.setFakeFlag(mITSLblWork[iITS] != mTPCLblWork[iTPC]);
1478-
LOG(INFO) << "ITS: " << mITSLblWork[iITS] << " TPC: " << mTPCLblWork[iTPC] << " -> " << lbl;
14791478
}
14801479

14811480
// if requested, fill the difference of ITS and TPC tracks tgl for vdrift calibation

Detectors/GlobalTrackingWorkflow/src/PrimaryVertexingSpec.cxx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,9 @@ void PrimaryVertexingSpec::run(ProcessingContext& pc)
6262
double timeCPU0 = mTimer.CpuTime(), timeReal0 = mTimer.RealTime();
6363
mTimer.Start(false);
6464
const auto tracksITSTPC = pc.inputs().get<gsl::span<o2::dataformats::TrackTPCITS>>("match");
65-
gsl::span<const o2::MCCompLabel> lblITS, lblTPC;
65+
gsl::span<const o2::MCCompLabel> lblTPCITS;
6666
if (mUseMC) {
67-
lblITS = pc.inputs().get<gsl::span<o2::MCCompLabel>>("lblITS");
68-
lblTPC = pc.inputs().get<gsl::span<o2::MCCompLabel>>("lblTPC");
67+
lblTPCITS = pc.inputs().get<gsl::span<o2::MCCompLabel>>("lblTPCITS");
6968
}
7069
std::vector<PVertex> vertices;
7170
std::vector<GIndex> vertexTrackIDs;
@@ -94,7 +93,7 @@ void PrimaryVertexingSpec::run(ProcessingContext& pc)
9493
}
9594
}
9695

97-
mVertexer.process(tracksITSTPC, idxVec, ft0Data, vertices, vertexTrackIDs, v2tRefs, lblITS, lblTPC, lblVtx);
96+
mVertexer.process(tracksITSTPC, idxVec, ft0Data, vertices, vertexTrackIDs, v2tRefs, lblTPCITS, lblVtx);
9897
pc.outputs().snapshot(Output{"GLO", "PVTX", 0, Lifetime::Timeframe}, vertices);
9998
pc.outputs().snapshot(Output{"GLO", "PVTX_CONTIDREFS", 0, Lifetime::Timeframe}, v2tRefs);
10099
pc.outputs().snapshot(Output{"GLO", "PVTX_CONTID", 0, Lifetime::Timeframe}, vertexTrackIDs);
@@ -129,8 +128,7 @@ DataProcessorSpec getPrimaryVertexingSpec(bool validateWithFT0, bool useMC)
129128
outputs.emplace_back("GLO", "PVTX_CONTIDREFS", 0, Lifetime::Timeframe);
130129

131130
if (useMC) {
132-
inputs.emplace_back("lblITS", "GLO", "TPCITS_ITSMC", 0, Lifetime::Timeframe);
133-
inputs.emplace_back("lblTPC", "GLO", "TPCITS_TPCMC", 0, Lifetime::Timeframe);
131+
inputs.emplace_back("lblTPCITS", "GLO", "TPCITS_MC", 0, Lifetime::Timeframe);
134132
outputs.emplace_back("GLO", "PVTX_MCTR", 0, Lifetime::Timeframe);
135133
}
136134

Detectors/GlobalTrackingWorkflow/tofworkflow/src/RecoWorkflowWithTPCSpec.cxx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@ o2::framework::DataProcessorSpec getTOFRecoWorkflowWithTPCSpec(bool useMC, bool
167167

168168
if (useMC) {
169169
outputs.emplace_back(o2::header::gDataOriginTOF, "MCMATCHTOF_TPC", 0, Lifetime::Timeframe);
170-
outputs.emplace_back(o2::header::gDataOriginTOF, "MCMATCHTPC_TPC", 0, Lifetime::Timeframe);
171-
outputs.emplace_back(o2::header::gDataOriginTOF, "MCMATCHITS_TPC", 0, Lifetime::Timeframe);
172170
}
173171
outputs.emplace_back(o2::header::gDataOriginTOF, "CALIBDATA_TPC", 0, Lifetime::Timeframe);
174172

Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/src/TPCInterpolationSpec.cxx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,6 @@ DataProcessorSpec getTPCInterpolationSpec(bool useMC, const std::vector<int>& tp
9696

9797
if (useMC) {
9898
LOG(FATAL) << "MC usage must be disabled for this workflow, since it is not yet implemented";
99-
// are the MC inputs from ITS-TPC matching and TOF matching duplicates? if trackITSMCTR == matchTOFMCITS one of them should be removed
100-
inputs.emplace_back("trackITSMCTR", "GLO", "TPCITS_ITSMC", 0, Lifetime::Timeframe);
101-
inputs.emplace_back("trackTPCMCTR", "GLO", "TPCITSMC", 0, Lifetime::Timeframe);
102-
inputs.emplace_back("matchTOFMC", o2::header::gDataOriginTOF, "MCMATCHTOF", 0, Lifetime::Timeframe);
103-
inputs.emplace_back("matchTOFMCTPC", o2::header::gDataOriginTOF, "MCMATCHTPC", 0, Lifetime::Timeframe);
104-
inputs.emplace_back("matchTOFMCITS", o2::header::gDataOriginTOF, "MCMATCHITS", 0, Lifetime::Timeframe);
10599
}
106100

107101
outputs.emplace_back("GLO", "TPCINT_TRK", 0, Lifetime::Timeframe);

Detectors/TRD/workflow/src/TRDGlobalTrackingSpec.cxx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,6 @@ DataProcessorSpec getTRDGlobalTrackingSpec(bool useMC)
175175

176176
if (useMC) {
177177
LOG(FATAL) << "MC usage must be disabled for this workflow, since it is not yet implemented";
178-
//inputs.emplace_back("itstracklabel", "GLO", "TPCITS_ITSMC", 0, Lifetime::Timeframe);
179-
//inputs.emplace_back("tpctracklabel", "GLO", "TPCITS_TPCMC", 0, Lifetime::Timeframe);
180178
}
181179

182180
outputs.emplace_back(o2::header::gDataOriginTRD, "MATCHTRD", 0, Lifetime::Timeframe);

Detectors/Vertexing/include/DetectorsVertexing/PVertexer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ class PVertexer
5454
template <typename TR, typename BC>
5555
int process(const TR& tracks, const gsl::span<o2d::GlobalTrackID> gids, const BC& bcData,
5656
std::vector<PVertex>& vertices, std::vector<o2d::VtxTrackIndex>& vertexTrackIDs, std::vector<V2TRef>& v2tRefs,
57-
gsl::span<const o2::MCCompLabel> lblITS, gsl::span<const o2::MCCompLabel> lblTPC, std::vector<o2::MCEventLabel>& lblVtx)
57+
gsl::span<const o2::MCCompLabel> lblTracks, std::vector<o2::MCEventLabel>& lblVtx)
5858
{
5959
auto nv = process(tracks, gids, bcData, vertices, vertexTrackIDs, v2tRefs);
60-
if (lblITS.size() && lblTPC.size()) {
61-
createMCLabels(lblITS, lblTPC, vertices, vertexTrackIDs, v2tRefs, lblVtx);
60+
if (lblTracks.size()) {
61+
createMCLabels(lblTracks, vertices, vertexTrackIDs, v2tRefs, lblVtx);
6262
}
6363
return nv;
6464
}
@@ -67,7 +67,7 @@ class PVertexer
6767
int process(const TR& tracks, const gsl::span<o2d::GlobalTrackID> gids, const BC& bcData,
6868
std::vector<PVertex>& vertices, std::vector<o2d::VtxTrackIndex>& vertexTrackIDs, std::vector<V2TRef>& v2tRefs);
6969

70-
static void createMCLabels(gsl::span<const o2::MCCompLabel> lblITS, gsl::span<const o2::MCCompLabel> lblTPC,
70+
static void createMCLabels(gsl::span<const o2::MCCompLabel> lblTracks,
7171
const std::vector<PVertex> vertices, const std::vector<o2d::VtxTrackIndex> vertexTrackIDs, const std::vector<V2TRef> v2tRefs,
7272
std::vector<o2::MCEventLabel>& lblVtx);
7373
bool findVertex(const VertexingInput& input, PVertex& vtx);

Detectors/Vertexing/src/PVertexer.cxx

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -373,17 +373,17 @@ void PVertexer::finalizeVertex(const VertexingInput& input, const PVertex& vtx,
373373
}
374374

375375
//___________________________________________________________________
376-
void PVertexer::createMCLabels(gsl::span<const o2::MCCompLabel> lblITS, gsl::span<const o2::MCCompLabel> lblTPC,
377-
const std::vector<PVertex> vertices, const std::vector<o2::dataformats::VtxTrackIndex> vertexTrackIDs, const std::vector<V2TRef> v2tRefs,
376+
void PVertexer::createMCLabels(gsl::span<const o2::MCCompLabel> lblTracks, const std::vector<PVertex> vertices,
377+
const std::vector<o2::dataformats::VtxTrackIndex> vertexTrackIDs, const std::vector<V2TRef> v2tRefs,
378378
std::vector<o2::MCEventLabel>& lblVtx)
379379
{
380380
lblVtx.clear();
381381
int nv = vertices.size();
382-
if (lblITS.size() != lblITS.size() || !lblITS.size()) {
383-
LOG(ERROR) << "labels are not provided or incorrect";
382+
if (!lblTracks.size()) {
383+
LOG(ERROR) << "Track labels are not provided";
384384
return;
385385
}
386-
std::unordered_map<o2::MCEventLabel, int> labelOccurenceCorr, labelOccurenceITS;
386+
std::unordered_map<o2::MCEventLabel, int> labelOccurenceCorr;
387387

388388
auto bestLbl = [](std::unordered_map<o2::MCEventLabel, int> mp, int norm) -> o2::MCEventLabel {
389389
o2::MCEventLabel best;
@@ -403,25 +403,19 @@ void PVertexer::createMCLabels(gsl::span<const o2::MCCompLabel> lblITS, gsl::spa
403403
for (const auto& v2t : v2tRefs) {
404404
int tref = v2t.getFirstEntry(), last = tref + v2t.getEntries();
405405
labelOccurenceCorr.clear();
406-
labelOccurenceITS.clear();
407406
o2::MCEventLabel winner; // unset at the moment
408407
for (; tref < last; tref++) {
409408
int tid = vertexTrackIDs[tref].getIndex();
410-
const auto& lITS = lblITS[tid];
411-
const auto& lTPC = lblTPC[tid];
412-
if (!lITS.isSet() || !lTPC.isSet()) {
409+
const auto& lbl = lblTracks[tid];
410+
if (!lbl.isSet()) {
413411
break;
414412
}
415-
if (lITS.getTrackID() == lTPC.getTrackID() && lITS.getEventID() == lTPC.getEventID() && lITS.getSourceID() == lTPC.getSourceID()) {
416-
labelOccurenceCorr[{lITS.getEventID(), lITS.getSourceID(), 0.}]++;
417-
} else {
418-
labelOccurenceITS[{lITS.getEventID(), lITS.getSourceID(), 0.}]++;
413+
if (!lbl.isFake()) {
414+
labelOccurenceCorr[{lbl.getEventID(), lbl.getSourceID(), 0.}]++;
419415
}
420416
}
421417
if (labelOccurenceCorr.size()) {
422418
winner = bestLbl(labelOccurenceCorr, v2t.getEntries());
423-
} else if (labelOccurenceITS.size()) {
424-
winner = bestLbl(labelOccurenceITS, 0); // in absence of correct matches, set the ITS only label but set its weight to 0
425419
}
426420
lblVtx.push_back(winner);
427421
}

0 commit comments

Comments
 (0)