Skip to content

Commit 7d1393d

Browse files
committed
[PWGEM,Photon] move remaining CCDB fetches to CCDB columns
Replace per-task BasicCCDBManager queries with declarative CCDB columns, and drop CCDB-manager leftovers from tasks that already read columns. Migrations: - calibTaskEmc: BadChannelMap from aod::EmEmcalObjects - pairQcTask, dalitzEEQC, dalitzEEQCMC: GRPMagField from aod::EmMagFields; drop the GRPObject path, skipGRPOquery, grpPath, grpmagPath, ccdb-url - CheckMCV0: GRPMagField + MatLUT from aod::PcmObjects and the shared aod::GeomCCDBObjects; the LUT pointer is set for every collision, the magnetic field is still installed once per run - photonhbt: GRPMagField from aod::EmMagFields, TPC VDrift from a new aod::EmTpcObjects table (EventTables.h, reusing ccdbTpc::VDriftTgl) Cleanup (no behaviour change): remove the unused CCDB manager, its setup and the now-unused ccdb-url/skipGRPOquery/grpmagPath options from Pi0EtaToGammaGamma(MC).h, TaggingPi0(MC).h, pcmQC, photonResoTask, prefilterPhoton and skimmerPrimaryElectronFromDalitzEE (the skimmer keeps the manager for the TOF response). ccdb-url is kept where it feeds the V0 ML models. Behaviour changes in photonhbt: - VDrift is now taken at each event's timestamp instead of mid-run (getForRun), so it follows changes within a run - a missing VDrift object is now fatal instead of a warning Not migrated: SP resolution (taskPhotonFlow, taskPi0FlowEMC) and nonLinProducer (optional objects from user paths set per wagon), photonconversionbuilder (LUT/geometry loaded once in init), Legacy/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Also add asymmetric-energy-cut to `taskPi0FlowEMC .cxx` for EMCal EMCal cluster pairings.
1 parent 3103678 commit 7d1393d

16 files changed

Lines changed: 59 additions & 203 deletions

‎PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include "Common/DataModel/Centrality.h"
3737
#include "Common/DataModel/EventSelection.h"
3838

39-
#include <CCDB/BasicCCDBManager.h>
4039
#include <CCDB/CcdbApi.h>
4140
#include <CommonConstants/MathConstants.h>
4241
#include <CommonConstants/PhysicsConstants.h>
@@ -296,7 +295,6 @@ struct Pi0EtaToGammaGamma {
296295
std::vector<float> occ_bin_edges;
297296

298297
o2::ccdb::CcdbApi ccdbApi;
299-
o2::framework::Service<o2::ccdb::BasicCCDBManager> ccdb{};
300298
int mRunNumber = -1;
301299
float d_bz = 0;
302300
o2::emcal::Geometry* emcalGeom = nullptr;
@@ -445,11 +443,6 @@ struct Pi0EtaToGammaGamma {
445443

446444
mRunNumber = 0;
447445
d_bz = 0;
448-
449-
ccdb->setURL(ccdburl);
450-
ccdb->setCaching(true);
451-
ccdb->setLocalObjectValidityChecking();
452-
ccdb->setFatalWhenNull(false);
453446
}
454447

455448
template <o2::soa::is_iterator TCollision>

‎PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include "Common/DataModel/Centrality.h"
3737
#include "Common/DataModel/EventSelection.h"
3838

39-
#include <CCDB/BasicCCDBManager.h>
4039
#include <CCDB/CcdbApi.h>
4140
#include <CommonConstants/PhysicsConstants.h>
4241
#include <DataFormatsParameters/GRPMagField.h>
@@ -268,7 +267,6 @@ struct Pi0EtaToGammaGammaMC {
268267
static constexpr std::array<std::string_view, 2> kParnames = {"Pi0/", "Eta/"};
269268

270269
o2::ccdb::CcdbApi ccdbApi;
271-
o2::framework::Service<o2::ccdb::BasicCCDBManager> ccdb{};
272270
int mRunNumber = 0;
273271
float d_bz = 0;
274272

@@ -300,11 +298,6 @@ struct Pi0EtaToGammaGammaMC {
300298

301299
mRunNumber = 0;
302300
d_bz = 0;
303-
304-
ccdb->setURL(ccdburl);
305-
ccdb->setCaching(true);
306-
ccdb->setLocalObjectValidityChecking();
307-
ccdb->setFatalWhenNull(false);
308301
}
309302

310303
template <o2::soa::is_iterator TCollision>

‎PWGEM/PhotonMeson/Core/TaggingPi0.h‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include "Common/DataModel/EventSelection.h"
3333
#include "Common/DataModel/PIDResponseTPC.h"
3434

35-
#include <CCDB/BasicCCDBManager.h>
3635
#include <CCDB/CcdbApi.h>
3736
#include <CommonConstants/MathConstants.h>
3837
#include <CommonConstants/PhysicsConstants.h>
@@ -87,7 +86,6 @@ using MyEMCCluster = MyEMCClusters::iterator;
8786

8887
template <o2::aod::pwgem::photonmeson::photonpair::PairType pairtype, typename... Types>
8988
struct TaggingPi0 {
90-
o2::framework::Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
9189
o2::framework::Configurable<float> d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"};
9290
o2::framework::Configurable<uint64_t> ndiff_bc_mix{"ndiff_bc_mix", 594, "difference in global BC required in mixed events"};
9391

@@ -222,7 +220,6 @@ struct TaggingPi0 {
222220
std::vector<float> occ_bin_edges;
223221

224222
o2::ccdb::CcdbApi ccdbApi;
225-
o2::framework::Service<o2::ccdb::BasicCCDBManager> ccdb{};
226223
int mRunNumber = 0;
227224
float d_bz = 0;
228225

@@ -255,11 +252,6 @@ struct TaggingPi0 {
255252

256253
mRunNumber = 0;
257254
d_bz = 0;
258-
259-
ccdb->setURL(ccdburl);
260-
ccdb->setCaching(true);
261-
ccdb->setLocalObjectValidityChecking();
262-
ccdb->setFatalWhenNull(false);
263255
}
264256

265257
template <o2::soa::is_iterator TCollision>

‎PWGEM/PhotonMeson/Core/TaggingPi0MC.h‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include "Common/DataModel/EventSelection.h"
3434
#include "Common/DataModel/PIDResponseTPC.h"
3535

36-
#include <CCDB/BasicCCDBManager.h>
3736
#include <CCDB/CcdbApi.h>
3837
#include <CommonConstants/MathConstants.h>
3938
#include <CommonConstants/PhysicsConstants.h>
@@ -91,7 +90,6 @@ using MyMCElectron = MyMCElectrons::iterator;
9190

9291
template <o2::aod::pwgem::photonmeson::photonpair::PairType pairtype, typename... Types>
9392
struct TaggingPi0MC {
94-
o2::framework::Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
9593
o2::framework::Configurable<float> d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"};
9694

9795
o2::framework::Configurable<int> cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2"};
@@ -214,7 +212,6 @@ struct TaggingPi0MC {
214212
static constexpr std::array<std::string_view, 2> parnames = {"Pi0/", "Eta/"};
215213

216214
o2::ccdb::CcdbApi ccdbApi;
217-
o2::framework::Service<o2::ccdb::BasicCCDBManager> ccdb{};
218215
int mRunNumber = 0;
219216
float d_bz = 0;
220217
TF1* f1fd_k0s_to_pi0 = nullptr;
@@ -232,11 +229,6 @@ struct TaggingPi0MC {
232229
mRunNumber = 0;
233230
d_bz = 0;
234231
f1fd_k0s_to_pi0 = new TF1("f1fd_k0s_to_pi0", TString(fd_k0s_to_pi0), 0.f, 100.f);
235-
236-
ccdb->setURL(ccdburl);
237-
ccdb->setCaching(true);
238-
ccdb->setLocalObjectValidityChecking();
239-
ccdb->setFatalWhenNull(false);
240232
}
241233

242234
template <o2::soa::is_iterator TCollision>

‎PWGEM/PhotonMeson/DataModel/EventTables.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "Common/CCDB/EventSelectionParams.h"
2020
#include "Common/DataModel/EventSelection.h"
21+
#include "Common/DataModel/TpcCCDBObjects.h"
2122

2223
#include <DataFormatsParameters/GRPMagField.h>
2324
#include <EMCALCalib/BadChannelMap.h>
@@ -118,6 +119,11 @@ DECLARE_SOA_CCDB_COLUMN(BadChannelMap, badChannelMap, o2::emcal::BadChannelMap,
118119
DECLARE_SOA_TIMESTAMPED_TABLE(EmEmcalObjects, aod::PMEvents, o2::aod::timestamp::Timestamp, 0, "EMEMCALOBJECTS", //!
119120
em::ccdbEmcal::BadChannelMap);
120121

122+
/// TPC drift velocity for EmEvents. Reuses the shared column (same label and path).
123+
/// Timestamp-uniform since the drift velocity changes within a run.
124+
DECLARE_SOA_TIMESTAMPED_TABLE(EmTpcObjects, aod::PMEvents, o2::aod::timestamp::Timestamp, 0, "EMTPCOBJECTS", //!
125+
ccdbTpc::VDriftTgl);
126+
121127
} // namespace o2::aod
122128

123129
#endif // PWGEM_PHOTONMESON_DATAMODEL_EVENTTABLES_H_

‎PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ struct skimmerPrimaryElectronFromDalitzEE {
129129
// Configurables
130130
Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
131131
Configurable<std::string> grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"};
132-
Configurable<std::string> grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
133132
Configurable<bool> skipGRPOquery{"skipGRPOquery", true, "skip grpo query"};
134133

135134
// Operation and minimisation criteria

‎PWGEM/PhotonMeson/Tasks/CheckMCV0.cxx‎

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414
/// \author daiki.sekihata@cern.ch felix.schlepper@cern.ch
1515
/// \dependencies: o2-analysis-lf-lambdakzeromcfinder
1616

17+
#include "PWGEM/PhotonMeson/DataModel/EventTables.h"
1718
#include "PWGEM/PhotonMeson/DataModel/mcV0Tables.h"
1819
#include "PWGEM/PhotonMeson/Utils/TrackSelection.h"
1920
//
2021
#include "PWGLF/DataModel/LFStrangenessTables.h"
2122

23+
#include "Common/DataModel/GloCCDBObjects.h"
2224
#include "Common/DataModel/TrackSelectionTables.h"
2325

24-
#include <CCDB/BasicCCDBManager.h>
2526
#include <CommonConstants/LHCConstants.h>
2627
#include <DataFormatsParameters/GRPMagField.h>
2728
#include <DetectorsBase/MatLayerCylSet.h>
@@ -51,7 +52,6 @@
5152
#include <cstddef>
5253
#include <cstdint>
5354
#include <iterator>
54-
#include <string>
5555
#include <string_view>
5656

5757
using namespace o2;
@@ -91,6 +91,7 @@ struct CheckMCV0 {
9191
using FilteredTracksMC = soa::Filtered<TracksMC>;
9292
using CollisionsMC = soa::Join<aod::McCollisionLabels, aod::Collisions>;
9393
using V0s = aod::V0Datas;
94+
using BCsWithCCDB = soa::Join<aod::BCsWithTimestamps, aod::PcmObjects, aod::GeomCCDBObjects>;
9495

9596
// Histogram Parameters
9697
Configurable<int> tglNBins{"tglNBins", 500, "nBins for tgl"};
@@ -164,16 +165,8 @@ struct CheckMCV0 {
164165
};
165166
static_assert(checkV0legLabels.size() == checkV0legEnum::MINCROSSEDROWSTPC);
166167

167-
// CCDB
168-
Configurable<std::string> mCCDBPath{"ccdb-path", "GLO/GRP/GRP", "path to the ccdb object"};
169-
Configurable<std::string> mGRPMagPath{"grpmagPath", "GLO/Config/GRPMagField", "path to the GRPMagField object"};
170-
Configurable<std::string> mLUTPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"};
171-
Configurable<std::string> mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"};
172-
Configurable<std::string> mCCDBUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
173-
Service<o2::ccdb::BasicCCDBManager> mCCDB{};
168+
// Only needed to avoid re-installing the magnetic field, which is global state
174169
int mRunNumber{-1};
175-
o2::base::MatLayerCylSet* mLUT{nullptr};
176-
o2::parameters::GRPMagField* mGRPMagField{nullptr};
177170

178171
// params
179172
std::array<float, 6> mcPosXYZEtaTglPtProp{};
@@ -186,12 +179,6 @@ struct CheckMCV0 {
186179

187180
void init(InitContext const& /*unused*/)
188181
{
189-
// setup CCDB
190-
mCCDB->setURL(mCCDBUrl);
191-
mCCDB->setCaching(true);
192-
mCCDB->setLocalObjectValidityChecking();
193-
mLUT = o2::base::MatLayerCylSet::rectifyPtrFromFile(mCCDB->get<o2::base::MatLayerCylSet>(mLUTPath));
194-
195182
// maybe logarithmic
196183
if (ptLogAxis) {
197184
axisPt.makeLogarithmic();
@@ -247,11 +234,11 @@ struct CheckMCV0 {
247234
}
248235

249236
Preslice<aod::V0Datas> perCollision = aod::v0data::collisionId;
250-
void processMCV0(CollisionsMC const& collisions, V0s const& v0s, FilteredTracksMC const& /*unused*/, aod::McParticles const& /*unused*/, aod::McCollisions const& /*unused*/, aod::BCsWithTimestamps const& /*unused*/)
237+
void processMCV0(CollisionsMC const& collisions, V0s const& v0s, FilteredTracksMC const& /*unused*/, aod::McParticles const& /*unused*/, aod::McCollisions const& /*unused*/, BCsWithCCDB const& /*unused*/)
251238
{
252239
// Check for new ccdb parameters
253240
for (auto& collision : collisions) {
254-
const auto bc = collision.template bc_as<aod::BCsWithTimestamps>();
241+
const auto bc = collision.template bc_as<BCsWithCCDB>();
255242
initCCDB(bc);
256243

257244
// Get the V0 candidates belonging to the current collision
@@ -505,12 +492,12 @@ struct CheckMCV0 {
505492
template <typename BC>
506493
inline void initCCDB(BC const& bc)
507494
{
495+
// pointer store only; refreshed every time since the column buffer may be relocated
496+
o2::base::Propagator::Instance()->setMatLUT(&bc.matLUT());
508497
if (mRunNumber == bc.runNumber()) {
509498
return;
510499
}
511-
mGRPMagField = mCCDB->getForTimeStamp<o2::parameters::GRPMagField>(mGRPMagPath, bc.timestamp());
512-
o2::base::Propagator::initFieldFromGRP(mGRPMagField);
513-
o2::base::Propagator::Instance()->setMatLUT(mLUT);
500+
o2::base::Propagator::initFieldFromGRP(&bc.grpMagField());
514501
mRunNumber = bc.runNumber();
515502
}
516503
};

‎PWGEM/PhotonMeson/Tasks/calibTaskEmc.cxx‎

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include "Common/DataModel/Centrality.h"
2828
#include "Common/DataModel/EventSelection.h"
2929

30-
#include <CCDB/BasicCCDBManager.h>
3130
#include <CommonConstants/MathConstants.h>
3231
#include <EMCALBase/Geometry.h>
3332
#include <EMCALBase/GeometryBase.h>
@@ -112,7 +111,6 @@ enum class MapLevel {
112111
struct CalibTaskEmc {
113112
// configurable for flow
114113
Configurable<int> centEstimator{"centEstimator", 2, "Centrality estimation (FT0A: 1, FT0C: 2, FT0M: 3)"};
115-
Configurable<std::string> ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
116114
Configurable<int> cfgEMCalMapLevelBackground{"cfgEMCalMapLevelBackground", 4, "Different levels of correction for the background, the smaller number includes the level of the higher number (4: none, 3: only inside EMCal, 2: exclude bad channels, 1: remove edges)"};
117115
Configurable<int> cfgEMCalMapLevelSameEvent{"cfgEMCalMapLevelSameEvent", 4, "Different levels of correction for the same event, the smaller number includes the level of the higher number (4: none, 3: only inside EMCal, 2: exclude bad channels, 1: remove edges)"};
118116
Configurable<int> cfgDistanceToEdge{"cfgDistanceToEdge", 1, "Distance to edge in cells required for rotated cluster to be accepted"};
@@ -229,16 +227,15 @@ struct CalibTaskEmc {
229227
} correctionConfig;
230228

231229
SliceCache cache;
232-
o2::framework::Service<o2::ccdb::BasicCCDBManager> ccdb{};
233230
int runNow = 0;
234231
int runBefore = -1;
235232

236233
Filter collisionFilter = (nabs(aod::collision::posZ) <= eventcuts.cfgZvtxMax) && (aod::evsel::ft0cOccupancyInTimeRange <= eventcuts.cfgFT0COccupancyMax) && (aod::evsel::ft0cOccupancyInTimeRange >= eventcuts.cfgFT0COccupancyMin);
237234
using EMCalPhotons = soa::Join<aod::EMCEMEventIds, aod::MinClusters, aod::NonLinEmcClusters>;
238235
using PCMPhotons = soa::Join<aod::V0PhotonsKF, aod::V0KFEMEventIds, aod::NonLinV0s>;
239-
using FilteredCollsWithQvecs = soa::Filtered<soa::Join<aod::PMEvents, aod::EMEventsAlias, aod::EMEventsMult_000, aod::EMEventsCent_000>>;
240-
using CollsWithQvecs = soa::Join<aod::PMEvents, aod::EMEventsAlias, aod::EMEventsMult_000, aod::EMEventsCent_000>;
241-
using Colls = soa::Join<aod::PMEvents, aod::EMEventsAlias, aod::EMEventsMult_000, aod::EMEventsCent_000>;
236+
using FilteredCollsWithQvecs = soa::Filtered<soa::Join<aod::PMEvents, aod::EMEventsAlias, aod::EMEventsMult_000, aod::EMEventsCent_000, aod::EmEmcalObjects>>;
237+
using CollsWithQvecs = soa::Join<aod::PMEvents, aod::EMEventsAlias, aod::EMEventsMult_000, aod::EMEventsCent_000, aod::EmEmcalObjects>;
238+
using Colls = soa::Join<aod::PMEvents, aod::EMEventsAlias, aod::EMEventsMult_000, aod::EMEventsCent_000, aod::EmEmcalObjects>;
242239

243240
PresliceOptional<EMCalPhotons> perCollisionEMC = o2::aod::emccluster::pmeventId;
244241
PresliceOptional<PCMPhotons> perCollisionPCM = aod::v0photonkf::pmeventId;
@@ -248,7 +245,6 @@ struct CalibTaskEmc {
248245
HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, false, false};
249246

250247
o2::emcal::Geometry* emcalGeom{};
251-
o2::emcal::BadChannelMap* mBadChannels{};
252248
// Constants for eta and phi ranges for the look up table
253249
static constexpr double EtaMin = -0.75, etaMax = 0.75;
254250
static constexpr int NBinsEta = 150; // 150 bins for eta
@@ -425,11 +421,6 @@ struct CalibTaskEmc {
425421
registry.add("mesonQA/hAlphaPtMixed", "Histo of meson asymmetry vs pT for mixed event", HistType::kTH2D, {thAxisAlpha, thnAxisPtCalib});
426422
}
427423

428-
ccdb->setURL(ccdbUrl);
429-
ccdb->setCaching(true);
430-
ccdb->setLocalObjectValidityChecking();
431-
ccdb->setFatalWhenNull(false);
432-
433424
}; // end init
434425

435426
/// Change radians to degree
@@ -519,23 +510,18 @@ struct CalibTaskEmc {
519510
return false;
520511
}
521512

522-
bool isCellMasked(int cellID)
513+
template <o2::soa::is_iterator TCollision>
514+
bool isCellMasked(int cellID, TCollision const& collision)
523515
{
524-
bool masked = false;
525-
if (mBadChannels) {
526-
auto maskStatus = mBadChannels->getChannelStatus(cellID);
527-
masked = (maskStatus != o2::emcal::BadChannelMap::MaskType_t::GOOD_CELL);
528-
}
529-
return masked;
516+
auto maskStatus = collision.badChannelMap().getChannelStatus(cellID);
517+
return maskStatus != o2::emcal::BadChannelMap::MaskType_t::GOOD_CELL;
530518
}
531519

532520
template <o2::soa::is_iterator TCollision>
533521
void initCCDB(TCollision const& collision)
534522
{
535523
// Load EMCal geometry
536524
emcalGeom = o2::emcal::Geometry::GetInstanceFromRunNumber(collision.runNumber());
537-
// Load Bad Channel map
538-
mBadChannels = ccdb->getForTimeStamp<o2::emcal::BadChannelMap>("EMC/Calib/BadChannelMap", collision.timestamp());
539525
lookupTable1D.fill(-1);
540526
double binWidthEta = (etaMax - EtaMin) / NBinsEta;
541527
double binWidthPhi = (phiMax - PhiMin) / NBinsPhi;
@@ -555,7 +541,7 @@ struct CalibTaskEmc {
555541
// Check conditions for the cell
556542
if (isTooCloseToEdge(cellID, 1)) {
557543
lookupTable1D[getIndex(iEta, iPhi)] = 2; // Edge
558-
} else if (isCellMasked(cellID)) {
544+
} else if (isCellMasked(cellID, collision)) {
559545
lookupTable1D[getIndex(iEta, iPhi)] = 1; // Bad
560546
} else {
561547
lookupTable1D[getIndex(iEta, iPhi)] = 0; // Good

0 commit comments

Comments
 (0)