From 026c022634143765930ce83a16762f096e5d5750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 14 Jul 2025 14:01:53 +0200 Subject: [PATCH] A3TOF: cleanup --- ALICE3/CMakeLists.txt | 2 +- ALICE3/Tools/CMakeLists.txt | 15 --- ALICE3/Tools/handleParamTOFResoALICE3.cxx | 132 ---------------------- 3 files changed, 1 insertion(+), 148 deletions(-) delete mode 100644 ALICE3/Tools/CMakeLists.txt delete mode 100644 ALICE3/Tools/handleParamTOFResoALICE3.cxx diff --git a/ALICE3/CMakeLists.txt b/ALICE3/CMakeLists.txt index ab460641cad..10172ee7d01 100644 --- a/ALICE3/CMakeLists.txt +++ b/ALICE3/CMakeLists.txt @@ -14,4 +14,4 @@ add_subdirectory(Core) # add_subdirectory(DataModel) add_subdirectory(Tasks) add_subdirectory(TableProducer) -add_subdirectory(Tools) +# add_subdirectory(Tools) diff --git a/ALICE3/Tools/CMakeLists.txt b/ALICE3/Tools/CMakeLists.txt deleted file mode 100644 index 7aecd79362b..00000000000 --- a/ALICE3/Tools/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2019-2020 CERN and copyright holders of ALICE O2. -# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -# All rights not expressly granted are reserved. -# -# This software is distributed under the terms of the GNU General Public -# License v3 (GPL Version 3), copied verbatim in the file "COPYING". -# -# In applying this license CERN does not waive the privileges and immunities -# granted to it by virtue of its status as an Intergovernmental Organization -# or submit itself to any jurisdiction. - -o2physics_add_executable(pidparam-tof-reso-alice3 - SOURCES handleParamTOFResoALICE3.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::ALICE3Core - ) diff --git a/ALICE3/Tools/handleParamTOFResoALICE3.cxx b/ALICE3/Tools/handleParamTOFResoALICE3.cxx deleted file mode 100644 index 79184cfd8d2..00000000000 --- a/ALICE3/Tools/handleParamTOFResoALICE3.cxx +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// -/// \file handleParamTOFResoALICE3.cxx -/// \author Nicolo' Jacazio -/// \since 2020-06-22 -/// \brief A simple tool to produce Bethe Bloch parametrization objects for the TOF PID Response -/// - -#include "CCDB/CcdbApi.h" -#include -#include "Framework/Logger.h" -#include "TFile.h" -#include "ALICE3/Core/TOFResoALICE3.h" - -using namespace o2::pid::tof; -namespace bpo = boost::program_options; - -bool initOptionsAndParse(bpo::options_description& options, int argc, char* argv[], bpo::variables_map& vm) -{ - options.add_options()( - "url,u", bpo::value()->default_value("http://alice-ccdb.cern.ch"), "URL of the CCDB database")( - "ccdb-path,c", bpo::value()->default_value("Analysis/ALICE3/PID/TOF"), "CCDB path for storage/retrieval")( - "start,s", bpo::value()->default_value(0), "Start timestamp of object validity")( - "stop,S", bpo::value()->default_value(4108971600000), "Stop timestamp of object validity")( - "delete-previous,delete_previous,d", bpo::value()->default_value(0), "Flag to delete previous versions of converter objects in the CCDB before uploading the new one so as to avoid proliferation on CCDB")( - "save-to-file,file,f,o", bpo::value()->default_value(""), "Option to save parametrization to file instead of uploading to ccdb")( - "read-from-file,i", bpo::value()->default_value(""), "Option to get parametrization from a file")( - "reso-name,n", bpo::value()->default_value("TOFResoALICE3"), "Name of the parametrization object")( - "mode,m", bpo::value()->default_value(1), "Working mode: 0 push 1 pull and test")( - "p0", bpo::value()->default_value(20.0f), "Parameter 0 of the TOF resolution: average TOF resolution")( - "verbose,v", bpo::value()->default_value(0), "Verbose level 0, 1")( - "help,h", "Produce help message."); - try { - bpo::store(parse_command_line(argc, argv, options), vm); - - // help - if (vm.count("help")) { - LOG(info) << options; - return false; - } - - bpo::notify(vm); - } catch (const bpo::error& e) { - LOG(error) << e.what() << "\n"; - LOG(error) << "Error parsing command line arguments; Available options:"; - LOG(error) << options; - return false; - } - return true; -} - -int main(int argc, char* argv[]) -{ - bpo::options_description options("Allowed options"); - bpo::variables_map vm; - if (!initOptionsAndParse(options, argc, argv, vm)) { - return 1; - } - - const unsigned int mode = vm["mode"].as(); - const std::string path = vm["ccdb-path"].as(); - std::map metadata; - std::map* headers = nullptr; - o2::ccdb::CcdbApi api; - const std::string url = vm["url"].as(); - api.init(url); - if (!api.isHostReachable()) { - LOG(warning) << "CCDB host " << url << " is not reacheable, cannot go forward"; - return 1; - } - TOFResoALICE3* reso = nullptr; - const std::string reso_name = vm["reso-name"].as(); - if (mode == 0) { // Push mode - LOG(info) << "Handling TOF parametrization in create mode"; - const std::string input_file_name = vm["read-from-file"].as(); - if (!input_file_name.empty()) { - TFile f(input_file_name.data(), "READ"); - if (!f.IsOpen()) { - LOG(warning) << "Input file " << input_file_name << " is not reacheable, cannot get param from file"; - } - f.GetObject(reso_name.c_str(), reso); - f.Close(); - } - if (!reso) { - reso = new TOFResoALICE3(); - const std::vector resoparams = {vm["p0"].as()}; - reso->SetParameters(resoparams); - } - reso->Print(); - const std::string fname = vm["save-to-file"].as(); - if (!fname.empty()) { // Saving it to file - LOG(info) << "Saving parametrization to file " << fname; - TFile f(fname.data(), "RECREATE"); - reso->Write(); - reso->GetParameters().Write(); - f.ls(); - f.Close(); - } else { // Saving it to CCDB - LOG(info) << "Saving parametrization to CCDB " << path; - - long start = vm["start"].as(); - long stop = vm["stop"].as(); - - if (vm["delete-previous"].as()) { - api.truncate(path); - } - api.storeAsTFileAny(reso, path + "/" + reso_name, metadata, start, stop); - o2::pid::Parameters* params; - reso->GetParameters(params); - api.storeAsTFileAny(params, path + "/Parameters/" + reso_name, metadata, start, stop); - } - } else { // Pull and test mode - LOG(info) << "Handling TOF parametrization in test mode"; - const float x[7] = {1, 1, 1, 1, 1, 1, 1}; // mom, time, ev. reso, mass, length, sigma1pt, pt - reso = api.retrieveFromTFileAny(path + "/" + reso_name, metadata, -1, headers); - reso->Print(); - LOG(info) << "TOF expected resolution at p=" << x[0] << " GeV/c " - << " and mass " << x[3] << ":" << reso->operator()(x); - } - - return 0; -}