From 120f6eddb2d15ced18af6d8272c0fe20a79851f9 Mon Sep 17 00:00:00 2001 From: Lucia Anna Tarasovicova Date: Mon, 28 Oct 2024 20:53:30 +0100 Subject: [PATCH] CTP: change in RawDataReaderCheck.cxx (#2463) * fix for overlapping messages * add a parameter for possible shift of the BC possition --------- Co-authored-by: Lucia Anna Tarasovicova --- Modules/CTP/include/CTP/RawDataQcTask.h | 2 ++ Modules/CTP/src/RawDataQcTask.cxx | 36 +++++++++++++++++++++---- Modules/CTP/src/RawDataReaderCheck.cxx | 17 +++++++----- 3 files changed, 44 insertions(+), 11 deletions(-) diff --git a/Modules/CTP/include/CTP/RawDataQcTask.h b/Modules/CTP/include/CTP/RawDataQcTask.h index 1dc1a149d..ea55abfc8 100644 --- a/Modules/CTP/include/CTP/RawDataQcTask.h +++ b/Modules/CTP/include/CTP/RawDataQcTask.h @@ -59,6 +59,8 @@ class CTPRawDataReaderTask final : public TaskInterface int mRunNumber; int indexMB1 = -1; int indexMB2 = -1; + int mShiftInput1 = 0; + int mShiftInput2 = 0; static const int ninps = o2::ctp::CTP_NINPUTS + 1; static const int nclasses = o2::ctp::CTP_NCLASSES + 1; double mScaleInput1 = 1; diff --git a/Modules/CTP/src/RawDataQcTask.cxx b/Modules/CTP/src/RawDataQcTask.cxx index f2d95d365..a1b2f79b0 100644 --- a/Modules/CTP/src/RawDataQcTask.cxx +++ b/Modules/CTP/src/RawDataQcTask.cxx @@ -132,6 +132,9 @@ void CTPRawDataReaderTask::startOfActivity(const Activity& activity) if (input1Tokens.size() > 1) { mScaleInput1 = std::stod(input1Tokens[1]); } + if (input1Tokens.size() > 2) { + mShiftInput1 = std::stod(input1Tokens[2]); + } auto input2Tokens = o2::utils::Str::tokenize(nameInput2, ':', false, true); if (input2Tokens.size() > 0) { @@ -140,6 +143,9 @@ void CTPRawDataReaderTask::startOfActivity(const Activity& activity) if (input2Tokens.size() > 1) { mScaleInput2 = std::stod(input2Tokens[1]); } + if (input2Tokens.size() > 2) { + mShiftInput2 = std::stod(input2Tokens[2]); + } indexMB1 = o2::ctp::CTPInputsConfiguration::getInputIndexFromName(nameInput1); indexMB2 = o2::ctp::CTPInputsConfiguration::getInputIndexFromName(nameInput2); @@ -165,11 +171,31 @@ void CTPRawDataReaderTask::startOfActivity(const Activity& activity) 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())); + TString title1 = Form("BC position %s", nameInput1.c_str()); + TString titley1 = Form("Rate"); + TString titleX1 = Form("BC"); + if (mScaleInput1 > 1) { + title1 += Form(", scaled with 1/%g", mScaleInput1); + titley1 += Form(" #times 1/%g", mScaleInput1); + } + if (mShiftInput1 > 0) { + title1 += Form(", shifted by - %d", mShiftInput1); + titleX1 += Form(" - %d", mShiftInput1); + } + mHistoBCMinBias1->SetTitle(Form("%s; %s; %s", title1.Data(), titleX1.Data(), titley1.Data())); + + TString title2 = Form("BC position %s", nameInput2.c_str()); + TString titley2 = Form("Rate"); + TString titleX2 = Form("BC"); if (mScaleInput2 > 1) { - mHistoBCMinBias2->SetTitle(Form("BC position %s scaled 1/%g", nameInput2.c_str(), mScaleInput2)); + title2 += Form(", scaled with 1/%g", mScaleInput2); + titley2 += Form(" #times 1/%g", mScaleInput2); + } + if (mShiftInput2 > 0) { + title2 += Form(", shifted by - %d", mShiftInput2); + titleX2 += Form(" - %d", mShiftInput2); } + mHistoBCMinBias2->SetTitle(Form("%s; %s; %s", title2.Data(), titleX2.Data(), titley2.Data())); mHistoClassRatios->SetTitle(Form("Class Ratio to %s", MBclassName.c_str())); mHistoInputRatios->SetTitle(Form("Input Ratio to %s", nameInput1.c_str())); } @@ -200,11 +226,11 @@ void CTPRawDataReaderTask::monitorData(o2::framework::ProcessingContext& ctx) mHistoInputs->getNum()->Fill(i); mHistoInputRatios->getNum()->Fill(i); if (i == indexMB1 - 1) { - mHistoBCMinBias1->Fill(bcid, 1. / mScaleInput1); + mHistoBCMinBias1->Fill((bcid - mShiftInput1) % 3564, 1. / mScaleInput1); mHistoInputRatios->getDen()->Fill(0., 1); } if (i == indexMB2 - 1) { - mHistoBCMinBias2->Fill(bcid, 1. / mScaleInput2); + mHistoBCMinBias2->Fill((bcid - mShiftInput2) % 3564, 1. / mScaleInput2); } } } diff --git a/Modules/CTP/src/RawDataReaderCheck.cxx b/Modules/CTP/src/RawDataReaderCheck.cxx index 624cca4bc..69c816734 100644 --- a/Modules/CTP/src/RawDataReaderCheck.cxx +++ b/Modules/CTP/src/RawDataReaderCheck.cxx @@ -194,7 +194,8 @@ void RawDataReaderCheck::beautify(std::shared_ptr mo, Quality che std::shared_ptr msg; if (mo->getName() == "bcMinBias1" || mo->getName() == "bcMinBias2") { auto* h = dynamic_cast(mo->getObject()); - h->GetXaxis()->SetTitle("BC"); + h->SetMarkerStyle(20); + h->SetMarkerSize(0.6); if (checkResult != Quality::Null) { msg = std::make_shared(0.2, 0.85, Form("Quality: %s", (checkResult.getName()).c_str())); if (checkResult == Quality::Bad) { @@ -222,26 +223,30 @@ void RawDataReaderCheck::beautify(std::shared_ptr mo, Quality che msg->SetNDC(); h->GetListOfFunctions()->Add(msg->Clone()); + float messagePos = 0.75; + float initialMessagePos = 0.75; if (mVecMediumBC.size() > 0) { - msg = std::make_shared(0.2, 0.75, Form("BC is expected on following possitions, but inputs are below threshold (%f):", mThreshold)); + msg = std::make_shared(0.2, initialMessagePos, Form("BC is expected on following possitions, but inputs are below threshold (%g):", round(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.2, 0.75 - (i + 1) * 0.02, Form("%d", mVecMediumBC[i])); + messagePos = initialMessagePos - (i + 1) * 0.02; + msg = std::make_shared(0.2, messagePos, Form("%d", mVecMediumBC[i])); msg->SetTextSize(0.02); msg->SetNDC(); h->GetListOfFunctions()->Add(msg->Clone()); } } - + initialMessagePos = messagePos - 0.04; if (mVecBadBC.size() > 0) { - msg = std::make_shared(0.2, 0.75, Form("BC is not expected on following possitions, but inputs are above threshold (%f):", mThreshold)); + msg = std::make_shared(0.2, initialMessagePos, Form("BC is not expected on following possitions, but inputs are above threshold (%g):", round(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.2, 0.75 - (i + 1) * 0.02, Form("%d", mVecBadBC[i])); + messagePos = initialMessagePos - (i + 1) * 0.02; + msg = std::make_shared(0.2, messagePos, Form("%d", mVecBadBC[i])); msg->SetTextSize(0.02); msg->SetNDC(); h->GetListOfFunctions()->Add(msg->Clone());