From ce114af9693009b8d0c29cd947eb8adab56da680 Mon Sep 17 00:00:00 2001 From: Ole Schmidt Date: Wed, 8 May 2024 16:45:16 +0200 Subject: [PATCH] Publish CTF sizes only for detectors included in run --- Modules/GLO/include/GLO/CTFSizeTask.h | 1 + Modules/GLO/src/CTFSizeTask.cxx | 24 +++++++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Modules/GLO/include/GLO/CTFSizeTask.h b/Modules/GLO/include/GLO/CTFSizeTask.h index da1c9307f0..ae1e61a6a3 100644 --- a/Modules/GLO/include/GLO/CTFSizeTask.h +++ b/Modules/GLO/include/GLO/CTFSizeTask.h @@ -54,6 +54,7 @@ class CTFSize final : public TaskInterface std::array mHistSizes{ nullptr }; // CTF size per TF for each detector with different binning per detector std::array mHistSizesLog{ nullptr }; // CTF size per TF with same axis scale for all detectors std::array mDefaultBinning{ "" }; // default number of bins and limits for mHistSizes (customizable) + std::array mIsDetEnabled{ false }; // flag which detector is included in the run bool mPublishingDone{ false }; }; diff --git a/Modules/GLO/src/CTFSizeTask.cxx b/Modules/GLO/src/CTFSizeTask.cxx index 781be1df29..32254ae22e 100644 --- a/Modules/GLO/src/CTFSizeTask.cxx +++ b/Modules/GLO/src/CTFSizeTask.cxx @@ -14,13 +14,16 @@ /// \author Ole Schmidt /// +#include #include #include #include "QualityControl/QcInfoLogger.h" +#include "Common/Utils.h" #include "GLO/CTFSizeTask.h" #include using namespace o2::detectors; +using namespace o2::quality_control_modules::common; namespace o2::quality_control_modules::glo { @@ -63,6 +66,9 @@ void CTFSize::initialize(o2::framework::InitContext& /*ctx*/) mDefaultBinning[DetID::CTP] = "100, 1, 100"; mDefaultBinning[DetID::TST] = "1, 0, 1"; + std::string detList = getFromConfig(mCustomParameters, "detectors", "all"); + auto detMask = DetID::getMask(detList); + constexpr int nLogBins = 100; float xBins[nLogBins + 1]; float xBinLogMin = 0.f; @@ -72,9 +78,12 @@ void CTFSize::initialize(o2::framework::InitContext& /*ctx*/) xBins[iBin] = TMath::Power(10, xBinLogMin + iBin * logBinWidth); } for (int iDet = 0; iDet < DetID::CTP + 1; ++iDet) { - mHistSizesLog[iDet] = new TH1F(Form("hSizeLog_%s", DetID::getName(iDet)), Form("%s CTF size per TF;Byte;counts", DetID::getName(iDet)), nLogBins, xBins); - getObjectsManager()->startPublishing(mHistSizesLog[iDet]); - getObjectsManager()->setDefaultDrawOptions(mHistSizesLog[iDet]->GetName(), "logx"); + if (detMask[iDet]) { + mIsDetEnabled[iDet] = true; + mHistSizesLog[iDet] = new TH1F(Form("hSizeLog_%s", DetID::getName(iDet)), Form("%s CTF size per TF;Byte;counts", DetID::getName(iDet)), nLogBins, xBins); + getObjectsManager()->startPublishing(mHistSizesLog[iDet]); + getObjectsManager()->setDefaultDrawOptions(mHistSizesLog[iDet]->GetName(), "logx"); + } } } @@ -82,6 +91,9 @@ void CTFSize::startOfActivity(const Activity& activity) { if (!mPublishingDone) { for (int iDet = 0; iDet < DetID::CTP + 1; ++iDet) { + if (!mIsDetEnabled[iDet]) { + continue; + } auto binning = getBinningFromConfig(iDet, activity); std::string unit = (iDet == DetID::EMC || iDet == DetID::CPV) ? "B" : "kB"; mHistSizes[iDet] = new TH1F(Form("hSize_%s", DetID::getName(iDet)), Form("%s CTF size per TF;%s;counts", DetID::getName(iDet), unit.c_str()), std::get<0>(binning), std::get<1>(binning), std::get<2>(binning)); @@ -94,14 +106,16 @@ void CTFSize::startOfActivity(const Activity& activity) void CTFSize::startOfCycle() { - // reset(); } void CTFSize::monitorData(o2::framework::ProcessingContext& ctx) { const auto sizes = ctx.inputs().get>("ctfSizes"); for (int iDet = 0; iDet <= DetID::CTP; ++iDet) { - std::cout << DetID::getName(iDet) << ": " << sizes[iDet] << std::endl; + ILOG(Debug, Devel) << fmt::format("Det {} : is enabled {}, data size {}", DetID::getName(iDet), mIsDetEnabled[iDet], sizes[iDet]) << ENDM; + if (!mIsDetEnabled[iDet]) { + continue; + } float conversion = (iDet == DetID::EMC || iDet == DetID::CPV) ? 1.f : 1024.f; // EMC and CPV can sent <1kB per CTF mHistSizes[iDet]->Fill(sizes[iDet] / conversion); mHistSizesLog[iDet]->Fill(sizes[iDet]);