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
1 change: 1 addition & 0 deletions Modules/CTP/include/CTP/RawDataQcTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class CTPRawDataReaderTask final : public TaskInterface
std::unique_ptr<TH1DRatio> mHistoClassRatios = nullptr; // histogram with ctp class ratios to MB
std::unique_ptr<TH1D> mHistoBCMinBias1 = nullptr; // histogram of BC positions to check LHC filling scheme
std::unique_ptr<TH1D> mHistoBCMinBias2 = nullptr; // histogram of BC positions to check LHC filling scheme
std::unique_ptr<TH1D> mHistoDecodeError = nullptr; // histogram of erros from decoder
int mRunNumber;
int indexMB1 = -1;
int indexMB2 = -1;
Expand Down
4 changes: 3 additions & 1 deletion Modules/CTP/include/CTP/RawDataReaderCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "QualityControl/CheckInterface.h"
#include "CommonConstants/LHCConstants.h"
#include "DetectorsBase/GRPGeomHelper.h"
#include <TLatex.h>
#include <bitset>
class TH1D;

Expand Down Expand Up @@ -50,6 +51,7 @@ class RawDataReaderCheck : public o2::quality_control::checker::CheckInterface
int getRunNumberFromMO(std::shared_ptr<MonitorObject> mo);
int checkChange(TH1D* mHist, TH1D* mHistPrev);
int checkChangeOfRatio(TH1D* mHist, TH1D* mHistPrev, TH1D* mHistAbs);
float setTextPosition(float iPos, std::shared_ptr<TLatex> msg, TH1D* h);
Quality setQualityResult(std::vector<int>& vBad, std::vector<int>& vMedium);
void clearIndexVectors();
long int mTimestamp;
Expand All @@ -73,7 +75,7 @@ class RawDataReaderCheck : public o2::quality_control::checker::CheckInterface
std::vector<int> mVecIndexMedium; // vector of ctp input and class indices, which had a relative change
std::bitset<o2::constants::lhc::LHCMaxBunches> mLHCBCs; // LHC filling scheme

ClassDefOverride(RawDataReaderCheck, 9);
ClassDefOverride(RawDataReaderCheck, 10);
};

} // namespace o2::quality_control_modules::ctp
Expand Down
2 changes: 2 additions & 0 deletions Modules/CTP/src/CTPTrendingTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ void CTPTrendingTask::initCTP(Trigger& t)
mgr.setURL(CCDBHost);
map<string, string> metadata; // can be empty
metadata["runNumber"] = run;
mgr.setFatalWhenNull(false);
auto ctpconfigdb = mgr.getSpecific<o2::ctp::CTPConfiguration>(o2::ctp::CCDBPathCTPConfig, t.timestamp, metadata);
if (ctpconfigdb == nullptr) {
LOG(info) << "CTP config not in database, timestamp:" << t.timestamp;
Expand Down Expand Up @@ -125,6 +126,7 @@ void CTPTrendingTask::initCTP(Trigger& t)
}
void CTPTrendingTask::initialize(Trigger t, framework::ServiceRegistryRef services)
{
initCTP(t);
}

void CTPTrendingTask::update(Trigger t, framework::ServiceRegistryRef services)
Expand Down
12 changes: 11 additions & 1 deletion Modules/CTP/src/RawDataQcTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,18 @@ void CTPRawDataReaderTask::initialize(o2::framework::InitContext& /*ctx*/)
mHistoBCMinBias2 = std::make_unique<TH1D>("bcMinBias2", "BC position MB2", norbits, 0, norbits);
mHistoInputRatios = std::make_unique<TH1DRatio>("inputRatio", "Input Ratio to MTVX; Input; Ratio;", ninps, 0, ninps, true);
mHistoClassRatios = std::make_unique<TH1DRatio>("classRatio", "Class Ratio to MB; Class; Ratio", nclasses, 0, nclasses, true);
mHistoDecodeError = std::make_unique<TH1D>("decodeError", "Errors from decoder", 10, 1, 11);
getObjectsManager()->startPublishing(mHistoInputs.get());
getObjectsManager()->startPublishing(mHistoClasses.get());
getObjectsManager()->startPublishing(mHistoClassRatios.get());
getObjectsManager()->startPublishing(mHistoInputRatios.get());
getObjectsManager()->startPublishing(mHistoBCMinBias1.get());
getObjectsManager()->startPublishing(mHistoBCMinBias2.get());
getObjectsManager()->startPublishing(mHistoDecodeError.get());

mDecoder.setDoLumi(1);
mDecoder.setDecodeInps(1);
mDecoder.setCheckConsistency(1);
mDecoder.setDoDigits(1);
for (size_t i = 0; i < nclasses; i++) {
classNames[i] = "";
Expand All @@ -76,6 +80,7 @@ void CTPRawDataReaderTask::startOfActivity(const Activity& activity)
mHistoInputRatios->Reset();
mHistoBCMinBias1->Reset();
mHistoBCMinBias2->Reset();
mHistoDecodeError->Reset();

mRunNumber = activity.mId;
mTimestamp = activity.mValidity.getMin();
Expand Down Expand Up @@ -115,6 +120,7 @@ void CTPRawDataReaderTask::startOfActivity(const Activity& activity)
break;
}
}
mDecoder.setCTPConfig(*ctpconfigdb);
} else {
ILOG(Warning, Support) << "CTP config not found, run:" << run << ENDM;
}
Expand Down Expand Up @@ -215,7 +221,10 @@ void CTPRawDataReaderTask::monitorData(o2::framework::ProcessingContext& ctx)
std::vector<o2::ctp::CTPDigit> outputDigits;

o2::framework::InputRecord& inputs = ctx.inputs();
mDecoder.decodeRaw(inputs, filter, outputDigits, lumiPointsHBF1);
int ret = mDecoder.decodeRaw(inputs, filter, outputDigits, lumiPointsHBF1);
if (ret > 0) {
mHistoDecodeError->Fill(log2(ret) + 1.5);
}

// reading the ctp inputs and ctp classes
for (auto const digit : outputDigits) {
Expand Down Expand Up @@ -282,6 +291,7 @@ void CTPRawDataReaderTask::reset()
mHistoClassRatios->Reset();
mHistoBCMinBias1->Reset();
mHistoBCMinBias2->Reset();
mHistoDecodeError->Reset();
}

} // namespace o2::quality_control_modules::ctp
57 changes: 57 additions & 0 deletions Modules/CTP/src/RawDataReaderCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ Quality RawDataReaderCheck::check(std::map<std::string, std::shared_ptr<MonitorO
result.set(setQualityResult(mVecIndexBad, mVecIndexMedium));
}
mHistClassRatioPrevious = (TH1D*)h->Clone();
} else if (mo->getName() == "decodeError") {
if (h->GetEntries() > 0) {
result.set(Quality::Bad);
} else {
result.set(Quality::Good);
}
} else {
ILOG(Info, Support) << "Unknown histo:" << moName << ENDM;
}
Expand Down Expand Up @@ -186,6 +192,14 @@ int RawDataReaderCheck::checkChangeOfRatio(TH1D* mHist, TH1D* mHistPrev, TH1D* m
}
return 0;
}
float RawDataReaderCheck::setTextPosition(float iPos, std::shared_ptr<TLatex> msg, TH1D* h)
{
msg->SetTextSize(0.03);
msg->SetNDC();
h->GetListOfFunctions()->Add(msg->Clone());
float MessagePos = iPos - 0.04;
return MessagePos;
}

std::string RawDataReaderCheck::getAcceptedType() { return "TH1"; }

Expand All @@ -194,6 +208,10 @@ void RawDataReaderCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality che
std::shared_ptr<TLatex> msg;
if (mo->getName() == "bcMinBias1" || mo->getName() == "bcMinBias2") {
auto* h = dynamic_cast<TH1D*>(mo->getObject());
if (h == nullptr) {
ILOG(Info, Support) << "null pointer for hist:" << mo->getName() << ENDM;
return;
}
h->SetMarkerStyle(20);
h->SetMarkerSize(0.6);
if (checkResult != Quality::Null) {
Expand Down Expand Up @@ -255,8 +273,47 @@ void RawDataReaderCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality che
}
h->SetStats(kFALSE);
h->GetYaxis()->SetRangeUser(0, h->GetMaximum() * 1.5);
} else if (mo->getName() == "decodeError") {
auto* h = dynamic_cast<TH1D*>(mo->getObject());
Copy link
Collaborator

Choose a reason for hiding this comment

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

h can be null. Please check for it and return if needed.

if (h == nullptr) {
ILOG(Info, Support) << "null pointer for hist:" << mo->getName() << ENDM;
return;
}
if (checkResult != Quality::Null) {
msg = std::make_shared<TLatex>(0.2, 0.85, Form("Quality: %s", (checkResult.getName()).c_str()));
if (checkResult == Quality::Bad) {
msg->SetTextColor(kRed);
} else if (checkResult == Quality::Good) {
msg->SetTextColor(kGreen + 1);
}
msg->SetTextSize(0.03);
msg->SetNDC();
h->GetListOfFunctions()->Add(msg->Clone());
}
if (checkResult == Quality::Bad) {
float initialMessagePos = 0.8;
string messages[9] = { "Failed to extract RDD",
"",
"Two CTP IRs with the same ts",
"Two digits with the same ts",
"Two CTP class masks with the same ts",
"Two digits (Class Mask) with the same ts",
"Trigger class without input",
"CTP class mask not compatible with input class mask",
"CTP class not found in the digit" };
for (int i = 1; i < h->GetXaxis()->GetNbins() + 1; i++) {
if (h->GetBinContent(i) > 0) {
msg = std::make_shared<TLatex>(0.2, initialMessagePos, messages[i - 1].c_str());
initialMessagePos = setTextPosition(initialMessagePos, msg, h);
}
}
}
} else {
auto* h = dynamic_cast<TH1D*>(mo->getObject());
if (h == nullptr) {
ILOG(Info, Support) << "null pointer for hist:" << mo->getName() << ENDM;
return;
}
h->SetStats(kFALSE);
msg = std::make_shared<TLatex>(0.45, 0.8, Form("Quality: %s", (checkResult.getName()).c_str()));
std::string groupName = "Input";
Expand Down
10 changes: 5 additions & 5 deletions Modules/CTP/src/qc-ctp.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,22 @@
"ccdbName": "https://alice-ccdb.cern.ch",
"MBclassName" : "CMTVX-B-NOPF",
"MB1inputName" : "MTVX",
"MB2inputName" : "MTVA"
"MB2inputName" : "MVBA"
}
},
"PHYSICS": {
"default": {
"MBclassName" : "CMTVX-B-NOPF",
"MB1inputName" : "MTVX",
"MB2inputName" : "MTVA"
"MB2inputName" : "MVBA"
},
"PROTON-PROTON": {
"MBclassName" : "CMTVX-B-NOPF",
"MB1inputName" : "MTVX",
"MB2inputName" : "MTVA"
},
"Pb-Pb": {
"MBclassName" : "CMTVX-B-NOPF",
"MBclassName" : "CMTCE-B-NOPF",
"MB1inputName" : "MTSC",
"MB2inputName" : "MTCE"
}
Expand All @@ -81,14 +81,14 @@
"dataSource": [{
"type": "Task",
"name": "CTPRawData",
"MOs": ["bcMinBias1","bcMinBias2","inputs","classes","inputRatio","classRatio"]
"MOs": ["bcMinBias1","bcMinBias2","inputs","classes","inputRatio","classRatio","decodeError"]
}],
"checkParameters": {
"thresholdRateBad": "3",
"thresholdRateMedium": "2",
"thresholdRateRatioBad": "3",
"thresholdRateRatioMedium": "2",
"mNSigBC": "2"
"nSigmaBC": "1"
}
}
}
Expand Down