Skip to content
Open
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
27 changes: 13 additions & 14 deletions Modules/CTP/include/CTP/RawDataQcTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/// \author Marek Bombara
/// \author Lucia Anna Tarasovicova
/// \author Jan Musinsky
/// \date 2026-02-17
/// \date 2026-03-31
///

#ifndef QC_MODULE_CTP_CTPRAWDATAQCTASK_H
Expand Down Expand Up @@ -53,19 +53,18 @@ class CTPRawDataReaderTask final : public TaskInterface
void readLHCFillingScheme();

private:
o2::ctp::RawDataDecoder mDecoder; // ctp raw data decoder
std::unique_ptr<TH1DRatio> mHistoInputs = nullptr; // histogram with ctp inputs
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> 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
static constexpr int mUsedInputsMax = 18;
std::array<TH1D*, mUsedInputsMax> mHisInputs = {}; ///< Array of input histograms, all BCs
std::array<TH1D*, mUsedInputsMax> mHisInputsYesLHC = {}; ///< Array of input histograms, LHC BCs
std::array<TH1D*, mUsedInputsMax> mHisInputsNotLHC = {}; ///< Array of input histograms, not LHC BCs
std::array<std::size_t, mUsedInputsMax> shiftBC = {}; ///< Array of shifts for the BCs for each input
o2::ctp::RawDataDecoder mDecoder; // ctp raw data decoder
std::unique_ptr<TH1DRatio> mHistoInputs = nullptr; // histogram with ctp inputs
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> 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
std::array<TH1D*, o2::ctp::CTP_NINPUTS> mHisInputs = {}; ///< Array of input histograms, all BCs
std::array<TH1D*, o2::ctp::CTP_NINPUTS> mHisInputsYesLHC = {}; ///< Array of input histograms, LHC BCs
std::array<TH1D*, o2::ctp::CTP_NINPUTS> mHisInputsNotLHC = {}; ///< Array of input histograms, not LHC BCs
std::array<std::size_t, o2::ctp::CTP_NINPUTS> shiftBC = {}; ///< Array of shifts for the BCs for each input
int mRunNumber;
int indexMB1 = -1;
int indexMB2 = -1;
Expand Down
34 changes: 24 additions & 10 deletions Modules/CTP/src/RawDataQcTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/// \author Marek Bombara
/// \author Lucia Anna Tarasovicova
/// \author Jan Musinsky
/// \date 2026-02-17
/// \date 2026-03-31
///

#include <TCanvas.h>
Expand Down Expand Up @@ -71,11 +71,19 @@ void CTPRawDataReaderTask::initialize(o2::framework::InitContext& /*ctx*/)
getObjectsManager()->startPublishing(mHistoInputRatios.get());
getObjectsManager()->startPublishing(mHistoBCMinBias1.get());
getObjectsManager()->startPublishing(mHistoBCMinBias2.get());
std::string sTmp1, sTmp2;

std::string inputName, sTmp1, sTmp2;
std::vector<std::string> publishingInputs = {
"MT0A", "MT0C", "MTVX", "MTSC", "MTCE", // 5x FT0
"MVBA", "MVOR", "MVIR", "MVNC", "MVCH", // 5x FV0
"0UCE", "0USC", "0UVX", "0U0C", "0U0A", // 5x FDD
"1ZED", "1ZNC" // 2x ZDC
}; // or std::unordered_set (hash based container) instead of std::vector
for (std::size_t i = 0; i < mHisInputs.size(); i++) {
inputName = o2::ctp::CTPInputsConfiguration::getInputNameFromIndex(i + 1);
// index mismatch, getInputNameFromIndex in range [1-48]
sTmp1 = std::format("input{:02}", i);
sTmp2 = std::format("input[{:02}] {}", i, o2::ctp::CTPInputsConfiguration::getInputNameFromIndex(i + 1));
// getInputNameFromIndex in range [1-48]
sTmp2 = std::format("input[{:02}] {}", i, inputName);
mHisInputs[i] = new TH1D(sTmp1.c_str(), sTmp2.c_str(), norbits, 0, norbits);

sTmp1 = std::format("input{:02}_yesLHC", i);
Expand All @@ -88,9 +96,11 @@ void CTPRawDataReaderTask::initialize(o2::framework::InitContext& /*ctx*/)
mHisInputsNotLHC[i]->SetLineColor(kRed + 1);
mHisInputsNotLHC[i]->SetFillColor(kRed + 1);

getObjectsManager()->startPublishing(mHisInputs[i]);
getObjectsManager()->startPublishing(mHisInputsYesLHC[i]);
// getObjectsManager()->startPublishing(mHisInputsNotLHC[i]);
if (std::find(publishingInputs.begin(), publishingInputs.end(), inputName) != publishingInputs.end()) {
getObjectsManager()->startPublishing(mHisInputs[i]);
getObjectsManager()->startPublishing(mHisInputsYesLHC[i]);
// getObjectsManager()->startPublishing(mHisInputsNotLHC[i]);
}
}

mDecoder.setDoLumi(1);
Expand Down Expand Up @@ -342,7 +352,7 @@ void CTPRawDataReaderTask::monitorData(o2::framework::ProcessingContext& ctx)
for (auto const digit : outputDigits) {
uint16_t bcid = digit.intRecord.bc;
if (digit.CTPInputMask.count()) {
for (int i = 0; i < mUsedInputsMax; i++) {
for (int i = 0; i < o2::ctp::CTP_NINPUTS; i++) {
if (digit.CTPInputMask[i]) {
mHistoInputs->getNum()->Fill(i);
mHistoInputRatios->getNum()->Fill(i);
Expand All @@ -355,8 +365,8 @@ void CTPRawDataReaderTask::monitorData(o2::framework::ProcessingContext& ctx)
int bc = bcid - mShiftInput2 >= 0 ? bcid - mShiftInput2 : bcid - mShiftInput2 + 3564;
mHistoBCMinBias2->Fill(bc, 1. / mScaleInput2);
}
// int bc = (bcid - shiftBC[i]) >= 0 ? bcid - shiftBC[i] : bcid - shiftBC[i] + o2::constants::lhc::LHCMaxBunches;
int bc = bcid - shiftBC[i];
int bc = (bcid - shiftBC[i]) >= 0 ? bcid - shiftBC[i] : bcid - shiftBC[i] + o2::constants::lhc::LHCMaxBunches;
// int bc = bcid - shiftBC[i];
mHisInputs[i]->Fill(bc);
}
}
Expand Down Expand Up @@ -425,6 +435,10 @@ void CTPRawDataReaderTask::splitSortInputs()
mHisInputsNotLHC[ih]->SetBinContent(ibc + 1, BCs[ibc].entries);
}
}
// specific case: NotLHC("red") > YesLHC("green"), i.a. for SYNTHETIC run type
if (mHisInputsNotLHC[ih]->GetMaximum() > mHisInputsYesLHC[ih]->GetMaximum()) {
mHisInputsYesLHC[ih]->SetMaximum(mHisInputsNotLHC[ih]->GetMaximum() * 1.05);
}

TLine* line = nullptr;
if (!mHisInputsYesLHC[ih]->FindObject(mHisInputsNotLHC[ih])) { // only once
Expand Down
Loading