Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTP: PbPb run preparation #2426

Merged
merged 2 commits into from
Sep 25, 2024
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
6 changes: 4 additions & 2 deletions Modules/CTP/include/CTP/RawDataQcTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ class CTPRawDataReaderTask final : public TaskInterface
std::unique_ptr<TH1DRatio> mHistoClasses = nullptr; // histogram with ctp classes
std::unique_ptr<TH1DRatio> mHistoInputRatios = nullptr; // histogram with ctp input ratios to MB
std::unique_ptr<TH1DRatio> mHistoClassRatios = nullptr; // histogram with ctp class ratios to MB
std::unique_ptr<TH1D> mHistoMTVXBC = nullptr; // histogram of BC positions to check LHC filling scheme
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
int mRunNumber;
int indexTvx = -1;
int indexMB1 = -1;
int indexMB2 = -1;
static const int ninps = o2::ctp::CTP_NINPUTS + 1;
static const int nclasses = o2::ctp::CTP_NCLASSES + 1;
long int mTimestamp;
Expand Down
43 changes: 27 additions & 16 deletions Modules/CTP/src/RawDataQcTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@ void CTPRawDataReaderTask::initialize(o2::framework::InitContext& /*ctx*/)
mHistoClasses = std::make_unique<TH1DRatio>("classes", "Class Rates; Class; Rate [kHz]", nclasses, 0, nclasses, true);
mHistoInputs->SetStats(0);
mHistoClasses->SetStats(0);
mHistoMTVXBC = std::make_unique<TH1D>("bcMTVX", "BC position of MTVX", norbits, 0, norbits);
mHistoBCMinBias1 = std::make_unique<TH1D>("bcMinBias1", "BC position MB1", norbits, 0, norbits);
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);
getObjectsManager()->startPublishing(mHistoInputs.get());
getObjectsManager()->startPublishing(mHistoClasses.get());
getObjectsManager()->startPublishing(mHistoClassRatios.get());
getObjectsManager()->startPublishing(mHistoInputRatios.get());
getObjectsManager()->startPublishing(mHistoMTVXBC.get());
getObjectsManager()->startPublishing(mHistoBCMinBias1.get());
getObjectsManager()->startPublishing(mHistoBCMinBias2.get());

mDecoder.setDoLumi(1);
mDecoder.setDoDigits(1);
Expand All @@ -68,15 +70,14 @@ void CTPRawDataReaderTask::startOfActivity(const Activity& activity)
mHistoClasses->Reset();
mHistoClassRatios->Reset();
mHistoInputRatios->Reset();
mHistoMTVXBC->Reset();
mHistoBCMinBias1->Reset();
mHistoBCMinBias2->Reset();

mRunNumber = activity.mId;
mTimestamp = activity.mValidity.getMin();

std::string MBclassName = mCustomParameters["MBclassName"];
if (MBclassName.empty()) {
MBclassName = "CMTVX-B-NOPF";
}
auto MBclassName = mCustomParameters.atOrDefaultValue("MBclassName", "CMTVX-B-NOPF", activity);

std::string run = std::to_string(mRunNumber);
std::string ccdbName = mCustomParameters["ccdbName"];
if (ccdbName.empty()) {
Expand Down Expand Up @@ -116,13 +117,16 @@ void CTPRawDataReaderTask::startOfActivity(const Activity& activity)
if (mIndexMBclass == -1) {
mIndexMBclass = 1;
}
std::string nameInput = mCustomParameters["MBinputName"];
if (nameInput.empty()) {
nameInput = "MTVX";
std::string nameInput1 = mCustomParameters.atOrDefaultValue("MB1inputName", "MTVX", activity);
std::string nameInput2 = mCustomParameters.atOrDefaultValue("MB2inputName", "MT0A", activity);

indexMB1 = o2::ctp::CTPInputsConfiguration::getInputIndexFromName(nameInput1);
indexMB2 = o2::ctp::CTPInputsConfiguration::getInputIndexFromName(nameInput2);
if (indexMB1 == -1) {
indexMB1 = 3; // 3 is the MTVX index
}
indexTvx = o2::ctp::CTPInputsConfiguration::getInputIndexFromName(nameInput);
if (indexTvx == -1) {
indexTvx = 3; // 3 is the MTVX index
if (indexMB2 == -1) {
indexMB2 = 5; // 5 is the MTCE index
}
for (int i = 0; i < nclasses; i++) {
if (classNames[i] == "") {
Expand All @@ -137,6 +141,9 @@ void CTPRawDataReaderTask::startOfActivity(const Activity& activity)
mHistoClasses.get()->GetXaxis()->LabelsOption("v");
mHistoClassRatios.get()->GetXaxis()->SetLabelSize(0.025);
mHistoClassRatios.get()->GetXaxis()->LabelsOption("v");

mHistoBCMinBias1->SetTitle(Form("BC position %s", nameInput1.c_str()));
mHistoBCMinBias2->SetTitle(Form("BC position %s", nameInput2.c_str()));
}

void CTPRawDataReaderTask::startOfCycle()
Expand Down Expand Up @@ -164,10 +171,13 @@ void CTPRawDataReaderTask::monitorData(o2::framework::ProcessingContext& ctx)
if (digit.CTPInputMask[i]) {
mHistoInputs->getNum()->Fill(i);
mHistoInputRatios->getNum()->Fill(i);
if (i == indexTvx - 1) {
mHistoMTVXBC->Fill(bcid);
if (i == indexMB1 - 1) {
mHistoBCMinBias1->Fill(bcid);
mHistoInputRatios->getDen()->Fill(0., 1);
}
if (i == indexMB2 - 1) {
mHistoBCMinBias2->Fill(bcid);
}
}
}
}
Expand Down Expand Up @@ -214,7 +224,8 @@ void CTPRawDataReaderTask::reset()
mHistoClasses->Reset();
mHistoInputRatios->Reset();
mHistoClassRatios->Reset();
mHistoMTVXBC->Reset();
mHistoBCMinBias1->Reset();
mHistoBCMinBias2->Reset();
}

} // namespace o2::quality_control_modules::ctp
34 changes: 16 additions & 18 deletions Modules/CTP/src/RawDataReaderCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,15 @@ Quality RawDataReaderCheck::check(std::map<std::string, std::shared_ptr<MonitorO
ILOG(Info, Support) << "histogram is not found for check:" << moName << ENDM;
continue;
}
if (mo->getName() == "bcMTVX") {
if (mo->getName() == "bcMinBias1" || mo->getName() == "bcMinBias2") {
if (mLHCBCs.count() == 0) {
continue;
}
mThreshold = h->GetEntries() / mLHCBCs.count();
mThreshold = mThreshold - mNSigBC * sqrt(mThreshold);
float average = h->GetEntries() / mLHCBCs.count();
mThreshold = average - mNSigBC * sqrt(average);
if (mThreshold < std::sqrt(average)) {
mThreshold = average / 2;
}
for (int i = 0; i < o2::constants::lhc::LHCMaxBunches; i++) {
if (mLHCBCs[i] && h->GetBinContent(i + 1) <= mThreshold) {
mVecMediumBC.push_back(i); // medium BC occures when BC is expected on this possition but there is less inputs than threshold
Expand Down Expand Up @@ -191,11 +194,11 @@ std::string RawDataReaderCheck::getAcceptedType() { return "TH1"; }
void RawDataReaderCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult)
{
std::shared_ptr<TLatex> msg;
if (mo->getName() == "bcMTVX") {
if (mo->getName() == "bcMinBias1" || mo->getName() == "bcMinBias2") {
auto* h = dynamic_cast<TH1D*>(mo->getObject());
h->GetXaxis()->SetTitle("BC");
if (checkResult != Quality::Null) {
msg = std::make_shared<TLatex>(0.4, 0.85, Form("Quality: %s", (checkResult.getName()).c_str()));
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::Medium) {
Expand All @@ -209,48 +212,43 @@ void RawDataReaderCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality che
}

if (checkResult == Quality::Null) {
msg = std::make_shared<TLatex>(0.4, 0.8, Form("Check was not performed, LHC information not available"));
msg = std::make_shared<TLatex>(0.2, 0.8, Form("Check was not performed, LHC information not available"));
msg->SetTextColor(kBlack);
msg->SetTextSize(0.03);
msg->SetNDC();
h->GetListOfFunctions()->Add(msg->Clone());
} else {
msg = std::make_shared<TLatex>(0.4, 0.8, Form("Number of good BC: %lu", mVecGoodBC.size()));
msg = std::make_shared<TLatex>(0.2, 0.8, Form("Number of good BC: %lu", mVecGoodBC.size()));
msg->SetTextColor(kBlack);
msg->SetTextSize(0.03);
msg->SetNDC();
h->GetListOfFunctions()->Add(msg->Clone());

if (mVecMediumBC.size() > 0) {
msg = std::make_shared<TLatex>(0.4, 0.75, Form("BC is expected on following possitions but inputs are below threshold:"));
msg = std::make_shared<TLatex>(0.2, 0.75, Form("BC is expected on following possitions, but inputs are below threshold (%f):", mThreshold));
msg->SetTextSize(0.03);
msg->SetNDC();
h->GetListOfFunctions()->Add(msg->Clone());
for (size_t i = 0; i < mVecMediumBC.size(); i++) {
msg = std::make_shared<TLatex>(0.4, 0.75, Form("%d", mVecMediumBC[i]));
msg->SetTextSize(0.03);
msg = std::make_shared<TLatex>(0.2, 0.75 - (i + 1) * 0.02, Form("%d", mVecMediumBC[i]));
msg->SetTextSize(0.02);
msg->SetNDC();
h->GetListOfFunctions()->Add(msg->Clone());
}
}

if (mVecBadBC.size() > 0) {
msg = std::make_shared<TLatex>(0.4, 0.75, Form("BC is not expected on following possitions but inputs are above threshold:"));
msg = std::make_shared<TLatex>(0.2, 0.75, Form("BC is not expected on following possitions, but inputs are above threshold (%f):", mThreshold));
msg->SetTextSize(0.03);
msg->SetNDC();
h->GetListOfFunctions()->Add(msg->Clone());
for (size_t i = 0; i < mVecBadBC.size(); i++) {
msg = std::make_shared<TLatex>(0.4, 0.75, Form("%d", mVecBadBC[i]));
msg->SetTextSize(0.03);
msg = std::make_shared<TLatex>(0.2, 0.75 - (i + 1) * 0.02, Form("%d", mVecBadBC[i]));
msg->SetTextSize(0.02);
msg->SetNDC();
h->GetListOfFunctions()->Add(msg->Clone());
}
}

msg = std::make_shared<TLatex>(0.4, 0.65, Form("Threshold : %f", mThreshold));
msg->SetTextSize(0.03);
msg->SetNDC();
h->GetListOfFunctions()->Add(msg->Clone());
}
h->SetStats(kFALSE);
h->GetYaxis()->SetRangeUser(0, h->GetMaximum() * 1.5);
Expand Down
32 changes: 27 additions & 5 deletions Modules/CTP/src/qc-ctp.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,32 @@
"type": "dataSamplingPolicy",
"name": "ctp-raw"
},
"taskParameters": {
"ccdbName": "https://alice-ccdb.cern.ch",
"MBclassName" : "CMTVX-B-NOPF",
"MBinputName" : "MTVX"
"extendedTaskParameters": {
"default": {
"default": {
"ccdbName": "https://alice-ccdb.cern.ch",
"MBclassName" : "CMTVX-B-NOPF",
"MB1inputName" : "MTVX",
"MB2inputName" : "MTVA"
}
},
"PHYSICS": {
"default": {
"MBclassName" : "CMTVX-B-NOPF",
"MB1inputName" : "MTVX",
"MB2inputName" : "MTVA"
},
"PROTON-PROTON": {
"MBclassName" : "CMTVX-B-NOPF",
"MB1inputName" : "MTVX",
"MB2inputName" : "MTVA"
},
"Pb-Pb": {
"MBclassName" : "CMTVX-B-NOPF",
"MB1inputName" : "MTSC",
"MB2inputName" : "MTCE"
}
}
},
"location": "remote"
}
Expand All @@ -59,7 +81,7 @@
"dataSource": [{
"type": "Task",
"name": "CTPRawData",
"MOs": ["bcMTVX","inputs","classes","inputRatio","classRatio"]
"MOs": ["bcMinBias1","bcMinBias2","inputs","classes","inputRatio","classRatio"]
}],
"checkParameters": {
"thresholdRateBad": "3",
Expand Down
Loading