From dcd6667aeada90b1a78c7451e54c643a3853ea55 Mon Sep 17 00:00:00 2001 From: Lucia Anna Tarasovicova Date: Fri, 20 Sep 2024 15:22:15 +0200 Subject: [PATCH 1/2] PbPb run preparation --- Modules/CTP/include/CTP/RawDataQcTask.h | 6 ++-- Modules/CTP/src/RawDataQcTask.cxx | 43 ++++++++++++++++--------- Modules/CTP/src/RawDataReaderCheck.cxx | 34 +++++++++---------- Modules/CTP/src/qc-ctp.json | 32 +++++++++++++++--- 4 files changed, 74 insertions(+), 41 deletions(-) diff --git a/Modules/CTP/include/CTP/RawDataQcTask.h b/Modules/CTP/include/CTP/RawDataQcTask.h index 1deb633d41..0c342e9a27 100644 --- a/Modules/CTP/include/CTP/RawDataQcTask.h +++ b/Modules/CTP/include/CTP/RawDataQcTask.h @@ -54,9 +54,11 @@ class CTPRawDataReaderTask final : public TaskInterface std::unique_ptr mHistoClasses = nullptr; // histogram with ctp classes std::unique_ptr mHistoInputRatios = nullptr; // histogram with ctp input ratios to MB std::unique_ptr mHistoClassRatios = nullptr; // histogram with ctp class ratios to MB - std::unique_ptr mHistoMTVXBC = nullptr; // histogram of BC positions to check LHC filling scheme + std::unique_ptr mHistoBCMinBias1 = nullptr; // histogram of BC positions to check LHC filling scheme + std::unique_ptr 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; diff --git a/Modules/CTP/src/RawDataQcTask.cxx b/Modules/CTP/src/RawDataQcTask.cxx index a79fbfbffd..a1265e5a72 100644 --- a/Modules/CTP/src/RawDataQcTask.cxx +++ b/Modules/CTP/src/RawDataQcTask.cxx @@ -43,14 +43,16 @@ void CTPRawDataReaderTask::initialize(o2::framework::InitContext& /*ctx*/) mHistoClasses = std::make_unique("classes", "Class Rates; Class; Rate [kHz]", nclasses, 0, nclasses, true); mHistoInputs->SetStats(0); mHistoClasses->SetStats(0); - mHistoMTVXBC = std::make_unique("bcMTVX", "BC position of MTVX", norbits, 0, norbits); + mHistoBCMinBias1 = std::make_unique("bcMinBias1", "BC position MB1", norbits, 0, norbits); + mHistoBCMinBias2 = std::make_unique("bcMinBias2", "BC position MB2", norbits, 0, norbits); mHistoInputRatios = std::make_unique("inputRatio", "Input Ratio to MTVX; Input; Ratio;", ninps, 0, ninps, true); mHistoClassRatios = std::make_unique("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); @@ -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()) { @@ -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 = 1; // 3 is the MT0A index } for (int i = 0; i < nclasses; i++) { if (classNames[i] == "") { @@ -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() @@ -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); + } } } } @@ -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 diff --git a/Modules/CTP/src/RawDataReaderCheck.cxx b/Modules/CTP/src/RawDataReaderCheck.cxx index 60a67696b3..c3ed5d8d0a 100644 --- a/Modules/CTP/src/RawDataReaderCheck.cxx +++ b/Modules/CTP/src/RawDataReaderCheck.cxx @@ -90,12 +90,15 @@ Quality RawDataReaderCheck::check(std::mapgetName() == "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 @@ -191,11 +194,11 @@ std::string RawDataReaderCheck::getAcceptedType() { return "TH1"; } void RawDataReaderCheck::beautify(std::shared_ptr mo, Quality checkResult) { std::shared_ptr msg; - if (mo->getName() == "bcMTVX") { + if (mo->getName() == "bcMinBias1" || mo->getName() == "bcMinBias2") { auto* h = dynamic_cast(mo->getObject()); h->GetXaxis()->SetTitle("BC"); if (checkResult != Quality::Null) { - msg = std::make_shared(0.4, 0.85, Form("Quality: %s", (checkResult.getName()).c_str())); + msg = std::make_shared(0.2, 0.85, Form("Quality: %s", (checkResult.getName()).c_str())); if (checkResult == Quality::Bad) { msg->SetTextColor(kRed); } else if (checkResult == Quality::Medium) { @@ -209,48 +212,43 @@ void RawDataReaderCheck::beautify(std::shared_ptr mo, Quality che } if (checkResult == Quality::Null) { - msg = std::make_shared(0.4, 0.8, Form("Check was not performed, LHC information not available")); + msg = std::make_shared(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(0.4, 0.8, Form("Number of good BC: %lu", mVecGoodBC.size())); + msg = std::make_shared(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(0.4, 0.75, Form("BC is expected on following possitions but inputs are below threshold:")); + msg = std::make_shared(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(0.4, 0.75, Form("%d", mVecMediumBC[i])); - msg->SetTextSize(0.03); + msg = std::make_shared(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(0.4, 0.75, Form("BC is not expected on following possitions but inputs are above threshold:")); + msg = std::make_shared(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(0.4, 0.75, Form("%d", mVecBadBC[i])); - msg->SetTextSize(0.03); + msg = std::make_shared(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(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); diff --git a/Modules/CTP/src/qc-ctp.json b/Modules/CTP/src/qc-ctp.json index 80058381eb..8325bd380d 100644 --- a/Modules/CTP/src/qc-ctp.json +++ b/Modules/CTP/src/qc-ctp.json @@ -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" } @@ -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", From 70897f73152c4fbe0f7fe2268b9d80d3b8e9ebdf Mon Sep 17 00:00:00 2001 From: Lucia Anna Tarasovicova Date: Mon, 23 Sep 2024 13:12:04 +0200 Subject: [PATCH 2/2] change default for MB2 --- Modules/CTP/src/RawDataQcTask.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/CTP/src/RawDataQcTask.cxx b/Modules/CTP/src/RawDataQcTask.cxx index a1265e5a72..bd27a386c9 100644 --- a/Modules/CTP/src/RawDataQcTask.cxx +++ b/Modules/CTP/src/RawDataQcTask.cxx @@ -126,7 +126,7 @@ void CTPRawDataReaderTask::startOfActivity(const Activity& activity) indexMB1 = 3; // 3 is the MTVX index } if (indexMB2 == -1) { - indexMB2 = 1; // 3 is the MT0A index + indexMB2 = 5; // 5 is the MTCE index } for (int i = 0; i < nclasses; i++) { if (classNames[i] == "") {