Skip to content

Commit e646a8b

Browse files
committed
Improve propagationServiceV2
* Make sure all the CCDB related objects get retrieved via the new table mechanism. * No need anymore for a centralised CCDBLoader object * Get rid of all BasicCCDBManager instances
1 parent 3c18d6a commit e646a8b

4 files changed

Lines changed: 218 additions & 56 deletions

File tree

‎Common/DataModel/GloCCDBObjects.h‎

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,19 @@
3333
/// `DECLARE_SOA_TIMESTAMPED_TABLE` with the relevant subset of columns from
3434
/// the `o2::aod::ccdbGlo` namespace rather than joining `aod::GloCCDBObjects`.
3535
///
36-
/// Note: MatLayerCylSet is intentionally omitted — it requires
37-
/// `MatLayerCylSet::rectifyPtrFromFile()` after deserialisation, which the
38-
/// CCDB column mechanism does not perform.
36+
/// The material LUT lives in `aod::GeomCCDBObjects` rather than here: it belongs to
37+
/// the geometry/material family, whose validity is essentially static, and keeping it
38+
/// out means joining `aod::GloCCDBObjects` does not drag in a multi-hundred-MB object
39+
/// nobody asked for. Join whichever tables you need — the duplicated `aod::Timestamps`
40+
/// is deduplicated:
41+
/// \code
42+
/// using BCsWithLUT = soa::Join<aod::BCsWithTimestamps, aod::GeomCCDBObjects>;
43+
/// // rectifyPtrFromFile() is applied by the column's finaliser, so the object
44+
/// // handed back is ready to use. Installing it is a pointer store, so it costs
45+
/// // nothing to redo every timeframe — and doing so picks up a relocated column
46+
/// // buffer for free instead of dangling.
47+
/// o2::base::Propagator::Instance()->setMatLUT(&bcs.begin().matLUT());
48+
/// \endcode
3949

4050
#ifndef COMMON_DATAMODEL_GLOCCDBOBJECTS_H_
4151
#define COMMON_DATAMODEL_GLOCCDBOBJECTS_H_
@@ -44,8 +54,14 @@
4454
#include <DataFormatsParameters/GRPECSObject.h>
4555
#include <DataFormatsParameters/GRPLHCIFData.h>
4656
#include <DataFormatsParameters/GRPMagField.h>
57+
#include <DetectorsBase/MatLayerCylSet.h>
4758
#include <Framework/ASoA.h>
4859
#include <Framework/AnalysisDataModel.h>
60+
#include <Framework/Logger.h>
61+
62+
#include <cstdint>
63+
#include <string>
64+
#include <string_view>
4965

5066
namespace o2::aod
5167
{
@@ -55,11 +71,62 @@ DECLARE_SOA_CCDB_COLUMN(GRPMagField, grpMagField, o2::parameters::GRPMagField, "
5571
DECLARE_SOA_CCDB_COLUMN(MeanVertex, meanVertex, o2::dataformats::MeanVertexObject, "GLO/Calib/MeanVertex"); //!
5672
DECLARE_SOA_CCDB_COLUMN(GRPECSObject, grpECS, o2::parameters::GRPECSObject, "GLO/Config/GRPECS"); //!
5773
DECLARE_SOA_CCDB_COLUMN(GRPLHCIFData, grpLHCIF, o2::parameters::GRPLHCIFData, "GLO/Config/GRPLHCIF"); //!
74+
75+
/// The material LUT is a FlatObject: straight out of the ROOT streamer its internal
76+
/// pointers are unfixed and its voxel lookup is unbuilt, so it is finalised with
77+
/// MatLayerCylSet::rectifyPtrFromFile() before ever being handed to a task.
78+
DECLARE_SOA_CCDB_COLUMN_FULL(MatLUT, "fMatLUT", matLUT, o2::base::MatLayerCylSet, "GLO/Param/MatLUT", 0, //!
79+
[](o2::base::MatLayerCylSet* lut) { return o2::base::MatLayerCylSet::rectifyPtrFromFile(lut); });
80+
81+
/// Returns the GRPLHCIF object for this BC: straight from the aod::GrpLHCIFCCDBObjects
82+
/// column when the BC table carries it, else through a CCDB query at \p timestamp. Lets a
83+
/// shared module serve migrated and un-migrated tasks from a single code path — the
84+
/// discarded branch is not instantiated, so an un-migrated caller keeps its CCDB query and
85+
/// a migrated one never names the CCDB manager.
86+
template <typename TBC, typename TCCDB>
87+
inline o2::parameters::GRPLHCIFData* grpLHCIFFor(TBC const& bc, TCCDB& ccdb, std::string const& path, int64_t timestamp)
88+
{
89+
if constexpr (requires { bc.grpLHCIF(); }) {
90+
// The column is the single source of truth for the path; a caller that also configured
91+
// one is telling us two different things, and silently honouring one is how conditions
92+
// diverge unnoticed.
93+
if (path != std::string_view{GRPLHCIFData::query}) {
94+
LOGP(fatal, R"(A GRPLHCIF path "{}" is configured while the object is taken from the aod::GrpLHCIFCCDBObjects column, whose path is "{}". Set it through the "ccdb:{}" option instead.)",
95+
path, GRPLHCIFData::query, GRPLHCIFData::mLabel);
96+
}
97+
return &bc.grpLHCIF();
98+
} else {
99+
return ccdb->template getForTimeStamp<o2::parameters::GRPLHCIFData>(path, timestamp);
100+
}
101+
}
58102
} // namespace ccdbGlo
59103

60104
/// Full table — join with aod::BCsWithTimestamps to obtain all four objects.
61105
DECLARE_SOA_TIMESTAMPED_TABLE(GloCCDBObjects, aod::Timestamps, o2::aod::timestamp::Timestamp, 1, "GLOCCDBOBJ", //!
62106
ccdbGlo::GRPMagField, ccdbGlo::MeanVertex, ccdbGlo::GRPECSObject, ccdbGlo::GRPLHCIFData);
107+
108+
/// The LHC filling scheme and beam configuration on its own. Run-uniform: GRPLHCIF is set
109+
/// per fill and a run lies within a fill, so the fetcher resolves it once per run rather
110+
/// than once per BC. Kept apart from aod::GloCCDBObjects so that a task needing only this
111+
/// does not also fetch GRPMagField, MeanVertex and GRPECS — GRPLHCIF is the most widely
112+
/// used of the four (44 files reference the path) and is usually wanted alone.
113+
DECLARE_SOA_UNIFORM_TABLE(GrpLHCIFCCDBObjects, aod::Timestamps, o2::aod::timestamp::Timestamp,
114+
aod::BCs, o2::aod::bc::RunNumber, 1, "GRPLHCIFCCDB", //!
115+
ccdbGlo::GRPLHCIFData);
116+
117+
/// Geometry and material description: objects which describe where the detector material
118+
/// is, and which share an essentially static interval of validity. Kept apart from the GRP
119+
/// family above, which changes per run (and, for GRPMagField, per timeframe).
120+
/// The aligned/ideal geometry and the per-detector alignment objects belong here too when
121+
/// they get columns; see GRPGeomRequest in O2 (GLO/Config/GeometryAligned, GLO/Config/Geometry,
122+
/// <DET>/Calib/Align) for the family.
123+
/// Join it alongside aod::GloCCDBObjects when a task needs both — the duplicated
124+
/// aod::Timestamps is deduplicated when the joined table's originals are merged.
125+
/// Uniform in the run number: the geometry/material description does not change within a
126+
/// run, so the fetcher queries once per distinct run rather than once per BC.
127+
DECLARE_SOA_UNIFORM_TABLE(GeomCCDBObjects, aod::Timestamps, o2::aod::timestamp::Timestamp,
128+
aod::BCs, o2::aod::bc::RunNumber, 1, "GEOMCCDBOBJ", //!
129+
ccdbGlo::MatLUT);
63130
} // namespace o2::aod
64131

65132
#endif // COMMON_DATAMODEL_GLOCCDBOBJECTS_H_

‎Common/DataModel/TpcCCDBObjects.h‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file TpcCCDBObjects.h
13+
/// \brief Declarative CCDB columns for TPC calibration objects.
14+
///
15+
/// Unlike the geometry/material family in GloCCDBObjects.h, the drift velocity
16+
/// genuinely varies within a run, so the table keeps the default uniformity — one
17+
/// object per distinct timestamp — rather than collapsing per run.
18+
///
19+
/// Usage:
20+
/// \code
21+
/// using BCsWithVDrift = soa::Join<aod::BCsWithTimestamps, aod::TpcCalibCCDBObjects>;
22+
/// vdriftManager.update(bc.vdriftTgl());
23+
/// \endcode
24+
25+
#ifndef COMMON_DATAMODEL_TPCCCDBOBJECTS_H_
26+
#define COMMON_DATAMODEL_TPCCCDBOBJECTS_H_
27+
28+
#include <DataFormatsTPC/VDriftCorrFact.h>
29+
#include <Framework/ASoA.h>
30+
#include <Framework/AnalysisDataModel.h>
31+
32+
namespace o2::aod
33+
{
34+
namespace ccdbTpc
35+
{
36+
DECLARE_SOA_CCDB_COLUMN(VDriftTgl, vdriftTgl, o2::tpc::VDriftCorrFact, "TPC/Calib/VDriftTgl"); //!
37+
} // namespace ccdbTpc
38+
39+
DECLARE_SOA_TIMESTAMPED_TABLE(TpcCalibCCDBObjects, aod::Timestamps, o2::aod::timestamp::Timestamp, 1, "TPCCALIBCCDB", //!
40+
ccdbTpc::VDriftTgl);
41+
} // namespace o2::aod
42+
43+
#endif // COMMON_DATAMODEL_TPCCCDBOBJECTS_H_
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file TrackTunerCCDBObjects.h
13+
/// \brief Declarative CCDB columns for the TrackTuner DCA / Q-over-pt calibrations.
14+
///
15+
/// The DCA calibration is published under a different path per data-taking period, so
16+
/// the column declares a uniformity-value-to-path mapping rather than a single path:
17+
/// the fetcher picks the entry whose run range contains the row's run number. This
18+
/// replaces TrackTuner::getPathInputFileAutomaticFromCCDB(), whose run ranges these are.
19+
/// A run matching no range is a fatal error, as it was before — there is deliberately no
20+
/// fallback entry, since silently using another period's calibration is worse than stopping.
21+
///
22+
/// The ranges are the column's *default*; the whole mapping can be replaced at runtime
23+
/// through the "ccdb:fTrackTunerDca" option, so adding a period need not be a code change.
24+
25+
#ifndef COMMON_DATAMODEL_TRACKTUNERCCDBOBJECTS_H_
26+
#define COMMON_DATAMODEL_TRACKTUNERCCDBOBJECTS_H_
27+
28+
#include <Framework/ASoA.h>
29+
#include <Framework/AnalysisDataModel.h>
30+
31+
#include <TList.h>
32+
33+
namespace o2::aod
34+
{
35+
namespace ccdbTrackTuner
36+
{
37+
DECLARE_SOA_CCDB_COLUMN(TrackTunerDca, trackTunerDca, TList, //!
38+
"520259-529691=Users/m/mfaggin/test/inputsTrackTuner/pp2023/pass4/vsPhi;"
39+
"534998-543113=Users/m/mfaggin/test/inputsTrackTuner/pp2023/pass4/vsPhi;"
40+
"529397-529418=Users/m/mfaggin/test/inputsTrackTuner/PbPb2023/apass4/vsPhi;"
41+
"543437-545367=Users/m/mfaggin/test/inputsTrackTuner/PbPb2023/apass4/vsPhi;"
42+
"549559-558807=Users/m/mfaggin/test/inputsTrackTuner/pp2024/pass1_minBias/vsPhi;"
43+
"564356-564445=Users/m/mfaggin/test/inputsTrackTuner/OO/LHC25ae;"
44+
"564468-564472=Users/m/mfaggin/test/inputsTrackTuner/OO/LHC25af;"
45+
"559348-559387=Users/m/mfaggin/test/inputsTrackTuner/pp2024/ppRef/polarity_positive;"
46+
"559408-559456=Users/m/mfaggin/test/inputsTrackTuner/pp2024/ppRef/polarity_negative");
47+
48+
DECLARE_SOA_CCDB_COLUMN(TrackTunerQOverPt, trackTunerQOverPt, TList, //!
49+
"Users/h/hsharma/qOverPtGraphs");
50+
} // namespace ccdbTrackTuner
51+
52+
/// Uniform in the run number: one calibration per data-taking period, so the fetcher
53+
/// resolves the path and queries once per distinct run rather than once per BC.
54+
DECLARE_SOA_UNIFORM_TABLE(TrackTunerCCDBObjects, aod::Timestamps, o2::aod::timestamp::Timestamp,
55+
aod::BCs, o2::aod::bc::RunNumber, 1, "TRKTUNERCCDB", //!
56+
ccdbTrackTuner::TrackTunerDca, ccdbTrackTuner::TrackTunerQOverPt);
57+
} // namespace o2::aod
58+
59+
#endif // COMMON_DATAMODEL_TRACKTUNERCCDBOBJECTS_H_

0 commit comments

Comments
 (0)