From 79d4f0910abba6713e81391c073a08b5b1a41b84 Mon Sep 17 00:00:00 2001 From: David Rohr Date: Mon, 25 Aug 2025 11:42:22 +0200 Subject: [PATCH 1/3] Revert "Skip QED events in TPC QA" This reverts commit dce7e0eacaa2797137b8be695ec64310f4d9569a. --- GPU/GPUTracking/qa/GPUQA.cxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/GPU/GPUTracking/qa/GPUQA.cxx b/GPU/GPUTracking/qa/GPUQA.cxx index 4fb2ee4dd58d9..2e9c3a1870385 100644 --- a/GPU/GPUTracking/qa/GPUQA.cxx +++ b/GPU/GPUTracking/qa/GPUQA.cxx @@ -686,9 +686,6 @@ void GPUQA::InitO2MCData(GPUTrackingInOutPointers* updateIOPtr) mMCInfosCol.resize(nSimTotalEvents); for (int32_t iSim = 0; iSim < mcReader.getNSources(); iSim++) { - if (iSim == o2::steer::QEDSOURCEID) { - continue; - } for (int32_t i = 0; i < mcReader.getNEvents(iSim); i++) { auto ir = evrec[i]; auto ir0 = o2::raw::HBFUtils::Instance().getFirstIRofTF(ir); From ee0eff42e81821c1e1e5b4e68538d95c0139465a Mon Sep 17 00:00:00 2001 From: David Rohr Date: Mon, 25 Aug 2025 13:32:16 +0200 Subject: [PATCH 2/3] Minor fixes of debug printouts --- .../common/include/CommonDataFormat/InteractionRecord.h | 4 ++-- GPU/GPUTracking/Base/GPUReconstructionCPU.cxx | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DataFormats/common/include/CommonDataFormat/InteractionRecord.h b/DataFormats/common/include/CommonDataFormat/InteractionRecord.h index 7aa3ccdd5d12c..e99f338a16343 100644 --- a/DataFormats/common/include/CommonDataFormat/InteractionRecord.h +++ b/DataFormats/common/include/CommonDataFormat/InteractionRecord.h @@ -281,7 +281,7 @@ struct InteractionRecord { return tmp; } -#ifndef GPUCA_ALIGPUCODE +#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE) void print() const; std::string asString() const; friend std::ostream& operator<<(std::ostream& stream, InteractionRecord const& ir); @@ -359,7 +359,7 @@ struct InteractionTimeRecord : public InteractionRecord { return !((*this) > other); } -#ifndef GPUCA_ALIGPUCODE +#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE) void print() const; std::string asString() const; friend std::ostream& operator<<(std::ostream& stream, InteractionTimeRecord const& ir); diff --git a/GPU/GPUTracking/Base/GPUReconstructionCPU.cxx b/GPU/GPUTracking/Base/GPUReconstructionCPU.cxx index d29fc09f32f63..faa5ccbaf6a50 100644 --- a/GPU/GPUTracking/Base/GPUReconstructionCPU.cxx +++ b/GPU/GPUTracking/Base/GPUReconstructionCPU.cxx @@ -66,7 +66,7 @@ inline void GPUReconstructionCPU::runKernelBackend(const krnlSetupTime& _xyz, co int32_t nThreads = getNKernelHostThreads(false); if (nThreads > 1) { if (GetProcessingSettings().debugLevel >= 5) { - printf("Running %d Threads\n", mThreading->activeThreads->max_concurrency()); + GPUInfo("Running %d Threads", mThreading->activeThreads->max_concurrency()); } tbb::this_task_arena::isolate([&] { mThreading->activeThreads->execute([&] { @@ -227,7 +227,7 @@ int32_t GPUReconstructionCPU::RunChains() mNEventsProcessed++; if (GetProcessingSettings().debugLevel >= 3 || GetProcessingSettings().allocDebugLevel) { - printf("Allocated memory when starting processing %34s", ""); + GPUInfo("Allocated memory when starting processing %34s", ""); PrintMemoryOverview(); } mTimerTotal.Start(); @@ -254,7 +254,7 @@ int32_t GPUReconstructionCPU::RunChains() mTimerTotal.Stop(); mStatCPUTime += (double)(std::clock() - cpuTimerStart) / CLOCKS_PER_SEC; if (GetProcessingSettings().debugLevel >= 3 || GetProcessingSettings().allocDebugLevel) { - printf("Allocated memory when ending processing %36s", ""); + GPUInfo("Allocated memory when ending processing %36s", ""); PrintMemoryOverview(); } From 265039b9e4053bb4535fdf6773b8f21b10d781b5 Mon Sep 17 00:00:00 2001 From: David Rohr Date: Mon, 25 Aug 2025 13:32:59 +0200 Subject: [PATCH 3/3] GPU QA: Proper fix for fetching timebins of MC data --- .../display/render/GPUDisplayDraw.cxx | 3 ++ GPU/GPUTracking/qa/GPUQA.cxx | 29 ++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/GPU/GPUTracking/display/render/GPUDisplayDraw.cxx b/GPU/GPUTracking/display/render/GPUDisplayDraw.cxx index cbe385324ebbf..cccf0f098bd8d 100644 --- a/GPU/GPUTracking/display/render/GPUDisplayDraw.cxx +++ b/GPU/GPUTracking/display/render/GPUDisplayDraw.cxx @@ -539,6 +539,9 @@ void GPUDisplay::DrawFinal(int32_t iSector, int32_t /*iCol*/, const GPUTPCGMProp if (mc.pid < 0) { break; } + if (mc.t0 == -100.f) { + break; + } alphaOrg = mParam->Alpha(iSector); float c = cosf(alphaOrg); diff --git a/GPU/GPUTracking/qa/GPUQA.cxx b/GPU/GPUTracking/qa/GPUQA.cxx index 2e9c3a1870385..3f57ecd8f88be 100644 --- a/GPU/GPUTracking/qa/GPUQA.cxx +++ b/GPU/GPUTracking/qa/GPUQA.cxx @@ -673,7 +673,27 @@ void GPUQA::InitO2MCData(GPUTrackingInOutPointers* updateIOPtr) std::vector refId; auto dc = o2::steer::DigitizationContext::loadFromFile("collisioncontext.root"); - auto evrec = dc->getEventRecords(); + const auto& evrec = dc->getEventRecords(); + const auto& evparts = dc->getEventParts(); + std::vector> evTimeBins(mcReader.getNSources()); + for (uint32_t i = 0; i < evTimeBins.size(); i++) { + evTimeBins[i].resize(mcReader.getNEvents(i), -100.f); + } + for (uint32_t i = 0; i < evrec.size(); i++) { + const auto& ir = evrec[i]; + for (uint32_t j = 0; j < evparts[i].size(); j++) { + const int iSim = evparts[i][j].sourceID; + const int iEv = evparts[i][j].entryID; + if (iSim == o2::steer::QEDSOURCEID || ir.differenceInBC(o2::raw::HBFUtils::Instance().getFirstIR()) >= 0) { + auto ir0 = o2::raw::HBFUtils::Instance().getFirstIRofTF(ir); + float timebin = (float)ir.differenceInBC(ir0) / o2::tpc::constants::LHCBCPERTIMEBIN; + if (evTimeBins[iSim][iEv] >= 0) { + throw std::runtime_error("Multiple time bins for same MC collision found"); + } + evTimeBins[iSim][iEv] = timebin; + } + } + } uint32_t nSimSources = mcReader.getNSources(); mMCEventOffset.resize(nSimSources); @@ -687,9 +707,7 @@ void GPUQA::InitO2MCData(GPUTrackingInOutPointers* updateIOPtr) mMCInfosCol.resize(nSimTotalEvents); for (int32_t iSim = 0; iSim < mcReader.getNSources(); iSim++) { for (int32_t i = 0; i < mcReader.getNEvents(iSim); i++) { - auto ir = evrec[i]; - auto ir0 = o2::raw::HBFUtils::Instance().getFirstIRofTF(ir); - float timebin = (float)ir.differenceInBC(ir0) / o2::tpc::constants::LHCBCPERTIMEBIN; + const float timebin = evTimeBins[iSim][i]; const std::vector& tracks = mcReader.getTracks(iSim, i); const std::vector& trackRefs = mcReader.getTrackRefsByEvent(iSim, i); @@ -1295,6 +1313,9 @@ void GPUQA::RunQA(bool matchOnly, const std::vector* tracksEx if (mc1.pid < 0) { continue; } + if (mc1.t0 == -100.f) { + continue; + } if (mConfig.filterCharge && mc1.charge * mConfig.filterCharge < 0) { continue; }