Skip to content
Open
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
170 changes: 169 additions & 1 deletion .claude/commands/migrate-ccdb.md

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions Common/Core/TPCVDriftManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,27 @@
LOGP(info, "Updated VDrift for timestamp {} with vdrift={:.7f} (cm/ns)", mVD->creationTime, mTPCVDriftNS);
}

// Adopts a drift correction obtained elsewhere, typically straight from the
// aod::TpcCalibCCDBObjects column, so no CCDB manager is involved at all.
void update(const o2::tpc::VDriftCorrFact& vd) noexcept
{
if (mVD == &vd) { // same object as last time, nothing to recompute
return;
}
if (vd.firstTime < 0 || vd.lastTime < 0) {
LOGP(error, "Got invalid VDriftCorrFact created at {}", vd.creationTime);
mValid = false;
return;
}
mVD = &vd;

// TODO account for laser calib

mTPCVDriftNS = mVD->refVDrift * mVD->corrFact * 1e-3;
mValid = true;
LOGP(debug, "Updated VDrift for timestamp {} with vdrift={:.7f} (cm/ns)", mVD->creationTime, mTPCVDriftNS);
}

template <typename BCs, typename Collisions, typename Collision, typename TrackExtra, typename Track>
[[nodiscard]] bool moveTPCTrack(const Collision& col, const TrackExtra& trackExtra, Track& track) noexcept
{
Expand Down Expand Up @@ -115,7 +136,7 @@
float dTime = tTB - trackExtra.trackTime();
float dDrift = dTime * mTPCVDriftNS;
float dDriftErr = tTBErr * mTPCVDriftNS;
if (dDriftErr < 0.f || dDrift > 250.f) { // we cannot move a track outside the drift volume

Check failure on line 139 in Common/Core/TPCVDriftManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if (mOutside < mWarningLimit) {
LOGP(warn, "Skipping correction outside of tpc volume with dDrift={} +- {}", dDrift, dDriftErr);
const auto trackBC = trackExtra.template collision_as<Collisions>().template foundBC_as<BCs>().globalBC();
Expand Down
39 changes: 36 additions & 3 deletions Common/DataModel/GloCCDBObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,21 @@
/// `DECLARE_SOA_TIMESTAMPED_TABLE` with the relevant subset of columns from
/// the `o2::aod::ccdbGlo` namespace rather than joining `aod::GloCCDBObjects`.
///
/// Note: MatLayerCylSet is intentionally omitted — it requires
/// `MatLayerCylSet::rectifyPtrFromFile()` after deserialisation, which the
/// CCDB column mechanism does not perform.
/// The material LUT lives in `aod::GeomCCDBObjects` rather than here: it belongs to
/// the geometry/material family, whose validity is essentially static, and keeping it
/// out means joining `aod::GloCCDBObjects` does not drag in a multi-hundred-MB object
/// nobody asked for. Join whichever tables you need — the duplicated `aod::Timestamps`
/// is deduplicated:
/// \code
/// using BCsWithLUT = soa::Join<aod::BCsWithTimestamps, aod::GeomCCDBObjects>;
/// // rectifyPtrFromFile() is applied by the column's finaliser, so the
/// // object handed back is ready to use; the task only has to (re)install it.
/// auto* lut = &bcs.begin().matLUT();
/// if (lut != mLastLUT) {
/// o2::base::Propagator::Instance()->setMatLUT(lut);
/// mLastLUT = lut;
/// }
/// \endcode

#ifndef COMMON_DATAMODEL_GLOCCDBOBJECTS_H_
#define COMMON_DATAMODEL_GLOCCDBOBJECTS_H_
Expand All @@ -44,6 +56,7 @@
#include <DataFormatsParameters/GRPECSObject.h>
#include <DataFormatsParameters/GRPLHCIFData.h>
#include <DataFormatsParameters/GRPMagField.h>
#include <DetectorsBase/MatLayerCylSet.h>
#include <Framework/ASoA.h>
#include <Framework/AnalysisDataModel.h>

Expand All @@ -51,15 +64,35 @@
{
namespace ccdbGlo
{
DECLARE_SOA_CCDB_COLUMN(GRPMagField, grpMagField, o2::parameters::GRPMagField, "GLO/Config/GRPMagField"); //!

Check failure on line 67 in Common/DataModel/GloCCDBObjects.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_CCDB_COLUMN(MeanVertex, meanVertex, o2::dataformats::MeanVertexObject, "GLO/Calib/MeanVertex"); //!
DECLARE_SOA_CCDB_COLUMN(GRPECSObject, grpECS, o2::parameters::GRPECSObject, "GLO/Config/GRPECS"); //!

Check failure on line 69 in Common/DataModel/GloCCDBObjects.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_CCDB_COLUMN(GRPLHCIFData, grpLHCIF, o2::parameters::GRPLHCIFData, "GLO/Config/GRPLHCIF"); //!

Check failure on line 70 in Common/DataModel/GloCCDBObjects.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.

/// The material LUT is a FlatObject: straight out of the ROOT streamer its internal
/// pointers are unfixed and its voxel lookup is unbuilt, so it is finalised with
/// MatLayerCylSet::rectifyPtrFromFile() before ever being handed to a task.
DECLARE_SOA_CCDB_COLUMN_FULL(MatLUT, "fMatLUT", matLUT, o2::base::MatLayerCylSet, "GLO/Param/MatLUT", //!

Check failure on line 75 in Common/DataModel/GloCCDBObjects.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
[](o2::base::MatLayerCylSet* lut) { return o2::base::MatLayerCylSet::rectifyPtrFromFile(lut); });
} // namespace ccdbGlo

/// Full table — join with aod::BCsWithTimestamps to obtain all four objects.
DECLARE_SOA_TIMESTAMPED_TABLE(GloCCDBObjects, aod::Timestamps, o2::aod::timestamp::Timestamp, 1, "GLOCCDBOBJ", //!
ccdbGlo::GRPMagField, ccdbGlo::MeanVertex, ccdbGlo::GRPECSObject, ccdbGlo::GRPLHCIFData);

/// Geometry and material description: objects which describe where the detector material
/// is, and which share an essentially static interval of validity. Kept apart from the GRP
/// family above, which changes per run (and, for GRPMagField, per timeframe).
/// The aligned/ideal geometry and the per-detector alignment objects belong here too when
/// they get columns; see GRPGeomRequest in O2 (GLO/Config/GeometryAligned, GLO/Config/Geometry,
/// <DET>/Calib/Align) for the family.
/// Join it alongside aod::GloCCDBObjects when a task needs both — the duplicated
/// aod::Timestamps is deduplicated when the joined table's originals are merged.
/// Uniform in the run number: the geometry/material description does not change within a
/// run, so the fetcher queries once per distinct run rather than once per BC.
DECLARE_SOA_UNIFORM_TABLE(GeomCCDBObjects, aod::Timestamps, o2::aod::timestamp::Timestamp,
aod::BCs, o2::aod::bc::RunNumber, 1, "GEOMCCDBOBJ", //!
ccdbGlo::MatLUT);
} // namespace o2::aod

#endif // COMMON_DATAMODEL_GLOCCDBOBJECTS_H_
43 changes: 43 additions & 0 deletions Common/DataModel/TpcCCDBObjects.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright 2019-2026 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 TpcCCDBObjects.h
/// \brief Declarative CCDB columns for TPC calibration objects.
///
/// Unlike the geometry/material family in GloCCDBObjects.h, the drift velocity
/// genuinely varies within a run, so the table keeps the default uniformity — one
/// object per distinct timestamp — rather than collapsing per run.
///
/// Usage:
/// \code
/// using BCsWithVDrift = soa::Join<aod::BCsWithTimestamps, aod::TpcCalibCCDBObjects>;
/// vdriftManager.update(bc.vdriftTgl());
/// \endcode

#ifndef COMMON_DATAMODEL_TPCCCDBOBJECTS_H_
#define COMMON_DATAMODEL_TPCCCDBOBJECTS_H_

#include <DataFormatsTPC/VDriftCorrFact.h>
#include <Framework/ASoA.h>
#include <Framework/AnalysisDataModel.h>

namespace o2::aod
{
namespace ccdbTpc
{
DECLARE_SOA_CCDB_COLUMN(VDriftTgl, vdriftTgl, o2::tpc::VDriftCorrFact, "TPC/Calib/VDriftTgl"); //!

Check failure on line 36 in Common/DataModel/TpcCCDBObjects.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
} // namespace ccdbTpc

DECLARE_SOA_TIMESTAMPED_TABLE(TpcCalibCCDBObjects, aod::Timestamps, o2::aod::timestamp::Timestamp, 1, "TPCCALIBCCDB", //!
ccdbTpc::VDriftTgl);
} // namespace o2::aod

#endif // COMMON_DATAMODEL_TPCCCDBOBJECTS_H_
59 changes: 59 additions & 0 deletions Common/DataModel/TrackTunerCCDBObjects.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright 2019-2026 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 TrackTunerCCDBObjects.h
/// \brief Declarative CCDB columns for the TrackTuner DCA / Q-over-pt calibrations.
///
/// The DCA calibration is published under a different path per data-taking period, so
/// the column declares a uniformity-value-to-path mapping rather than a single path:
/// the fetcher picks the entry whose run range contains the row's run number. This
/// replaces TrackTuner::getPathInputFileAutomaticFromCCDB(), whose run ranges these are.
/// A run matching no range is a fatal error, as it was before — there is deliberately no
/// fallback entry, since silently using another period's calibration is worse than stopping.
///
/// The ranges are the column's *default*; the whole mapping can be replaced at runtime
/// through the "ccdb:fTrackTunerDca" option, so adding a period need not be a code change.

#ifndef COMMON_DATAMODEL_TRACKTUNERCCDBOBJECTS_H_
#define COMMON_DATAMODEL_TRACKTUNERCCDBOBJECTS_H_

#include <Framework/ASoA.h>
#include <Framework/AnalysisDataModel.h>

#include <TList.h>

namespace o2::aod
{
namespace ccdbTrackTuner
{
DECLARE_SOA_CCDB_COLUMN(TrackTunerDca, trackTunerDca, TList, //!
"520259-529691=Users/m/mfaggin/test/inputsTrackTuner/pp2023/pass4/vsPhi;"
"534998-543113=Users/m/mfaggin/test/inputsTrackTuner/pp2023/pass4/vsPhi;"
"529397-529418=Users/m/mfaggin/test/inputsTrackTuner/PbPb2023/apass4/vsPhi;"
"543437-545367=Users/m/mfaggin/test/inputsTrackTuner/PbPb2023/apass4/vsPhi;"
"549559-558807=Users/m/mfaggin/test/inputsTrackTuner/pp2024/pass1_minBias/vsPhi;"
"564356-564445=Users/m/mfaggin/test/inputsTrackTuner/OO/LHC25ae;"
"564468-564472=Users/m/mfaggin/test/inputsTrackTuner/OO/LHC25af;"
"559348-559387=Users/m/mfaggin/test/inputsTrackTuner/pp2024/ppRef/polarity_positive;"
"559408-559456=Users/m/mfaggin/test/inputsTrackTuner/pp2024/ppRef/polarity_negative");

DECLARE_SOA_CCDB_COLUMN(TrackTunerQOverPt, trackTunerQOverPt, TList, //!
"Users/h/hsharma/qOverPtGraphs");
} // namespace ccdbTrackTuner

/// Uniform in the run number: one calibration per data-taking period, so the fetcher
/// resolves the path and queries once per distinct run rather than once per BC.
DECLARE_SOA_UNIFORM_TABLE(TrackTunerCCDBObjects, aod::Timestamps, o2::aod::timestamp::Timestamp,
aod::BCs, o2::aod::bc::RunNumber, 1, "TRKTUNERCCDB", //!
ccdbTrackTuner::TrackTunerDca, ccdbTrackTuner::TrackTunerQOverPt);
} // namespace o2::aod

#endif // COMMON_DATAMODEL_TRACKTUNERCCDBOBJECTS_H_
Loading
Loading