From 94cc5cb0d0130c6a22266f96e26d2c31051e72d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 23 Feb 2026 16:47:57 +0100 Subject: [PATCH 1/2] Proto simplification of LUTs --- ALICE3/DataModel/OTFLUT.h | 48 +++++++++++++++++++ .../OTF/onTheFlyDetectorGeometryProvider.cxx | 2 + 2 files changed, 50 insertions(+) create mode 100644 ALICE3/DataModel/OTFLUT.h diff --git a/ALICE3/DataModel/OTFLUT.h b/ALICE3/DataModel/OTFLUT.h new file mode 100644 index 00000000000..da746e6b4f7 --- /dev/null +++ b/ALICE3/DataModel/OTFLUT.h @@ -0,0 +1,48 @@ +// 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 OTFLUT.h +/// \since 23/02/2026 +/// \author Jesper & Nicolò +/// \brief Set of tables for ALICE 3 tracker +/// + +#ifndef ALICE3_DATAMODEL_OTFLUT_H_ +#define ALICE3_DATAMODEL_OTFLUT_H_ + +#include "ALICE3/Core/DelphesO2TrackSmearer.h" + +#include "DataFormatsTOF/CalibLHCphaseTOF.h" +#include "Framework/AnalysisDataModel.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +namespace o2::aod +{ +namespace otf::lut +{ + +// lutHeader_t* mLUTHeader[nLUTs] = {nullptr}; +// lutEntry_t***** mLUTEntry[nLUTs] = {nullptr}; + +DECLARE_SOA_CCDB_COLUMN(LUTHeader, lutHeader, lutHeader_t, "TOF/Calib/LHCphase"); //! +// DECLARE_SOA_CCDB_COLUMN(LUTHeader, lutHeader, o2::dataformats::CalibLHCphaseTOF, "TOF/Calib/LHCphase"); //! + +} // namespace otf::lut + +DECLARE_SOA_TIMESTAMPED_TABLE(TOFCalibrationObjects, aod::Timestamps, o2::aod::timestamp::Timestamp, 1, "TOFCALIB", //! + otf::lut::LUTHeader); +} // namespace o2::aod + +#endif // ALICE3_DATAMODEL_OTFLUT_H_ diff --git a/ALICE3/TableProducer/OTF/onTheFlyDetectorGeometryProvider.cxx b/ALICE3/TableProducer/OTF/onTheFlyDetectorGeometryProvider.cxx index 293745458c9..0de8d377585 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyDetectorGeometryProvider.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyDetectorGeometryProvider.cxx @@ -17,6 +17,7 @@ /// #include "ALICE3/Core/FastTracker.h" +#include "ALICE3/DataModel/OTFLUT.h" #include #include @@ -33,6 +34,7 @@ struct OnTheFlyDetectorGeometryProvider { o2::framework::Configurable> detectorConfiguration{"detectorConfiguration", std::vector{"$O2PHYSICS_ROOT/share/alice3/a3geometry_v3.ini"}, "Paths of the detector geometry configuration files"}; + o2::framework::Produces tofCalibObjects; o2::framework::Service ccdb; void init(o2::framework::InitContext&) { From 7ed67a14c36f9f6ad1ca9b0a523494aa81ed96ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 23 Feb 2026 16:54:36 +0100 Subject: [PATCH 2/2] Update --- ALICE3/DataModel/OTFLUT.h | 4 +-- .../OTF/onTheFlyDetectorGeometryProvider.cxx | 36 +++++++++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/ALICE3/DataModel/OTFLUT.h b/ALICE3/DataModel/OTFLUT.h index da746e6b4f7..a678488bdf9 100644 --- a/ALICE3/DataModel/OTFLUT.h +++ b/ALICE3/DataModel/OTFLUT.h @@ -36,12 +36,12 @@ namespace otf::lut // lutHeader_t* mLUTHeader[nLUTs] = {nullptr}; // lutEntry_t***** mLUTEntry[nLUTs] = {nullptr}; -DECLARE_SOA_CCDB_COLUMN(LUTHeader, lutHeader, lutHeader_t, "TOF/Calib/LHCphase"); //! +DECLARE_SOA_CCDB_COLUMN(LUTHeader, lutHeader, lutHeader_t, "LUTS"); //! // DECLARE_SOA_CCDB_COLUMN(LUTHeader, lutHeader, o2::dataformats::CalibLHCphaseTOF, "TOF/Calib/LHCphase"); //! } // namespace otf::lut -DECLARE_SOA_TIMESTAMPED_TABLE(TOFCalibrationObjects, aod::Timestamps, o2::aod::timestamp::Timestamp, 1, "TOFCALIB", //! +DECLARE_SOA_TIMESTAMPED_TABLE(LUTs, aod::Timestamps, o2::aod::timestamp::Timestamp, 1, "LUTs", //! otf::lut::LUTHeader); } // namespace o2::aod diff --git a/ALICE3/TableProducer/OTF/onTheFlyDetectorGeometryProvider.cxx b/ALICE3/TableProducer/OTF/onTheFlyDetectorGeometryProvider.cxx index 0de8d377585..65c0c334bc5 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyDetectorGeometryProvider.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyDetectorGeometryProvider.cxx @@ -34,7 +34,7 @@ struct OnTheFlyDetectorGeometryProvider { o2::framework::Configurable> detectorConfiguration{"detectorConfiguration", std::vector{"$O2PHYSICS_ROOT/share/alice3/a3geometry_v3.ini"}, "Paths of the detector geometry configuration files"}; - o2::framework::Produces tofCalibObjects; + o2::framework::Produces lutTable; o2::framework::Service ccdb; void init(o2::framework::InitContext&) { @@ -66,9 +66,41 @@ struct OnTheFlyDetectorGeometryProvider { LOG(info) << "Initialization completed"; } + lutHeader_t* mLUTHeader[10] = {nullptr}; void process(o2::aod::McCollisions const& mcCollisions, o2::aod::McParticles const& mcParticles) { - LOG(debug) << "On-the-fly detector geometry provider processing " << mcCollisions.size() << " collisions and " << mcParticles.size() << " particles."; + const int ipdg = 0; + mLUTHeader[ipdg] = new lutHeader_t; + + const std::string filename = "ccdb:/Users/j/jekarlss/LookUpTables/NoEloss/el"; + const std::string localFilename = o2::fastsim::GeometryEntry::accessFile(filename, "./.ALICE3/LUTs/", ccdb.operator->(), 10); + + std::ifstream lutFile(localFilename, std::ifstream::binary); + if (!lutFile.is_open()) { + LOG(info) << " --- cannot open covariance matrix file for PDG " << pdg << ": " << localFilename << std::endl; + delete mLUTHeader[ipdg]; + mLUTHeader[ipdg] = nullptr; + return false; + } + lutFile.read(reinterpret_cast(mLUTHeader[ipdg]), sizeof(lutHeader_t)); + if (lutFile.gcount() != sizeof(lutHeader_t)) { + LOG(info) << " --- troubles reading covariance matrix header for PDG " << pdg << ": " << filename << std::endl; + LOG(info) << " --- expected/detected " << sizeof(lutHeader_t) << "/" << lutFile.gcount() << std::endl; + delete mLUTHeader[ipdg]; + mLUTHeader[ipdg] = nullptr; + return false; + } + if (mLUTHeader[ipdg]->version != LUTCOVM_VERSION) { + LOG(info) << " --- LUT header version mismatch: expected/detected = " << LUTCOVM_VERSION << "/" << mLUTHeader[ipdg]->version << std::endl; + delete mLUTHeader[ipdg]; + mLUTHeader[ipdg] = nullptr; + return false; + } + + lutTable + + LOG(debug) + << "On-the-fly detector geometry provider processing " << mcCollisions.size() << " collisions and " << mcParticles.size() << " particles."; } };