Skip to content

Commit 792df66

Browse files
authored
ITS: fix opt. label output if firstOrbit!=0 (#14532)
1 parent 3922d50 commit 792df66

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

Detectors/ITSMFT/ITS/tracking/src/VertexerTraits.cxx

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "SimulationDataFormat/DigitizationContext.h"
2626
#include "Steer/MCKinematicsReader.h"
2727
#include "ITSMFTBase/DPLAlpideParam.h"
28+
#include "DetectorsRaw/HBFUtils.h"
2829

2930
#ifdef VTX_DEBUG
3031
#include "TTree.h"
@@ -574,16 +575,25 @@ void VertexerTraits::addTruthSeedingVertices()
574575
int64_t roFrameBiasInBC = o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>::Instance().roFrameBiasInBC;
575576
int64_t roFrameLengthInBC = o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>::Instance().roFrameLengthInBC;
576577
o2::steer::MCKinematicsReader mcReader(dc);
577-
std::map<int, bounded_vector<Vertex>> vertices;
578+
struct VertInfo {
579+
bounded_vector<Vertex> vertices;
580+
bounded_vector<int> srcs;
581+
bounded_vector<int> events;
582+
};
583+
std::map<int, VertInfo> vertices;
578584
for (int iSrc{0}; iSrc < mcReader.getNSources(); ++iSrc) {
579585
auto eveId2colId = dc->getCollisionIndicesForSource(iSrc);
580586
for (int iEve{0}; iEve < mcReader.getNEvents(iSrc); ++iEve) {
581587
const auto& ir = irs[eveId2colId[iEve]];
582588
if (!ir.isDummy()) { // do we need this, is this for diffractive events?
583589
const auto& eve = mcReader.getMCEventHeader(iSrc, iEve);
584-
int rofId = (ir.toLong() - roFrameBiasInBC) / roFrameLengthInBC;
590+
int rofId = ((ir - raw::HBFUtils::Instance().getFirstSampledTFIR()).toLong() - roFrameBiasInBC) / roFrameLengthInBC;
585591
if (!vertices.contains(rofId)) {
586-
vertices[rofId] = bounded_vector<Vertex>(mMemoryPool.get());
592+
vertices[rofId] = {
593+
.vertices = bounded_vector<Vertex>(mMemoryPool.get()),
594+
.srcs = bounded_vector<int>(mMemoryPool.get()),
595+
.events = bounded_vector<int>(mMemoryPool.get()),
596+
};
587597
}
588598
Vertex vert;
589599
vert.setTimeStamp(rofId);
@@ -594,7 +604,9 @@ void VertexerTraits::addTruthSeedingVertices()
594604
vert.setChi2(1);
595605
constexpr float cov = 50e-9;
596606
vert.setCov(cov, cov, cov, cov, cov, cov);
597-
vertices[rofId].push_back(vert);
607+
vertices[rofId].vertices.push_back(vert);
608+
vertices[rofId].srcs.push_back(iSrc);
609+
vertices[rofId].events.push_back(iEve);
598610
}
599611
}
600612
}
@@ -603,10 +615,11 @@ void VertexerTraits::addTruthSeedingVertices()
603615
bounded_vector<Vertex> verts(mMemoryPool.get());
604616
bounded_vector<std::pair<o2::MCCompLabel, float>> polls(mMemoryPool.get());
605617
if (vertices.contains(iROF)) {
606-
verts = vertices[iROF];
618+
const auto& vertInfo = vertices[iROF];
619+
verts = vertInfo.vertices;
607620
nVerts += verts.size();
608621
for (size_t i{0}; i < verts.size(); ++i) {
609-
o2::MCCompLabel lbl; // unset label for now
622+
o2::MCCompLabel lbl(o2::MCCompLabel::maxTrackID(), vertInfo.events[i], vertInfo.srcs[i], false);
610623
polls.emplace_back(lbl, 1.f);
611624
}
612625
} else {

Detectors/ITSMFT/ITS/workflow/src/TrackerSpec.cxx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "Framework/ConfigParamRegistry.h"
1616
#include "Framework/CCDBParamSpec.h"
1717
#include "ITSWorkflow/TrackerSpec.h"
18+
#include "ITStracking/TrackingConfigParam.h"
1819

1920
namespace o2
2021
{
@@ -120,10 +121,12 @@ DataProcessorSpec getTrackerSpec(bool useMC, bool useGeom, int trgType, Tracking
120121
inputs.emplace_back("itsmclabels", "ITS", "CLUSTERSMCTR", 0, Lifetime::Timeframe);
121122
inputs.emplace_back("ITSMC2ROframes", "ITS", "CLUSTERSMC2ROF", 0, Lifetime::Timeframe);
122123
outputs.emplace_back("ITS", "VERTICESMCTR", 0, Lifetime::Timeframe);
123-
outputs.emplace_back("ITS", "VERTICESMCTRCONT", 0, Lifetime::Timeframe);
124124
outputs.emplace_back("ITS", "VERTICESMCPUR", 0, Lifetime::Timeframe);
125125
outputs.emplace_back("ITS", "TRACKSMCTR", 0, Lifetime::Timeframe);
126126
outputs.emplace_back("ITS", "ITSTrackMC2ROF", 0, Lifetime::Timeframe);
127+
if (VertexerParamConfig::Instance().outputContLabels) {
128+
outputs.emplace_back("ITS", "VERTICESMCTRCONT", 0, Lifetime::Timeframe);
129+
}
127130
}
128131

129132
return DataProcessorSpec{

0 commit comments

Comments
 (0)