Skip to content

Commit

Permalink
CTP: change in RawDataReaderCheck.cxx (#2463)
Browse files Browse the repository at this point in the history
* fix for overlapping messages

* add a parameter for possible shift of the BC possition

---------

Co-authored-by: Lucia Anna Tarasovicova <[email protected]>
  • Loading branch information
2 people authored and Barthelemy committed Oct 29, 2024
1 parent d064c26 commit 120f6ed
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 11 deletions.
2 changes: 2 additions & 0 deletions Modules/CTP/include/CTP/RawDataQcTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
36 changes: 31 additions & 5 deletions Modules/CTP/src/RawDataQcTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand All @@ -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()));
}
Expand Down Expand Up @@ -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);
}
}
}
Expand Down
17 changes: 11 additions & 6 deletions Modules/CTP/src/RawDataReaderCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ 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());
h->GetXaxis()->SetTitle("BC");
h->SetMarkerStyle(20);
h->SetMarkerSize(0.6);
if (checkResult != Quality::Null) {
msg = std::make_shared<TLatex>(0.2, 0.85, Form("Quality: %s", (checkResult.getName()).c_str()));
if (checkResult == Quality::Bad) {
Expand Down Expand Up @@ -222,26 +223,30 @@ void RawDataReaderCheck::beautify(std::shared_ptr<MonitorObject> 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<TLatex>(0.2, 0.75, Form("BC is expected on following possitions, but inputs are below threshold (%f):", mThreshold));
msg = std::make_shared<TLatex>(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<TLatex>(0.2, 0.75 - (i + 1) * 0.02, Form("%d", mVecMediumBC[i]));
messagePos = initialMessagePos - (i + 1) * 0.02;
msg = std::make_shared<TLatex>(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<TLatex>(0.2, 0.75, Form("BC is not expected on following possitions, but inputs are above threshold (%f):", mThreshold));
msg = std::make_shared<TLatex>(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<TLatex>(0.2, 0.75 - (i + 1) * 0.02, Form("%d", mVecBadBC[i]));
messagePos = initialMessagePos - (i + 1) * 0.02;
msg = std::make_shared<TLatex>(0.2, messagePos, Form("%d", mVecBadBC[i]));
msg->SetTextSize(0.02);
msg->SetNDC();
h->GetListOfFunctions()->Add(msg->Clone());
Expand Down

0 comments on commit 120f6ed

Please sign in to comment.