From d0344690c1a5910d3cd4621e366461265a7f2268 Mon Sep 17 00:00:00 2001 From: Thomas Klemenz Date: Thu, 26 Jan 2023 09:11:56 +0100 Subject: [PATCH 1/4] TPC: add occupancy plot to Cluster task --- Modules/TPC/include/TPC/ClusterVisualizer.h | 6 ++ Modules/TPC/include/TPC/Clusters.h | 1 + Modules/TPC/run/tpcQCClusterVisualizer.json | 7 +- Modules/TPC/run/tpcQCClusters_direct.json | 6 +- Modules/TPC/src/ClusterVisualizer.cxx | 87 ++++++++++++++++++++- Modules/TPC/src/Clusters.cxx | 9 ++- 6 files changed, 108 insertions(+), 8 deletions(-) diff --git a/Modules/TPC/include/TPC/ClusterVisualizer.h b/Modules/TPC/include/TPC/ClusterVisualizer.h index 1d08cf4abe..1ca259e52f 100644 --- a/Modules/TPC/include/TPC/ClusterVisualizer.h +++ b/Modules/TPC/include/TPC/ClusterVisualizer.h @@ -65,6 +65,12 @@ class ClusterVisualizer final : public quality_control::postprocessing::PostProc /// \param services Interface containing optional interfaces, for example DatabaseInterface void finalize(quality_control::postprocessing::Trigger, framework::ServiceRegistryRef) override; + template + void makeRadialProfile(o2::tpc::CalDet& calDet, TCanvas* canv, int nbinsY, float yMin, float yMax); + + template + void fillRadialHisto(TH2D& h2D, const o2::tpc::CalDet& calDet, const o2::tpc::Side side); + private: o2::ccdb::CcdbApi mCdbApi; std::string mHost; diff --git a/Modules/TPC/include/TPC/Clusters.h b/Modules/TPC/include/TPC/Clusters.h index 3c0eb3bb53..f23cd65c76 100644 --- a/Modules/TPC/include/TPC/Clusters.h +++ b/Modules/TPC/include/TPC/Clusters.h @@ -63,6 +63,7 @@ class Clusters /*final*/ : public TaskInterface // todo add back the "final" whe std::vector> mSigmaTimeCanvasVec{}; ///< summary canvases of the SigmaTime object std::vector> mSigmaPadCanvasVec{}; ///< summary canvases of the SigmaPad object std::vector> mTimeBinCanvasVec{}; ///< summary canvases of the TimeBin object + std::vector> mOccupancyCanvasVec{}; ///< summary canvases of the Occupancy object void processClusterNative(o2::framework::InputRecord& inputs); void processKrClusters(o2::framework::InputRecord& inputs); diff --git a/Modules/TPC/run/tpcQCClusterVisualizer.json b/Modules/TPC/run/tpcQCClusterVisualizer.json index 95015deab8..fa11f30494 100644 --- a/Modules/TPC/run/tpcQCClusterVisualizer.json +++ b/Modules/TPC/run/tpcQCClusterVisualizer.json @@ -60,10 +60,11 @@ { "Q_Tot" : [ "600", "0", "600" ] }, { "Sigma_Time" : [ "200", "0", "2" ] }, { "Sigma_Pad" : [ "200", "0", "2" ] }, - { "Time_Bin" : [ "1000", "0", "100000" ] } + { "Time_Bin" : [ "1000", "0", "100000" ] }, + { "Occupancy" : [ "100", "0", "0.001" ] } ], "path_comment": "This is the path of the ClustersData object that shall be visualized.", - "path": "TPC/MO/Clusters/ClusterData", + "path": "qc/TPC/MO/Clusters/ClusterData", "dataType_comment": "This is the switch for 'RawDigits' or 'Clusters' task. Choose 'raw' or 'clusters'.", "dataType": "clusters", "initTrigger": [ @@ -71,7 +72,7 @@ ], "updateTrigger_comment": "To trigger on a specific file being updated, use e.g. 'newobject:qcdb:TPC/Calib/Noise'", "updateTrigger": [ - "newobject:qcdb:TPC/MO/Clusters/ClusterData" + "newobject:ccdb:qc/TPC/MO/Clusters/ClusterData" ], "stopTrigger": [ "userorcontrol" diff --git a/Modules/TPC/run/tpcQCClusters_direct.json b/Modules/TPC/run/tpcQCClusters_direct.json index 37509e8539..a30dd1ade1 100644 --- a/Modules/TPC/run/tpcQCClusters_direct.json +++ b/Modules/TPC/run/tpcQCClusters_direct.json @@ -28,7 +28,8 @@ "className": "o2::quality_control_modules::tpc::Clusters", "moduleName": "QcTPC", "detectorName": "TPC", - "cycleDurationSeconds": "10", + "cycleDurationSeconds": "60", + "maxNumberCycles": "-1", "resetAfterCycles": "5", "dataSource": { "type": "direct", @@ -41,7 +42,8 @@ "QtotNBins": "600", "QtotXMin": "0", "QtotXMax": "600", "SigmaPadNBins": "200", "SigmaPadXMin": "0", "SigmaPadXMax": "2", "SigmaTimeNBins": "200", "SigmaTimeXMin": "0", "SigmaTimeXMax": "2", - "TimeBinNBins": "1000", "TimeBinXMin": "0", "TimeBinXMax": "100000" + "TimeBinNBins": "1000", "TimeBinXMin": "0", "TimeBinXMax": "100000", + "OccupancyNBins": "1000", "OccupancyXMin": "0", "OccupancyXMax": "0.00001" }, "location": "local", "localMachines": [ diff --git a/Modules/TPC/src/ClusterVisualizer.cxx b/Modules/TPC/src/ClusterVisualizer.cxx index 8a8fe23680..32e774a13e 100644 --- a/Modules/TPC/src/ClusterVisualizer.cxx +++ b/Modules/TPC/src/ClusterVisualizer.cxx @@ -120,14 +120,16 @@ void ClusterVisualizer::configure(const boost::property_tree::ptree& config) "Q_Tot", "Sigma_Pad", "Sigma_Time", - "Time_Bin" + "Time_Bin", + "Occupancy" }; } else if (type == "raw") { mIsClusters = false; mObservables = { "N_RawDigits", "Q_Max", - "Time_Bin" + "Time_Bin", + "Occupancy" }; } else { ILOG(Error, Support) << "No valid data type given. 'dataType' has to be either 'clusters' or 'raw'." << ENDM; @@ -153,12 +155,25 @@ void ClusterVisualizer::initialize(Trigger, framework::ServiceRegistryRef) mStoreMaps.size() > 1 ? mStoreMaps.at(calDetIter) : mStoreMaps.at(0)); calDetIter++; } + if (mIsClusters) { + mCalDetCanvasVec.emplace_back(std::vector>()); + addAndPublish(getObjectsManager(), + mCalDetCanvasVec.back(), + { "c_radial_profile_Occupancy" }, + mStoreMaps.size() > 1 ? mStoreMaps.at(calDetIter) : mStoreMaps.at(0)); + } } void ClusterVisualizer::update(Trigger t, framework::ServiceRegistryRef) { ILOG(Info, Support) << "Trigger type is: " << t.triggerType << ", the timestamp is " << t.timestamp << ENDM; + for (auto& vec : mCalDetCanvasVec) { + for (auto& canvas : vec) { + canvas.get()->Clear(); + } + } + auto calDetIter = 0; std::unique_ptr clusterData(mCdbApi.retrieveFromTFileAny(mPath, @@ -199,6 +214,14 @@ void ClusterVisualizer::update(Trigger t, framework::ServiceRegistryRef) vecPtr = toVector(mCalDetCanvasVec.at(calDetIter)); o2::tpc::painter::makeSummaryCanvases(calDet, int(mRanges[calDet.getName()].at(0)), mRanges[calDet.getName()].at(1), mRanges[calDet.getName()].at(2), false, &vecPtr); calDetIter++; + + calDet = clusters.getOccupancy(); + vecPtr = toVector(mCalDetCanvasVec.at(calDetIter)); + o2::tpc::painter::makeSummaryCanvases(calDet, int(mRanges[calDet.getName()].at(0)), mRanges[calDet.getName()].at(1), mRanges[calDet.getName()].at(2), false, &vecPtr); + calDetIter++; + vecPtr = toVector(mCalDetCanvasVec.at(calDetIter)); + makeRadialProfile(calDet, vecPtr.at(0), int(mRanges[calDet.getName()].at(0)), mRanges[calDet.getName()].at(1), mRanges[calDet.getName()].at(2)); + calDetIter++; } void ClusterVisualizer::finalize(Trigger t, framework::ServiceRegistryRef) @@ -214,4 +237,64 @@ void ClusterVisualizer::finalize(Trigger t, framework::ServiceRegistryRef) } } +template +void ClusterVisualizer::makeRadialProfile(o2::tpc::CalDet& calDet, TCanvas* canv, int nbinsY, float yMin, float yMax) +{ + const std::string_view calName = calDet.getName(); + const auto radialBinning = o2::tpc::painter::getRowBinningCM(); + + auto hAside2D = new TH2D(fmt::format("h_{}_radialProfile_Aside", calName).data(), fmt::format("{}: Radial profile (A-Side)", calName).data(), radialBinning.size() - 1, radialBinning.data(), nbinsY, yMin, yMax); + hAside2D->GetXaxis()->SetTitle("x (cm)"); + hAside2D->GetYaxis()->SetTitle(fmt::format("{}", calName).data()); + hAside2D->SetTitleOffset(1.05, "XY"); + hAside2D->SetTitleSize(0.05, "XY"); + hAside2D->SetStats(0); + + auto hCside2D = new TH2D(fmt::format("h_{}_radialProfile_Cside", calName).data(), fmt::format("{}: Radial profile (C-Side)", calName).data(), radialBinning.size() - 1, radialBinning.data(), nbinsY, yMin, yMax); + hCside2D->GetXaxis()->SetTitle("x (cm)"); + hCside2D->GetYaxis()->SetTitle(fmt::format("{}", calName).data()); + hCside2D->SetTitleOffset(1.05, "XY"); + hCside2D->SetTitleSize(0.05, "XY"); + hCside2D->SetStats(0); + + fillRadialHisto(*hAside2D, calDet, o2::tpc::Side::A); + fillRadialHisto(*hCside2D, calDet, o2::tpc::Side::C); + + canv->Divide(1, 2); + canv->cd(1); + hAside2D->Draw("colz"); + hAside2D->SetStats(0); + hAside2D->ProfileX("profile_ASide", 1, -1, "d,same"); + + canv->cd(2); + hCside2D->Draw("colz"); + hCside2D->ProfileX("profile_CSide", 1, -1, "d,same"); + hAside2D->SetStats(0); + + hAside2D->SetBit(TObject::kCanDelete); + hCside2D->SetBit(TObject::kCanDelete); +} + +template +void ClusterVisualizer::fillRadialHisto(TH2D& h2D, const o2::tpc::CalDet& calDet, const o2::tpc::Side side) +{ + const o2::tpc::Mapper& mapper = o2::tpc::Mapper::instance(); + + for (o2::tpc::ROC roc; !roc.looped(); ++roc) { + if (roc.side() != side) { + continue; + } + const int nrows = mapper.getNumberOfRowsROC(roc); + for (int irow = 0; irow < nrows; ++irow) { + const int npads = mapper.getNumberOfPadsInRowROC(roc, irow); + const int globalRow = irow + (roc >= o2::tpc::Mapper::getNumberOfIROCs()) * o2::tpc::Mapper::getNumberOfRowsInIROC(); + for (int ipad = 0; ipad < npads; ++ipad) { + const auto val = calDet.getValue(roc, irow, ipad); + const o2::tpc::LocalPosition2D pos = mapper.getPadCentre(o2::tpc::PadPos(globalRow, ipad)); + h2D.Fill(pos.X(), val); + } + } + } +} + } // namespace o2::quality_control_modules::tpc diff --git a/Modules/TPC/src/Clusters.cxx b/Modules/TPC/src/Clusters.cxx index 065ac17a10..75ea014bc7 100644 --- a/Modules/TPC/src/Clusters.cxx +++ b/Modules/TPC/src/Clusters.cxx @@ -73,6 +73,7 @@ void Clusters::initialize(InitContext& /*ctx*/) mWrapperVector.emplace_back(&mQCClusters.getClusters().getSigmaTime()); mWrapperVector.emplace_back(&mQCClusters.getClusters().getSigmaPad()); mWrapperVector.emplace_back(&mQCClusters.getClusters().getTimeBin()); + mWrapperVector.emplace_back(&mQCClusters.getClusters().getOccupancy()); addAndPublish(getObjectsManager(), mNClustersCanvasVec, { "c_Sides_N_Clusters", "c_ROCs_N_Clusters_1D", "c_ROCs_N_Clusters_2D" }); addAndPublish(getObjectsManager(), mQMaxCanvasVec, { "c_Sides_Q_Max", "c_ROCs_Q_Max_1D", "c_ROCs_Q_Max_2D" }); @@ -80,6 +81,7 @@ void Clusters::initialize(InitContext& /*ctx*/) addAndPublish(getObjectsManager(), mSigmaTimeCanvasVec, { "c_Sides_Sigma_Time", "c_ROCs_Sigma_Time_1D", "c_ROCs_Sigma_Time_2D" }); addAndPublish(getObjectsManager(), mSigmaPadCanvasVec, { "c_Sides_Sigma_Pad", "c_ROCs_Sigma_Pad_1D", "c_ROCs_Sigma_Pad_2D" }); addAndPublish(getObjectsManager(), mTimeBinCanvasVec, { "c_Sides_Time_Bin", "c_ROCs_Time_Bin_1D", "c_ROCs_Time_Bin_2D" }); + addAndPublish(getObjectsManager(), mOccupancyCanvasVec, { "c_Sides_Occupancy", "c_ROCs_Occupancy_1D", "c_ROCs_Occupancy_2D" }); for (auto& wrapper : mWrapperVector) { getObjectsManager()->startPublishing(&wrapper); @@ -123,6 +125,7 @@ void Clusters::processClusterNative(InputRecord& inputs) } } } + mQCClusters.getClusters().endTF(); } void Clusters::processKrClusters(InputRecord& inputs) @@ -138,6 +141,7 @@ void Clusters::processKrClusters(InputRecord& inputs) mQCClusters.getClusters().processCluster(cl, Sector(cl.sector), int(cl.meanRow)); } } + mQCClusters.getClusters().endTF(); } void Clusters::monitorData(ProcessingContext& ctx) @@ -156,12 +160,14 @@ void Clusters::monitorData(ProcessingContext& ctx) fillCanvases(mQCClusters.getClusters().getSigmaTime(), mSigmaTimeCanvasVec, mCustomParameters, "SigmaPad"); fillCanvases(mQCClusters.getClusters().getSigmaPad(), mSigmaPadCanvasVec, mCustomParameters, "SigmaTime"); fillCanvases(mQCClusters.getClusters().getTimeBin(), mTimeBinCanvasVec, mCustomParameters, "TimeBin"); + fillCanvases(mQCClusters.getClusters().getTimeBin(), mOccupancyCanvasVec, mCustomParameters, "Occupancy"); } } void Clusters::endOfCycle() { - ILOG(Debug, Devel) << "endOfCycle" << ENDM; + ILOG(Info, Support) << "endOfCycle" << ENDM; + ILOG(Info, Support) << "Processed TFs: " << mQCClusters.getClusters().getProcessedTFs() << ENDM; if (mIsMergeable) { mQCClusters.getClusters().normalize(); @@ -188,6 +194,7 @@ void Clusters::reset() clearCanvases(mSigmaTimeCanvasVec); clearCanvases(mSigmaPadCanvasVec); clearCanvases(mTimeBinCanvasVec); + clearCanvases(mOccupancyCanvasVec); } } From 744240a015fa6425a4c74691b499af887b8d78ae Mon Sep 17 00:00:00 2001 From: Anton Riedel Date: Thu, 8 May 2025 09:25:50 +0200 Subject: [PATCH 2/4] Fix: fix json formatting --- Modules/TPC/run/tpcQCClusterVisualizer.json | 95 +++++++++++++++------ Modules/TPC/run/tpcQCClusters_direct.json | 33 ++++--- Modules/TPC/run/tpcQCSACs.json | 88 ++++++++++++++----- Modules/TPC/run/tpcQCTracks_sampled.json | 9 +- 4 files changed, 165 insertions(+), 60 deletions(-) diff --git a/Modules/TPC/run/tpcQCClusterVisualizer.json b/Modules/TPC/run/tpcQCClusterVisualizer.json index fa11f30494..cdfde5f3d7 100644 --- a/Modules/TPC/run/tpcQCClusterVisualizer.json +++ b/Modules/TPC/run/tpcQCClusterVisualizer.json @@ -29,39 +29,84 @@ "moduleName": "QcTPC", "detectorName": "TPC", "dataSourceURL": "ccdb-test.cern.ch:8080", - "timestamps_comment": [ "Put the timestamp of the corresponding file you want to look for in the timestamps array.", - "You can either put a timestamp for every object or leave the array empty to take the latest file from the CCDB.", - "An empty array to get the the latest version will be the main use case.", - "The array is mapped to the output objects sequentially", - "If you want to pick the latest file in the CCDB manually, you can use -1." + "timestamps_comment": [ + "Put the timestamp of the corresponding file you want to look for in the timestamps array.", + "You can either put a timestamp for every object or leave the array empty to take the latest file from the CCDB.", + "An empty array to get the the latest version will be the main use case.", + "The array is mapped to the output objects sequentially", + "If you want to pick the latest file in the CCDB manually, you can use -1." ], - "timestamps": [ - ], - "lookupMetaData_comment": [ "With this array you can filter your search via meta data.", - "The array is mapped sequentially to the output objects.", - "If you leave only one entry in the array this is used for all objects in outputCalPadMaps and outputCalPads.", - "If you want no meta data simply remove 'keys' and 'values' completely and leave only {}", - "Every entry above (outputCalPads.size() + outputCalPadMaps.size()) is ignored.", - "The keys and values that are set by default are only there to serve as an example." + "timestamps": [], + "lookupMetaData_comment": [ + "With this array you can filter your search via meta data.", + "The array is mapped sequentially to the output objects.", + "If you leave only one entry in the array this is used for all objects in outputCalPadMaps and outputCalPads.", + "If you want no meta data simply remove 'keys' and 'values' completely and leave only {}", + "Every entry above (outputCalPads.size() + outputCalPadMaps.size()) is ignored.", + "The keys and values that are set by default are only there to serve as an example." ], "lookupMetaData": [ - { - } + {} ], "storeMetaData_comment": "For how-to, see 'lookupMetaData_comment'.", "storeMetaData": [ - { - } + {} + ], + "histogramRanges_comment": [ + "nBins", + "min", + "max" ], - "histogramRanges_comment" : [ "nBins", "min", "max" ], "histogramRanges": [ - { "N_Clusters" : [ "100", "0", "100" ] }, - { "Q_Max" : [ "200", "0", "200" ] }, - { "Q_Tot" : [ "600", "0", "600" ] }, - { "Sigma_Time" : [ "200", "0", "2" ] }, - { "Sigma_Pad" : [ "200", "0", "2" ] }, - { "Time_Bin" : [ "1000", "0", "100000" ] }, - { "Occupancy" : [ "100", "0", "0.001" ] } + { + "N_Clusters": [ + "100", + "0", + "100" + ] + }, + { + "Q_Max": [ + "200", + "0", + "200" + ] + }, + { + "Q_Tot": [ + "600", + "0", + "600" + ] + }, + { + "Sigma_Time": [ + "200", + "0", + "2" + ] + }, + { + "Sigma_Pad": [ + "200", + "0", + "2" + ] + }, + { + "Time_Bin": [ + "1000", + "0", + "100000" + ] + }, + { + "Occupancy": [ + "100", + "0", + "0.001" + ] + } ], "path_comment": "This is the path of the ClustersData object that shall be visualized.", "path": "qc/TPC/MO/Clusters/ClusterData", diff --git a/Modules/TPC/run/tpcQCClusters_direct.json b/Modules/TPC/run/tpcQCClusters_direct.json index a30dd1ade1..1f9a20fa86 100644 --- a/Modules/TPC/run/tpcQCClusters_direct.json +++ b/Modules/TPC/run/tpcQCClusters_direct.json @@ -33,17 +33,31 @@ "resetAfterCycles": "5", "dataSource": { "type": "direct", - "query" : "input:TPC/CLUSTERNATIVE" + "query": "input:TPC/CLUSTERNATIVE" }, "taskParameters": { "mergeableOutput": "true", - "NClustersNBins": "100", "NClustersXMin": "0", "NClustersXMax": "100", - "QmaxNBins": "200", "QmaxXMin": "0", "QmaxXMax": "200", - "QtotNBins": "600", "QtotXMin": "0", "QtotXMax": "600", - "SigmaPadNBins": "200", "SigmaPadXMin": "0", "SigmaPadXMax": "2", - "SigmaTimeNBins": "200", "SigmaTimeXMin": "0", "SigmaTimeXMax": "2", - "TimeBinNBins": "1000", "TimeBinXMin": "0", "TimeBinXMax": "100000", - "OccupancyNBins": "1000", "OccupancyXMin": "0", "OccupancyXMax": "0.00001" + "NClustersNBins": "100", + "NClustersXMin": "0", + "NClustersXMax": "100", + "QmaxNBins": "200", + "QmaxXMin": "0", + "QmaxXMax": "200", + "QtotNBins": "600", + "QtotXMin": "0", + "QtotXMax": "600", + "SigmaPadNBins": "200", + "SigmaPadXMin": "0", + "SigmaPadXMax": "2", + "SigmaTimeNBins": "200", + "SigmaTimeXMin": "0", + "SigmaTimeXMax": "2", + "TimeBinNBins": "1000", + "TimeBinXMin": "0", + "TimeBinXMax": "100000", + "OccupancyNBins": "1000", + "OccupancyXMin": "0", + "OccupancyXMax": "0.00001" }, "location": "local", "localMachines": [ @@ -55,6 +69,5 @@ } } }, - "dataSamplingPolicies": [ - ] + "dataSamplingPolicies": [] } diff --git a/Modules/TPC/run/tpcQCSACs.json b/Modules/TPC/run/tpcQCSACs.json index 5074c112e0..aef26db794 100644 --- a/Modules/TPC/run/tpcQCSACs.json +++ b/Modules/TPC/run/tpcQCSACs.json @@ -8,8 +8,7 @@ "password": "not_applicable", "name": "not_applicable" }, - "Activity": { - }, + "Activity": {}, "monitoring": { "url": "infologger:///debug?qc" }, @@ -33,35 +32,78 @@ "doLatest": "false", "rejectOutliersSACZeroScale": "true", "maxDeviationOutlierSACZero": "2.", - "timestamps_comment": [ "Put the timestamp of the corresponding file you want to look for in the timestamps array.", - "You can either put a timestamp for every object or leave the array empty to take the latest file from the CCDB.", - "An empty array to get the the latest version will be the main use case.", - "The array is mapped to the output objects sequentially", - "If you want to pick the latest file in the CCDB manually, you can use -1." + "timestamps_comment": [ + "Put the timestamp of the corresponding file you want to look for in the timestamps array.", + "You can either put a timestamp for every object or leave the array empty to take the latest file from the CCDB.", + "An empty array to get the the latest version will be the main use case.", + "The array is mapped to the output objects sequentially", + "If you want to pick the latest file in the CCDB manually, you can use -1." ], "timestamps": [ - { "SACZero":"1686390443945" }, - { "SACOne":"-1" }, - { "SACDelta":"-1" }, - { "SACFourierCoeffs":"-1" } - ], - "lookupMetaData_comment": [ "Not used in the current version" ], - "lookupMetaData": [ { + "SACZero": "1686390443945" + }, + { + "SACOne": "-1" + }, + { + "SACDelta": "-1" + }, + { + "SACFourierCoeffs": "-1" } ], + "lookupMetaData_comment": [ + "Not used in the current version" + ], + "lookupMetaData": [ + {} + ], "storeMetaData_comment": "Not used in the current version", "storeMetaData": [ - { - } + {} + ], + "histogramRanges_comment": [ + "nBins", + "min", + "max" ], - "histogramRanges_comment" : [ "nBins", "min", "max" ], "histogramRanges": [ - { "SACZero" : [ "250", "-50", "-50" ] }, - { "SACZeroScaled" : [ "250", "-5", "2" ] }, - { "SACOne" : [ "250", "-100", "100" ] }, - { "SACDelta" : [ "250", "-10", "10" ] }, - { "SACFourierCoeffs" : [ "250", "-10", "10" ] } + { + "SACZero": [ + "250", + "-50", + "-50" + ] + }, + { + "SACZeroScaled": [ + "250", + "-5", + "2" + ] + }, + { + "SACOne": [ + "250", + "-100", + "100" + ] + }, + { + "SACDelta": [ + "250", + "-10", + "10" + ] + }, + { + "SACFourierCoeffs": [ + "250", + "-10", + "10" + ] + } ], "initTrigger": [ "once" @@ -76,4 +118,4 @@ } } } -} \ No newline at end of file +} diff --git a/Modules/TPC/run/tpcQCTracks_sampled.json b/Modules/TPC/run/tpcQCTracks_sampled.json index a246300343..7e27238b8a 100644 --- a/Modules/TPC/run/tpcQCTracks_sampled.json +++ b/Modules/TPC/run/tpcQCTracks_sampled.json @@ -30,7 +30,10 @@ "cycleDurationSeconds": "10", "dataSource_comment": "The other type of dataSource is \"direct\", see basic-no-sampling.json.", "dataSources": [ - { "type": "dataSamplingPolicy", "name": "tpc-tracks" }, + { + "type": "dataSamplingPolicy", + "name": "tpc-tracks" + }, { "type": "direct", "query": "meanvertex:GLO/MEANVERTEX/0?lifetime=condition&ccdb-path=GLO/Calib/MeanVertex" @@ -66,7 +69,9 @@ { "type": "Task", "name": "Tracks", - "MOs": ["example"] + "MOs": [ + "example" + ] } ] } From d312264b718a3f37753a48152186e1bfcc7e72a4 Mon Sep 17 00:00:00 2001 From: Anton Riedel Date: Thu, 8 May 2025 17:29:53 +0200 Subject: [PATCH 3/4] Feat: add occupancy histograms to Cluster tasks --- Modules/TPC/include/TPC/ClusterVisualizer.h | 1 + Modules/TPC/include/TPC/Clusters.h | 1 + Modules/TPC/src/ClusterVisualizer.cxx | 9 ++++++--- Modules/TPC/src/Clusters.cxx | 6 +++++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Modules/TPC/include/TPC/ClusterVisualizer.h b/Modules/TPC/include/TPC/ClusterVisualizer.h index 1ca259e52f..7fd9340af1 100644 --- a/Modules/TPC/include/TPC/ClusterVisualizer.h +++ b/Modules/TPC/include/TPC/ClusterVisualizer.h @@ -72,6 +72,7 @@ class ClusterVisualizer final : public quality_control::postprocessing::PostProc void fillRadialHisto(TH2D& h2D, const o2::tpc::CalDet& calDet, const o2::tpc::Side side); private: + int mNHBFPerTF = 32; o2::ccdb::CcdbApi mCdbApi; std::string mHost; std::vector>> mCalDetCanvasVec{}; ///< vector containing a vector of summary canvases for every CalDet object diff --git a/Modules/TPC/include/TPC/Clusters.h b/Modules/TPC/include/TPC/Clusters.h index f23cd65c76..97741af41b 100644 --- a/Modules/TPC/include/TPC/Clusters.h +++ b/Modules/TPC/include/TPC/Clusters.h @@ -55,6 +55,7 @@ class Clusters /*final*/ : public TaskInterface // todo add back the "final" whe private: bool mIsMergeable = true; + int mNHBFPerTF = 32; ClustersData mQCClusters{}; ///< O2 Cluster task to perform actions on cluster objects std::vector mWrapperVector{}; ///< vector holding CalPad objects wrapped as TObjects; published on QCG; will be non-wrapped CalPad objects in the future std::vector> mNClustersCanvasVec{}; ///< summary canvases of the NClusters object diff --git a/Modules/TPC/src/ClusterVisualizer.cxx b/Modules/TPC/src/ClusterVisualizer.cxx index 32e774a13e..31d527034a 100644 --- a/Modules/TPC/src/ClusterVisualizer.cxx +++ b/Modules/TPC/src/ClusterVisualizer.cxx @@ -18,6 +18,7 @@ #include "TPCBase/Painter.h" #include "TPCBase/CDBInterface.h" #include "TPCQC/Helpers.h" +#include "DetectorsBase/GRPGeomHelper.h" // QC includes #include "QualityControl/QcInfoLogger.h" @@ -140,6 +141,8 @@ void ClusterVisualizer::initialize(Trigger, framework::ServiceRegistryRef) { mCdbApi.init(mHost); + mNHBFPerTF = o2::base::GRPGeomHelper::instance().getNHBFPerTF(); + if (mCalDetCanvasVec.size() > 0) { mCalDetCanvasVec.clear(); } @@ -215,12 +218,12 @@ void ClusterVisualizer::update(Trigger t, framework::ServiceRegistryRef) o2::tpc::painter::makeSummaryCanvases(calDet, int(mRanges[calDet.getName()].at(0)), mRanges[calDet.getName()].at(1), mRanges[calDet.getName()].at(2), false, &vecPtr); calDetIter++; - calDet = clusters.getOccupancy(); + auto occupancy = clusters.getOccupancy(mNHBFPerTF); vecPtr = toVector(mCalDetCanvasVec.at(calDetIter)); - o2::tpc::painter::makeSummaryCanvases(calDet, int(mRanges[calDet.getName()].at(0)), mRanges[calDet.getName()].at(1), mRanges[calDet.getName()].at(2), false, &vecPtr); + o2::tpc::painter::makeSummaryCanvases(occupancy, int(mRanges[occupancy.getName()].at(0)), mRanges[occupancy.getName()].at(1), mRanges[occupancy.getName()].at(2), false, &vecPtr); calDetIter++; vecPtr = toVector(mCalDetCanvasVec.at(calDetIter)); - makeRadialProfile(calDet, vecPtr.at(0), int(mRanges[calDet.getName()].at(0)), mRanges[calDet.getName()].at(1), mRanges[calDet.getName()].at(2)); + makeRadialProfile(occupancy, vecPtr.at(0), int(mRanges[occupancy.getName()].at(0)), mRanges[occupancy.getName()].at(1), mRanges[occupancy.getName()].at(2)); calDetIter++; } diff --git a/Modules/TPC/src/Clusters.cxx b/Modules/TPC/src/Clusters.cxx index 75ea014bc7..ad70f2d220 100644 --- a/Modules/TPC/src/Clusters.cxx +++ b/Modules/TPC/src/Clusters.cxx @@ -20,6 +20,7 @@ #include "DataFormatsTPC/ClusterNative.h" #include "TPCBase/Painter.h" #include "Framework/InputRecordWalker.h" +#include "DetectorsBase/GRPGeomHelper.h" // QC includes #include "QualityControl/QcInfoLogger.h" @@ -42,6 +43,8 @@ void Clusters::initialize(InitContext& /*ctx*/) mQCClusters.setName("ClusterData"); + mNHBFPerTF = o2::base::GRPGeomHelper::instance().getNHBFPerTF(); + const auto last = mCustomParameters.end(); const auto itMergeable = mCustomParameters.find("mergeableOutput"); std::string mergeable; @@ -73,7 +76,8 @@ void Clusters::initialize(InitContext& /*ctx*/) mWrapperVector.emplace_back(&mQCClusters.getClusters().getSigmaTime()); mWrapperVector.emplace_back(&mQCClusters.getClusters().getSigmaPad()); mWrapperVector.emplace_back(&mQCClusters.getClusters().getTimeBin()); - mWrapperVector.emplace_back(&mQCClusters.getClusters().getOccupancy()); + auto occupancy = mQCClusters.getClusters().getOccupancy(mNHBFPerTF); + mWrapperVector.emplace_back(&occupancy); addAndPublish(getObjectsManager(), mNClustersCanvasVec, { "c_Sides_N_Clusters", "c_ROCs_N_Clusters_1D", "c_ROCs_N_Clusters_2D" }); addAndPublish(getObjectsManager(), mQMaxCanvasVec, { "c_Sides_Q_Max", "c_ROCs_Q_Max_1D", "c_ROCs_Q_Max_2D" }); From eb09d8d7a12aa54c78f64c46105141a1d1a2c867 Mon Sep 17 00:00:00 2001 From: Anton Riedel Date: Fri, 9 May 2025 15:34:51 +0200 Subject: [PATCH 4/4] Revert "Fix: fix json formatting" This reverts commit 744240a015fa6425a4c74691b499af887b8d78ae. --- Modules/TPC/run/tpcQCClusterVisualizer.json | 95 ++++++--------------- Modules/TPC/run/tpcQCClusters_direct.json | 33 +++---- Modules/TPC/run/tpcQCSACs.json | 88 +++++-------------- Modules/TPC/run/tpcQCTracks_sampled.json | 9 +- 4 files changed, 60 insertions(+), 165 deletions(-) diff --git a/Modules/TPC/run/tpcQCClusterVisualizer.json b/Modules/TPC/run/tpcQCClusterVisualizer.json index cdfde5f3d7..fa11f30494 100644 --- a/Modules/TPC/run/tpcQCClusterVisualizer.json +++ b/Modules/TPC/run/tpcQCClusterVisualizer.json @@ -29,85 +29,40 @@ "moduleName": "QcTPC", "detectorName": "TPC", "dataSourceURL": "ccdb-test.cern.ch:8080", - "timestamps_comment": [ - "Put the timestamp of the corresponding file you want to look for in the timestamps array.", - "You can either put a timestamp for every object or leave the array empty to take the latest file from the CCDB.", - "An empty array to get the the latest version will be the main use case.", - "The array is mapped to the output objects sequentially", - "If you want to pick the latest file in the CCDB manually, you can use -1." + "timestamps_comment": [ "Put the timestamp of the corresponding file you want to look for in the timestamps array.", + "You can either put a timestamp for every object or leave the array empty to take the latest file from the CCDB.", + "An empty array to get the the latest version will be the main use case.", + "The array is mapped to the output objects sequentially", + "If you want to pick the latest file in the CCDB manually, you can use -1." ], - "timestamps": [], - "lookupMetaData_comment": [ - "With this array you can filter your search via meta data.", - "The array is mapped sequentially to the output objects.", - "If you leave only one entry in the array this is used for all objects in outputCalPadMaps and outputCalPads.", - "If you want no meta data simply remove 'keys' and 'values' completely and leave only {}", - "Every entry above (outputCalPads.size() + outputCalPadMaps.size()) is ignored.", - "The keys and values that are set by default are only there to serve as an example." + "timestamps": [ + ], + "lookupMetaData_comment": [ "With this array you can filter your search via meta data.", + "The array is mapped sequentially to the output objects.", + "If you leave only one entry in the array this is used for all objects in outputCalPadMaps and outputCalPads.", + "If you want no meta data simply remove 'keys' and 'values' completely and leave only {}", + "Every entry above (outputCalPads.size() + outputCalPadMaps.size()) is ignored.", + "The keys and values that are set by default are only there to serve as an example." ], "lookupMetaData": [ - {} + { + } ], "storeMetaData_comment": "For how-to, see 'lookupMetaData_comment'.", "storeMetaData": [ - {} - ], - "histogramRanges_comment": [ - "nBins", - "min", - "max" - ], - "histogramRanges": [ - { - "N_Clusters": [ - "100", - "0", - "100" - ] - }, { - "Q_Max": [ - "200", - "0", - "200" - ] - }, - { - "Q_Tot": [ - "600", - "0", - "600" - ] - }, - { - "Sigma_Time": [ - "200", - "0", - "2" - ] - }, - { - "Sigma_Pad": [ - "200", - "0", - "2" - ] - }, - { - "Time_Bin": [ - "1000", - "0", - "100000" - ] - }, - { - "Occupancy": [ - "100", - "0", - "0.001" - ] } ], + "histogramRanges_comment" : [ "nBins", "min", "max" ], + "histogramRanges": [ + { "N_Clusters" : [ "100", "0", "100" ] }, + { "Q_Max" : [ "200", "0", "200" ] }, + { "Q_Tot" : [ "600", "0", "600" ] }, + { "Sigma_Time" : [ "200", "0", "2" ] }, + { "Sigma_Pad" : [ "200", "0", "2" ] }, + { "Time_Bin" : [ "1000", "0", "100000" ] }, + { "Occupancy" : [ "100", "0", "0.001" ] } + ], "path_comment": "This is the path of the ClustersData object that shall be visualized.", "path": "qc/TPC/MO/Clusters/ClusterData", "dataType_comment": "This is the switch for 'RawDigits' or 'Clusters' task. Choose 'raw' or 'clusters'.", diff --git a/Modules/TPC/run/tpcQCClusters_direct.json b/Modules/TPC/run/tpcQCClusters_direct.json index 1f9a20fa86..a30dd1ade1 100644 --- a/Modules/TPC/run/tpcQCClusters_direct.json +++ b/Modules/TPC/run/tpcQCClusters_direct.json @@ -33,31 +33,17 @@ "resetAfterCycles": "5", "dataSource": { "type": "direct", - "query": "input:TPC/CLUSTERNATIVE" + "query" : "input:TPC/CLUSTERNATIVE" }, "taskParameters": { "mergeableOutput": "true", - "NClustersNBins": "100", - "NClustersXMin": "0", - "NClustersXMax": "100", - "QmaxNBins": "200", - "QmaxXMin": "0", - "QmaxXMax": "200", - "QtotNBins": "600", - "QtotXMin": "0", - "QtotXMax": "600", - "SigmaPadNBins": "200", - "SigmaPadXMin": "0", - "SigmaPadXMax": "2", - "SigmaTimeNBins": "200", - "SigmaTimeXMin": "0", - "SigmaTimeXMax": "2", - "TimeBinNBins": "1000", - "TimeBinXMin": "0", - "TimeBinXMax": "100000", - "OccupancyNBins": "1000", - "OccupancyXMin": "0", - "OccupancyXMax": "0.00001" + "NClustersNBins": "100", "NClustersXMin": "0", "NClustersXMax": "100", + "QmaxNBins": "200", "QmaxXMin": "0", "QmaxXMax": "200", + "QtotNBins": "600", "QtotXMin": "0", "QtotXMax": "600", + "SigmaPadNBins": "200", "SigmaPadXMin": "0", "SigmaPadXMax": "2", + "SigmaTimeNBins": "200", "SigmaTimeXMin": "0", "SigmaTimeXMax": "2", + "TimeBinNBins": "1000", "TimeBinXMin": "0", "TimeBinXMax": "100000", + "OccupancyNBins": "1000", "OccupancyXMin": "0", "OccupancyXMax": "0.00001" }, "location": "local", "localMachines": [ @@ -69,5 +55,6 @@ } } }, - "dataSamplingPolicies": [] + "dataSamplingPolicies": [ + ] } diff --git a/Modules/TPC/run/tpcQCSACs.json b/Modules/TPC/run/tpcQCSACs.json index aef26db794..5074c112e0 100644 --- a/Modules/TPC/run/tpcQCSACs.json +++ b/Modules/TPC/run/tpcQCSACs.json @@ -8,7 +8,8 @@ "password": "not_applicable", "name": "not_applicable" }, - "Activity": {}, + "Activity": { + }, "monitoring": { "url": "infologger:///debug?qc" }, @@ -32,79 +33,36 @@ "doLatest": "false", "rejectOutliersSACZeroScale": "true", "maxDeviationOutlierSACZero": "2.", - "timestamps_comment": [ - "Put the timestamp of the corresponding file you want to look for in the timestamps array.", - "You can either put a timestamp for every object or leave the array empty to take the latest file from the CCDB.", - "An empty array to get the the latest version will be the main use case.", - "The array is mapped to the output objects sequentially", - "If you want to pick the latest file in the CCDB manually, you can use -1." + "timestamps_comment": [ "Put the timestamp of the corresponding file you want to look for in the timestamps array.", + "You can either put a timestamp for every object or leave the array empty to take the latest file from the CCDB.", + "An empty array to get the the latest version will be the main use case.", + "The array is mapped to the output objects sequentially", + "If you want to pick the latest file in the CCDB manually, you can use -1." ], "timestamps": [ - { - "SACZero": "1686390443945" - }, - { - "SACOne": "-1" - }, - { - "SACDelta": "-1" - }, - { - "SACFourierCoeffs": "-1" - } - ], - "lookupMetaData_comment": [ - "Not used in the current version" + { "SACZero":"1686390443945" }, + { "SACOne":"-1" }, + { "SACDelta":"-1" }, + { "SACFourierCoeffs":"-1" } ], + "lookupMetaData_comment": [ "Not used in the current version" ], "lookupMetaData": [ - {} + { + } ], "storeMetaData_comment": "Not used in the current version", "storeMetaData": [ - {} - ], - "histogramRanges_comment": [ - "nBins", - "min", - "max" - ], - "histogramRanges": [ - { - "SACZero": [ - "250", - "-50", - "-50" - ] - }, - { - "SACZeroScaled": [ - "250", - "-5", - "2" - ] - }, { - "SACOne": [ - "250", - "-100", - "100" - ] - }, - { - "SACDelta": [ - "250", - "-10", - "10" - ] - }, - { - "SACFourierCoeffs": [ - "250", - "-10", - "10" - ] } ], + "histogramRanges_comment" : [ "nBins", "min", "max" ], + "histogramRanges": [ + { "SACZero" : [ "250", "-50", "-50" ] }, + { "SACZeroScaled" : [ "250", "-5", "2" ] }, + { "SACOne" : [ "250", "-100", "100" ] }, + { "SACDelta" : [ "250", "-10", "10" ] }, + { "SACFourierCoeffs" : [ "250", "-10", "10" ] } + ], "initTrigger": [ "once" ], @@ -118,4 +76,4 @@ } } } -} +} \ No newline at end of file diff --git a/Modules/TPC/run/tpcQCTracks_sampled.json b/Modules/TPC/run/tpcQCTracks_sampled.json index 7e27238b8a..a246300343 100644 --- a/Modules/TPC/run/tpcQCTracks_sampled.json +++ b/Modules/TPC/run/tpcQCTracks_sampled.json @@ -30,10 +30,7 @@ "cycleDurationSeconds": "10", "dataSource_comment": "The other type of dataSource is \"direct\", see basic-no-sampling.json.", "dataSources": [ - { - "type": "dataSamplingPolicy", - "name": "tpc-tracks" - }, + { "type": "dataSamplingPolicy", "name": "tpc-tracks" }, { "type": "direct", "query": "meanvertex:GLO/MEANVERTEX/0?lifetime=condition&ccdb-path=GLO/Calib/MeanVertex" @@ -69,9 +66,7 @@ { "type": "Task", "name": "Tracks", - "MOs": [ - "example" - ] + "MOs": ["example"] } ] }