Skip to content

Commit 5042672

Browse files
committed
GPU QA: Proper fix for fetching timebins of MC data
1 parent 88321c2 commit 5042672

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

GPU/GPUTracking/display/render/GPUDisplayDraw.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,9 @@ void GPUDisplay::DrawFinal(int32_t iSector, int32_t /*iCol*/, const GPUTPCGMProp
539539
if (mc.pid < 0) {
540540
break;
541541
}
542+
if (mc.t0 == -100.f) {
543+
break;
544+
}
542545

543546
alphaOrg = mParam->Alpha(iSector);
544547
float c = cosf(alphaOrg);

GPU/GPUTracking/qa/GPUQA.cxx

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,27 @@ void GPUQA::InitO2MCData(GPUTrackingInOutPointers* updateIOPtr)
673673
std::vector<int32_t> refId;
674674

675675
auto dc = o2::steer::DigitizationContext::loadFromFile("collisioncontext.root");
676-
auto evrec = dc->getEventRecords();
676+
const auto& evrec = dc->getEventRecords();
677+
const auto& evparts = dc->getEventParts();
678+
std::vector<std::vector<float>> evTimeBins(mcReader.getNSources());
679+
for (uint32_t i = 0; i < evTimeBins.size(); i++) {
680+
evTimeBins[i].resize(mcReader.getNEvents(i), -100.f);
681+
}
682+
for (uint32_t i = 0; i < evrec.size(); i++) {
683+
const auto& ir = evrec[i];
684+
for (uint32_t j = 0; j < evparts[i].size(); j++) {
685+
const int iSim = evparts[i][j].sourceID;
686+
const int iEv = evparts[i][j].entryID;
687+
if (iSim == o2::steer::QEDSOURCEID || ir.differenceInBC(o2::raw::HBFUtils::Instance().getFirstIR()) >= 0) {
688+
auto ir0 = o2::raw::HBFUtils::Instance().getFirstIRofTF(ir);
689+
float timebin = (float)ir.differenceInBC(ir0) / o2::tpc::constants::LHCBCPERTIMEBIN;
690+
if (evTimeBins[iSim][iEv] >= 0) {
691+
throw std::runtime_error("Multiple time bins for same MC collision found");
692+
}
693+
evTimeBins[iSim][iEv] = timebin;
694+
}
695+
}
696+
}
677697

678698
uint32_t nSimSources = mcReader.getNSources();
679699
mMCEventOffset.resize(nSimSources);
@@ -687,9 +707,7 @@ void GPUQA::InitO2MCData(GPUTrackingInOutPointers* updateIOPtr)
687707
mMCInfosCol.resize(nSimTotalEvents);
688708
for (int32_t iSim = 0; iSim < mcReader.getNSources(); iSim++) {
689709
for (int32_t i = 0; i < mcReader.getNEvents(iSim); i++) {
690-
auto ir = evrec[i];
691-
auto ir0 = o2::raw::HBFUtils::Instance().getFirstIRofTF(ir);
692-
float timebin = (float)ir.differenceInBC(ir0) / o2::tpc::constants::LHCBCPERTIMEBIN;
710+
const float timebin = evTimeBins[iSim][i];
693711

694712
const std::vector<o2::MCTrack>& tracks = mcReader.getTracks(iSim, i);
695713
const std::vector<o2::TrackReference>& trackRefs = mcReader.getTrackRefsByEvent(iSim, i);
@@ -1295,6 +1313,9 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
12951313
if (mc1.pid < 0) {
12961314
continue;
12971315
}
1316+
if (mc1.t0 == -100.f) {
1317+
continue;
1318+
}
12981319
if (mConfig.filterCharge && mc1.charge * mConfig.filterCharge < 0) {
12991320
continue;
13001321
}

0 commit comments

Comments
 (0)