Skip to content

Commit 7ed67a1

Browse files
committed
Update
1 parent 94cc5cb commit 7ed67a1

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

ALICE3/DataModel/OTFLUT.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ namespace otf::lut
3636
// lutHeader_t* mLUTHeader[nLUTs] = {nullptr};
3737
// lutEntry_t***** mLUTEntry[nLUTs] = {nullptr};
3838

39-
DECLARE_SOA_CCDB_COLUMN(LUTHeader, lutHeader, lutHeader_t, "TOF/Calib/LHCphase"); //!
39+
DECLARE_SOA_CCDB_COLUMN(LUTHeader, lutHeader, lutHeader_t, "LUTS"); //!
4040
// DECLARE_SOA_CCDB_COLUMN(LUTHeader, lutHeader, o2::dataformats::CalibLHCphaseTOF, "TOF/Calib/LHCphase"); //!
4141

4242
} // namespace otf::lut
4343

44-
DECLARE_SOA_TIMESTAMPED_TABLE(TOFCalibrationObjects, aod::Timestamps, o2::aod::timestamp::Timestamp, 1, "TOFCALIB", //!
44+
DECLARE_SOA_TIMESTAMPED_TABLE(LUTs, aod::Timestamps, o2::aod::timestamp::Timestamp, 1, "LUTs", //!
4545
otf::lut::LUTHeader);
4646
} // namespace o2::aod
4747

ALICE3/TableProducer/OTF/onTheFlyDetectorGeometryProvider.cxx

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct OnTheFlyDetectorGeometryProvider {
3434
o2::framework::Configurable<std::vector<std::string>> detectorConfiguration{"detectorConfiguration",
3535
std::vector<std::string>{"$O2PHYSICS_ROOT/share/alice3/a3geometry_v3.ini"},
3636
"Paths of the detector geometry configuration files"};
37-
o2::framework::Produces<o2::aod::TOFCalibrationObjects> tofCalibObjects;
37+
o2::framework::Produces<o2::aod::LUTs> lutTable;
3838
o2::framework::Service<o2::ccdb::BasicCCDBManager> ccdb;
3939
void init(o2::framework::InitContext&)
4040
{
@@ -66,9 +66,41 @@ struct OnTheFlyDetectorGeometryProvider {
6666
LOG(info) << "Initialization completed";
6767
}
6868

69+
lutHeader_t* mLUTHeader[10] = {nullptr};
6970
void process(o2::aod::McCollisions const& mcCollisions, o2::aod::McParticles const& mcParticles)
7071
{
71-
LOG(debug) << "On-the-fly detector geometry provider processing " << mcCollisions.size() << " collisions and " << mcParticles.size() << " particles.";
72+
const int ipdg = 0;
73+
mLUTHeader[ipdg] = new lutHeader_t;
74+
75+
const std::string filename = "ccdb:/Users/j/jekarlss/LookUpTables/NoEloss/el";
76+
const std::string localFilename = o2::fastsim::GeometryEntry::accessFile(filename, "./.ALICE3/LUTs/", ccdb.operator->(), 10);
77+
78+
std::ifstream lutFile(localFilename, std::ifstream::binary);
79+
if (!lutFile.is_open()) {
80+
LOG(info) << " --- cannot open covariance matrix file for PDG " << pdg << ": " << localFilename << std::endl;
81+
delete mLUTHeader[ipdg];
82+
mLUTHeader[ipdg] = nullptr;
83+
return false;
84+
}
85+
lutFile.read(reinterpret_cast<char*>(mLUTHeader[ipdg]), sizeof(lutHeader_t));
86+
if (lutFile.gcount() != sizeof(lutHeader_t)) {
87+
LOG(info) << " --- troubles reading covariance matrix header for PDG " << pdg << ": " << filename << std::endl;
88+
LOG(info) << " --- expected/detected " << sizeof(lutHeader_t) << "/" << lutFile.gcount() << std::endl;
89+
delete mLUTHeader[ipdg];
90+
mLUTHeader[ipdg] = nullptr;
91+
return false;
92+
}
93+
if (mLUTHeader[ipdg]->version != LUTCOVM_VERSION) {
94+
LOG(info) << " --- LUT header version mismatch: expected/detected = " << LUTCOVM_VERSION << "/" << mLUTHeader[ipdg]->version << std::endl;
95+
delete mLUTHeader[ipdg];
96+
mLUTHeader[ipdg] = nullptr;
97+
return false;
98+
}
99+
100+
lutTable
101+
102+
LOG(debug)
103+
<< "On-the-fly detector geometry provider processing " << mcCollisions.size() << " collisions and " << mcParticles.size() << " particles.";
72104
}
73105
};
74106

0 commit comments

Comments
 (0)