Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Modules/TPC/include/TPC/Utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ void addAndPublish(std::shared_ptr<o2::quality_control::core::ObjectsManager> ob
/// \return std::vector<TCanvas*>
std::vector<TCanvas*> toVector(std::vector<std::unique_ptr<TCanvas>>& input);

/// \brief Fills std::vector<std::unique_ptr<TCanvas>> with data from calDet
/// This is a convenience function to call o2::tpc::painter::makeSummaryCanvases in QC tasks to visualize the content of a CalDet object.
/// \param calDet Object to be displayed in the canvases
/// \param canvases Vector containing three std::unique_ptr<TCanvas>, will be filled
/// \param params Information about the ranges of the histograms that will be drawn on the canvases. The params can be set via 'taskParameters' in the config file of corresponding the task.
/// \param paramName Name of the observable that is stored in calDet
void fillCanvases(const o2::tpc::CalDet<float>& calDet, std::vector<std::unique_ptr<TCanvas>>& canvases, const std::unordered_map<std::string, std::string>& params, const std::string paramName);

/// \brief Clears all canvases
/// \param canvases Contains the canvases that will be cleared
void clearCanvases(std::vector<std::unique_ptr<TCanvas>>& canvases);

/// \brief Converts CLUSTERNATIVE from InputRecord to ClusterNativeAccess
/// Convenience funtion to make native clusters accessible when receiving them from the DPL
/// \param input InputReconrd from the ProcessingContext
Expand Down
24 changes: 8 additions & 16 deletions Modules/TPC/run/tpcQCClusters_direct.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,23 @@
"className": "o2::quality_control_modules::tpc::Clusters",
"moduleName": "QcTPC",
"detectorName": "TPC",
"cycleDurationSeconds": "60",
"cycleDurationSeconds": "10",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure about this one ? publishing every 10 seconds is quite a lot.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is for testing only anyway so it doesn't really matter.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, thank you

"maxNumberCycles": "-1",
"resetAfterCycles": "5",
"dataSource": {
"type": "direct",
"query" : "input:TPC/CLUSTERNATIVE"
},
"taskParameters": {
"myOwnKey": "myOwnValue"
"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"
},
"location": "remote"
}
},
"checks": {
"QcCheckClusters": {
"active": "true",
"className": "o2::quality_control_modules::skeleton::SkeletonCheck",
"moduleName": "QcSkeleton",
"policy": "OnAny",
"detectorName": "TPC",
"dataSource": [{
"type": "Task",
"name": "Clusters",
"MOs": ["example"]
}]
}
}
},
"dataSamplingPolicies": [
Expand Down
4 changes: 3 additions & 1 deletion Modules/TPC/run/tpcQCRawDigits_direct.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
"query" : "input:TPC/RAWDATA"
},
"taskParameters": {
"myOwnKey": "myOwnValue"
"NRawDigitsNBins": "100", "NRawDigitsXMin": "0", "NRawDigitsXMax": "100",
"QmaxNBins": "200", "QmaxXMin": "0", "QmaxXMax": "200",
"TimeBinNBins": "1000", "TimeBinXMin": "0", "TimeBinXMax": "100000"
},
"location": "remote"
}
Expand Down
13 changes: 11 additions & 2 deletions Modules/TPC/run/tpcQCTasks_multinode.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@
"type": "dataSamplingPolicy",
"name": "random-rawdata"
},
"taskParameters": {},
"taskParameters": {
"NRawDigitsNBins": "100", "NRawDigitsXMin": "0", "NRawDigitsXMax": "100",
"QmaxNBins": "200", "QmaxXMin": "0", "QmaxXMax": "200",
"TimeBinNBins": "600", "TimeBinXMin": "0", "TimeBinXMax": "600"
},
"location": "remote"
},
"Clusters_EPN": {
Expand All @@ -49,7 +53,12 @@
"name": "random-clusters"
},
"taskParameters": {
"myOwnKey": "myOwnValue"
"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"
},
"location": "remote"
},
Expand Down
33 changes: 14 additions & 19 deletions Modules/TPC/src/Clusters.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ void Clusters::initialize(o2::framework::InitContext& /*ctx*/)

for (auto& wrapper : mWrapperVector) {
getObjectsManager()->startPublishing(&wrapper);
getObjectsManager()->addMetadata(wrapper.getObj()->getName().data(), "custom", "87");
}
}

Expand Down Expand Up @@ -80,23 +79,12 @@ void Clusters::monitorData(o2::framework::ProcessingContext& ctx)

mQCClusters.analyse();

auto vecPtrNClusters = toVector(mNClustersCanvasVec);
o2::tpc::painter::makeSummaryCanvases(mQCClusters.getNClusters(), 300, 0, 0, true, &vecPtrNClusters);

auto vecPtrQMax = toVector(mQMaxCanvasVec);
o2::tpc::painter::makeSummaryCanvases(mQCClusters.getQMax(), 300, 0, 0, true, &vecPtrQMax);

auto vecPtrQTot = toVector(mQTotCanvasVec);
o2::tpc::painter::makeSummaryCanvases(mQCClusters.getQTot(), 300, 0, 0, true, &vecPtrQTot);

auto vecPtrSigmaTime = toVector(mSigmaTimeCanvasVec);
o2::tpc::painter::makeSummaryCanvases(mQCClusters.getSigmaTime(), 300, 0, 0, true, &vecPtrSigmaTime);

auto vecPtrSigmaPad = toVector(mSigmaPadCanvasVec);
o2::tpc::painter::makeSummaryCanvases(mQCClusters.getSigmaPad(), 300, 0, 0, true, &vecPtrSigmaPad);

auto vecPtrTimeBin = toVector(mTimeBinCanvasVec);
o2::tpc::painter::makeSummaryCanvases(mQCClusters.getTimeBin(), 300, 0, 0, true, &vecPtrTimeBin);
fillCanvases(mQCClusters.getNClusters(), mNClustersCanvasVec, mCustomParameters, "NClusters");
fillCanvases(mQCClusters.getQMax(), mQMaxCanvasVec, mCustomParameters, "Qmax");
fillCanvases(mQCClusters.getQTot(), mQTotCanvasVec, mCustomParameters, "Qtot");
fillCanvases(mQCClusters.getSigmaTime(), mSigmaTimeCanvasVec, mCustomParameters, "SigmaPad");
fillCanvases(mQCClusters.getSigmaPad(), mSigmaPadCanvasVec, mCustomParameters, "SigmaTime");
fillCanvases(mQCClusters.getTimeBin(), mTimeBinCanvasVec, mCustomParameters, "TimeBin");
}

void Clusters::endOfCycle()
Expand All @@ -113,7 +101,14 @@ void Clusters::reset()
{
// clean all the monitor objects here

QcInfoLogger::GetInstance() << "Resetting the histogram" << AliceO2::InfoLogger::InfoLogger::endm;
QcInfoLogger::GetInstance() << "Resetting the canvases" << AliceO2::InfoLogger::InfoLogger::endm;

Comment thread
tklemenz marked this conversation as resolved.
clearCanvases(mNClustersCanvasVec);
clearCanvases(mQMaxCanvasVec);
clearCanvases(mQTotCanvasVec);
clearCanvases(mSigmaTimeCanvasVec);
clearCanvases(mSigmaPadCanvasVec);
clearCanvases(mTimeBinCanvasVec);
}

} // namespace o2::quality_control_modules::tpc
16 changes: 7 additions & 9 deletions Modules/TPC/src/RawDigits.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ void RawDigits::initialize(o2::framework::InitContext& /*ctx*/)

for (auto& wrapper : mWrapperVector) {
getObjectsManager()->startPublishing(&wrapper);
getObjectsManager()->addMetadata(wrapper.getObj()->getName().data(), "custom", "87");
}

mRawReader.setLinkZSCallback([this](int cru, int rowInSector, int padInRow, int timeBin, float adcValue) -> bool {
Expand All @@ -72,14 +71,9 @@ void RawDigits::monitorData(o2::framework::ProcessingContext& ctx)

mRawDigitQC.analyse();

auto vecPtrNRawDigits = toVector(mNRawDigitsCanvasVec);
o2::tpc::painter::makeSummaryCanvases(mRawDigitQC.getNClusters(), 300, 0, 0, true, &vecPtrNRawDigits);

auto vecPtrQMax = toVector(mQMaxCanvasVec);
o2::tpc::painter::makeSummaryCanvases(mRawDigitQC.getQMax(), 300, 0, 0, true, &vecPtrQMax);

auto vecPtrTimeBin = toVector(mTimeBinCanvasVec);
o2::tpc::painter::makeSummaryCanvases(mRawDigitQC.getTimeBin(), 300, 0, 0, true, &vecPtrTimeBin);
fillCanvases(mRawDigitQC.getNClusters(), mNRawDigitsCanvasVec, mCustomParameters, "NRawDigits");
fillCanvases(mRawDigitQC.getQMax(), mQMaxCanvasVec, mCustomParameters, "Qmax");
fillCanvases(mRawDigitQC.getTimeBin(), mTimeBinCanvasVec, mCustomParameters, "TimeBin");
}

void RawDigits::endOfCycle()
Expand All @@ -97,6 +91,10 @@ void RawDigits::reset()
// clean all the monitor objects here

QcInfoLogger::GetInstance() << "Resetting the histogram" << AliceO2::InfoLogger::InfoLogger::endm;

clearCanvases(mNRawDigitsCanvasVec);
clearCanvases(mQMaxCanvasVec);
clearCanvases(mTimeBinCanvasVec);
}

} // namespace o2::quality_control_modules::tpc
33 changes: 33 additions & 0 deletions Modules/TPC/src/Utility.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include "Framework/InputRecordWalker.h"
#include "DataFormatsTPC/ClusterNativeHelper.h"
#include "DataFormatsTPC/TPCSectorHeader.h"
#include "TPCBase/CalDet.h"
#include "TPCBase/Painter.h"

// QC includes
#include "TPC/Utility.h"
Expand Down Expand Up @@ -53,6 +55,37 @@ std::vector<TCanvas*> toVector(std::vector<std::unique_ptr<TCanvas>>& input)
return output;
}

void fillCanvases(const o2::tpc::CalDet<float>& calDet, std::vector<std::unique_ptr<TCanvas>>& canvases, const std::unordered_map<std::string, std::string>& params, const std::string paramName)
{
const std::string parNBins = paramName + "NBins";
const std::string parXMin = paramName + "XMin";
const std::string parXMax = paramName + "XMax";
int nbins = 300;
float xmin = 0;
float xmax = 0;
const auto last = params.end();
const auto itNBins = params.find(parNBins);
const auto itXMin = params.find(parXMin);
const auto itXMax = params.find(parXMax);
if ((itNBins == last) || (itXMin == last) || (itXMax == last)) {
LOGP(warning, "missing parameter {}, {} or {}, falling back to auto scaling", parNBins, parXMin, parXMax);
LOGP(warning, "Please add '{}': '<value>', '{}': '<value>', '{}': '<value>' to the 'taskParameters'.", parNBins, parXMin, parXMax);
} else {
nbins = std::stoi(itNBins->second);
xmin = std::stof(itXMin->second);
xmax = std::stof(itXMax->second);
}
auto vecPtr = toVector(canvases);
Comment thread
tklemenz marked this conversation as resolved.
o2::tpc::painter::makeSummaryCanvases(calDet, nbins, xmin, xmax, true, &vecPtr);
}

void clearCanvases(std::vector<std::unique_ptr<TCanvas>>& canvases)
{
for (const auto& canvas : canvases) {
canvas->Clear();
}
}

o2::tpc::ClusterNativeAccess clusterHandler(o2::framework::InputRecord& input)
{
using namespace o2::tpc;
Expand Down