Skip to content
Draft
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
48 changes: 48 additions & 0 deletions ALICE3/DataModel/OTFLUT.h
Original file line number Diff line number Diff line change
@@ -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, "LUTS"); //!
// DECLARE_SOA_CCDB_COLUMN(LUTHeader, lutHeader, o2::dataformats::CalibLHCphaseTOF, "TOF/Calib/LHCphase"); //!

} // namespace otf::lut

DECLARE_SOA_TIMESTAMPED_TABLE(LUTs, aod::Timestamps, o2::aod::timestamp::Timestamp, 1, "LUTs", //!
otf::lut::LUTHeader);
} // namespace o2::aod

#endif // ALICE3_DATAMODEL_OTFLUT_H_
36 changes: 35 additions & 1 deletion ALICE3/TableProducer/OTF/onTheFlyDetectorGeometryProvider.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
///

#include "ALICE3/Core/FastTracker.h"
#include "ALICE3/DataModel/OTFLUT.h"

#include <CCDB/BasicCCDBManager.h>
#include <Framework/AnalysisTask.h>
Expand All @@ -33,6 +34,7 @@ struct OnTheFlyDetectorGeometryProvider {
o2::framework::Configurable<std::vector<std::string>> detectorConfiguration{"detectorConfiguration",
std::vector<std::string>{"$O2PHYSICS_ROOT/share/alice3/a3geometry_v3.ini"},
"Paths of the detector geometry configuration files"};
o2::framework::Produces<o2::aod::LUTs> lutTable;
o2::framework::Service<o2::ccdb::BasicCCDBManager> ccdb;
void init(o2::framework::InitContext&)
{
Expand Down Expand Up @@ -64,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<char*>(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.";
}
};

Expand Down
Loading