Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 3 additions & 6 deletions Detectors/AOD/src/AODProducerWorkflowSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,6 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
auto tracksTPC = pc.inputs().get<gsl::span<o2::tpc::TrackTPC>>("trackTPC");
auto tracksTPCMCTruth = pc.inputs().get<gsl::span<o2::MCCompLabel>>("trackTPCMCTruth");
auto tracksITSMCTruth = pc.inputs().get<gsl::span<o2::MCCompLabel>>("trackITSMCTruth");
auto tracksITSTPC_ITSMC = pc.inputs().get<gsl::span<o2::MCCompLabel>>("tracksITSTPC_ITSMC");
auto tracksITSTPC_TPCMC = pc.inputs().get<gsl::span<o2::MCCompLabel>>("tracksITSTPC_TPCMC");

LOG(DEBUG) << "FOUND " << tracksTPC.size() << " TPC tracks";
LOG(DEBUG) << "FOUND " << tracksITS.size() << " ITS tracks";
Expand Down Expand Up @@ -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<uint32_t>::max();
labelITS = std::numeric_limits<uint32_t>::max();
labelTPC = std::numeric_limits<uint32_t>::max();
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion Detectors/GlobalTracking/src/MatchTPCITS.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 4 additions & 6 deletions Detectors/GlobalTrackingWorkflow/src/PrimaryVertexingSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<gsl::span<o2::dataformats::TrackTPCITS>>("match");
gsl::span<const o2::MCCompLabel> lblITS, lblTPC;
gsl::span<const o2::MCCompLabel> lblTPCITS;
if (mUseMC) {
lblITS = pc.inputs().get<gsl::span<o2::MCCompLabel>>("lblITS");
lblTPC = pc.inputs().get<gsl::span<o2::MCCompLabel>>("lblTPC");
lblTPCITS = pc.inputs().get<gsl::span<o2::MCCompLabel>>("lblTPCITS");
}
std::vector<PVertex> vertices;
std::vector<GIndex> vertexTrackIDs;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,6 @@ DataProcessorSpec getTPCInterpolationSpec(bool useMC, const std::vector<int>& 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);
Expand Down
2 changes: 0 additions & 2 deletions Detectors/TRD/workflow/src/TRDGlobalTrackingSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions Detectors/Vertexing/include/DetectorsVertexing/PVertexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ class PVertexer
template <typename TR, typename BC>
int process(const TR& tracks, const gsl::span<o2d::GlobalTrackID> gids, const BC& bcData,
std::vector<PVertex>& vertices, std::vector<o2d::VtxTrackIndex>& vertexTrackIDs, std::vector<V2TRef>& v2tRefs,
gsl::span<const o2::MCCompLabel> lblITS, gsl::span<const o2::MCCompLabel> lblTPC, std::vector<o2::MCEventLabel>& lblVtx)
gsl::span<const o2::MCCompLabel> lblTracks, std::vector<o2::MCEventLabel>& 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;
}
Expand All @@ -67,7 +67,7 @@ class PVertexer
int process(const TR& tracks, const gsl::span<o2d::GlobalTrackID> gids, const BC& bcData,
std::vector<PVertex>& vertices, std::vector<o2d::VtxTrackIndex>& vertexTrackIDs, std::vector<V2TRef>& v2tRefs);

static void createMCLabels(gsl::span<const o2::MCCompLabel> lblITS, gsl::span<const o2::MCCompLabel> lblTPC,
static void createMCLabels(gsl::span<const o2::MCCompLabel> lblTracks,
const std::vector<PVertex> vertices, const std::vector<o2d::VtxTrackIndex> vertexTrackIDs, const std::vector<V2TRef> v2tRefs,
std::vector<o2::MCEventLabel>& lblVtx);
bool findVertex(const VertexingInput& input, PVertex& vtx);
Expand Down
24 changes: 9 additions & 15 deletions Detectors/Vertexing/src/PVertexer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -373,17 +373,17 @@ void PVertexer::finalizeVertex(const VertexingInput& input, const PVertex& vtx,
}

//___________________________________________________________________
void PVertexer::createMCLabels(gsl::span<const o2::MCCompLabel> lblITS, gsl::span<const o2::MCCompLabel> lblTPC,
const std::vector<PVertex> vertices, const std::vector<o2::dataformats::VtxTrackIndex> vertexTrackIDs, const std::vector<V2TRef> v2tRefs,
void PVertexer::createMCLabels(gsl::span<const o2::MCCompLabel> lblTracks, const std::vector<PVertex> vertices,
const std::vector<o2::dataformats::VtxTrackIndex> vertexTrackIDs, const std::vector<V2TRef> v2tRefs,
std::vector<o2::MCEventLabel>& 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<o2::MCEventLabel, int> labelOccurenceCorr, labelOccurenceITS;
std::unordered_map<o2::MCEventLabel, int> labelOccurenceCorr;

auto bestLbl = [](std::unordered_map<o2::MCEventLabel, int> mp, int norm) -> o2::MCEventLabel {
o2::MCEventLabel best;
Expand All @@ -403,25 +403,19 @@ void PVertexer::createMCLabels(gsl::span<const o2::MCCompLabel> 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);
}
Expand Down