From abb9471a0f2dc3491eea655c3ef3c8f92cddc4a4 Mon Sep 17 00:00:00 2001 From: Maximiliano Puccio Date: Tue, 11 Nov 2025 11:40:01 +0100 Subject: [PATCH 1/2] Get menu for period --- EventFiltering/macros/getMenu.C | 45 +++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/EventFiltering/macros/getMenu.C b/EventFiltering/macros/getMenu.C index 692ebe396f3..624e7cab789 100644 --- a/EventFiltering/macros/getMenu.C +++ b/EventFiltering/macros/getMenu.C @@ -12,8 +12,13 @@ #include "CCDB/BasicCCDBManager.h" #include +#include +#include #include +#include +#include +#include #include void getMenu(int runNumber, std::string baseCCDBPath = "Users/m/mpuccio/EventFiltering/OTS/Chunked/") @@ -29,3 +34,43 @@ void getMenu(int runNumber, std::string baseCCDBPath = "Users/m/mpuccio/EventFil std::cout << "Id " << i - 2 << ": " << axis->GetBinLabel(i) << "\n"; } } + +void getMenu(std::string period) +{ + std::regex pattern(R"(LHC(\d{2})[A-Za-z]{1,2})"); + std::smatch match; + + int year{2000}; + if (std::regex_match(period, match, pattern)) { + std::cout << "Year = " << match[1] << std::endl; + year += std::stoi(match[1]); + } else { + std::cout << "Invalid format" << std::endl; + } + gSystem->Exec(Form("alien_find /alice/data/%i/%s/ ctf_skim_full/AnalysisResults_fullrun.root > list_tmp.txt", year, period.data())); + + std::ifstream file("list_tmp.txt"); + if (!file) { + std::cerr << "Error: could not open file\n"; + return; + } + + std::string firstLine; + if (!std::getline(file, firstLine)) { + std::cerr << "Error: file is empty or read failed\n"; + return; + } + + std::cout << "First line: " << firstLine << '\n'; + TGrid::Connect("alien://"); + TFile *scalersFile = TFile::Open((std::string("alien://") + firstLine).data(), "READ"); + TH1D* counters = (TH1D*)scalersFile->Get("central-event-filter-task/scalers/mFiltered"); + TAxis* axis = counters->GetXaxis(); + + std::vector binLabels(axis->GetNbins() - 2); // skip first and last bins + for (int i = 2; i < axis->GetNbins(); ++i) { + binLabels[i - 1] = axis->GetBinLabel(i); + std::cout << "Id " << i - 2 << ": " << axis->GetBinLabel(i) << "\n"; + } + gSystem->Exec("rm list_tmp.txt"); +} From b4c723e906e95f96ce89e3e034ea7a8c4e5f4e37 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 11 Nov 2025 10:40:38 +0000 Subject: [PATCH 2/2] Please consider the following formatting changes --- EventFiltering/macros/getMenu.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EventFiltering/macros/getMenu.C b/EventFiltering/macros/getMenu.C index 624e7cab789..d73861b9cb8 100644 --- a/EventFiltering/macros/getMenu.C +++ b/EventFiltering/macros/getMenu.C @@ -63,7 +63,7 @@ void getMenu(std::string period) std::cout << "First line: " << firstLine << '\n'; TGrid::Connect("alien://"); - TFile *scalersFile = TFile::Open((std::string("alien://") + firstLine).data(), "READ"); + TFile* scalersFile = TFile::Open((std::string("alien://") + firstLine).data(), "READ"); TH1D* counters = (TH1D*)scalersFile->Get("central-event-filter-task/scalers/mFiltered"); TAxis* axis = counters->GetXaxis();