Skip to content

Commit b6b3c35

Browse files
committed
feat(kinkBuilder): use aod::BCs instead of aod::BCsWithTimestamps
The changes in this commit update the usage of the aod::BCsWithTimestamps data source to the more generic aod::BCs data source. This simplifies the code and removes the need for the specific BCsWithTimestamps data source, which is no longer required. The changes ensure that the kinkBuilder functionality continues to work with the updated data source.
1 parent 382d872 commit b6b3c35

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

PWGLF/TableProducer/Common/kinkBuilder.cxx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ struct kinkBuilder {
247247
}
248248

249249
template <class Tcolls, class Ttracks>
250-
void fillCandidateData(const Tcolls& collisions, const Ttracks& tracks, aod::AmbiguousTracks const& ambiguousTracks, aod::BCsWithTimestamps const& bcs)
250+
void fillCandidateData(const Tcolls& collisions, const Ttracks& tracks, aod::AmbiguousTracks const& ambiguousTracks, aod::BCs const& bcs)
251251
{
252252
svCreator.clearPools();
253253
svCreator.fillBC2Coll(collisions, bcs);
@@ -274,7 +274,7 @@ struct kinkBuilder {
274274
auto trackDaug = tracks.rawIteratorAt(svCand.tr1Idx);
275275

276276
auto const& collision = trackMoth.template collision_as<Tcolls>();
277-
auto const& bc = collision.template bc_as<aod::BCsWithTimestamps>();
277+
auto const& bc = collision.template bc_as<aod::BCs>();
278278
initCCDB(bc);
279279

280280
o2::dataformats::VertexBase primaryVertex;
@@ -401,34 +401,34 @@ struct kinkBuilder {
401401
}
402402
}
403403

404-
void initCCDB(aod::BCsWithTimestamps::iterator const& bc)
404+
void initCCDB(aod::BCs::iterator const& bc)
405405
{
406406
if (mRunNumber == bc.runNumber()) {
407407
return;
408408
}
409-
auto run3grp_timestamp = bc.timestamp();
409+
mRunNumber = bc.runNumber();
410410

411-
o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp<o2::parameters::GRPObject>(grpPath, run3grp_timestamp);
411+
o2::parameters::GRPObject* grpo = ccdb->getForRun<o2::parameters::GRPObject>(grpPath, mRunNumber);
412412
o2::parameters::GRPMagField* grpmag = 0x0;
413413
if (grpo) {
414414
o2::base::Propagator::initFieldFromGRP(grpo);
415415
if (inputBz < -990) {
416416
// Fetch magnetic field from ccdb for current collision
417417
mBz = grpo->getNominalL3Field();
418-
LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << mBz << " kZG";
418+
LOG(info) << "Retrieved GRP for run " << mRunNumber << " with magnetic field of " << mBz << " kZG";
419419
} else {
420420
mBz = inputBz;
421421
}
422422
} else {
423-
grpmag = ccdb->getForTimeStamp<o2::parameters::GRPMagField>(grpmagPath, run3grp_timestamp);
423+
grpmag = ccdb->getForRun<o2::parameters::GRPMagField>(grpmagPath, mRunNumber);
424424
if (!grpmag) {
425-
LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp;
425+
LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for run " << mRunNumber;
426426
}
427427
o2::base::Propagator::initFieldFromGRP(grpmag);
428428
if (inputBz < -990) {
429429
// Fetch magnetic field from ccdb for current collision
430430
mBz = std::lround(5.f * grpmag->getL3Current() / 30000.f);
431-
LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << mBz << " kZG";
431+
LOG(info) << "Retrieved GRP for run " << mRunNumber << " with magnetic field of " << mBz << " kZG";
432432
} else {
433433
mBz = inputBz;
434434
}
@@ -440,12 +440,11 @@ struct kinkBuilder {
440440
mBBparamsDaug[5] = cfgBetheBlochParams->get("Daughter", "resolution");
441441

442442
fitter.setBz(mBz);
443-
mRunNumber = bc.runNumber();
444443
o2::base::Propagator::Instance()->setMatLUT(lut);
445444
LOG(info) << "Task initialized for run " << mRunNumber << " with magnetic field " << mBz << " kZG";
446445
}
447446

448-
void process(aod::Collisions const& collisions, TracksFull const& tracks, aod::AmbiguousTracks const& ambiTracks, aod::BCsWithTimestamps const& bcs)
447+
void process(aod::Collisions const& collisions, TracksFull const& tracks, aod::AmbiguousTracks const& ambiTracks, aod::BCs const& bcs)
449448
{
450449

451450
kinkCandidates.clear();

PWGLF/Utils/svPoolCreator.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,20 @@ class svPoolCreator
7373
o2::vertexing::DCAFitterN<2>* getFitter() { return &fitter; }
7474
std::array<std::vector<TrackCand>, 4> getTrackCandPool() { return trackCandPool; }
7575

76-
template <typename C>
77-
void fillBC2Coll(const C& collisions, aod::BCsWithTimestamps const&)
76+
template <typename C, typename BC>
77+
void fillBC2Coll(const C& collisions, BC const&)
7878
{
7979
for (unsigned i = 0; i < collisions.size(); i++) {
8080
auto collision = collisions.rawIteratorAt(i);
8181
if (!collision.has_bc()) {
8282
continue;
8383
}
84-
bc2Coll[collision.template bc_as<aod::BCsWithTimestamps>().globalBC()] = i;
84+
bc2Coll[collision.template bc_as<BC>().globalBC()] = i;
8585
}
8686
}
8787

88-
template <typename T, typename C>
89-
void appendTrackCand(const T& trackCand, const C& collisions, int pdgHypo, o2::aod::AmbiguousTracks const& ambiTracks, aod::BCsWithTimestamps const&)
88+
template <typename T, typename C, typename BC>
89+
void appendTrackCand(const T& trackCand, const C& collisions, int pdgHypo, o2::aod::AmbiguousTracks const& ambiTracks, BC const&)
9090
{
9191
if (pdgHypo != track0Pdg && pdgHypo != track1Pdg) {
9292
LOG(debug) << "Wrong pdg hypothesis";
@@ -97,18 +97,18 @@ class svPoolCreator
9797
uint64_t globalBC = BcInvalid;
9898
if (trackCand.has_collision()) {
9999
if (trackCand.template collision_as<C>().has_bc()) {
100-
globalBC = trackCand.template collision_as<C>().template bc_as<aod::BCsWithTimestamps>().globalBC();
100+
globalBC = trackCand.template collision_as<C>().template bc_as<BC>().globalBC();
101101
}
102102
} else if (!skipAmbiTracks) {
103103
for (const auto& ambTrack : ambiTracks) {
104104
if (ambTrack.trackId() != trackCand.globalIndex()) {
105105
continue;
106106
}
107-
if (!ambTrack.has_bc() || ambTrack.bc_as<aod::BCsWithTimestamps>().size() == 0) {
107+
if (!ambTrack.has_bc() || ambTrack.bc_as<BC>().size() == 0) {
108108
globalBC = BcInvalid;
109109
break;
110110
}
111-
globalBC = ambTrack.bc_as<aod::BCsWithTimestamps>().begin().globalBC();
111+
globalBC = ambTrack.bc_as<BC>().begin().globalBC();
112112
break;
113113
}
114114
} else {
@@ -134,7 +134,7 @@ class svPoolCreator
134134
const auto& collision = collisions.rawIteratorAt(i);
135135
float collTime = collision.collisionTime();
136136
float collTimeRes2 = collision.collisionTimeRes() * collision.collisionTimeRes();
137-
uint64_t collBC = collision.template bc_as<aod::BCsWithTimestamps>().globalBC();
137+
uint64_t collBC = collision.template bc_as<BC>().globalBC();
138138
int collIdx = collision.globalIndex();
139139
int64_t bcOffset = globalBC - static_cast<int64_t>(collBC);
140140
if (static_cast<uint64_t>(std::abs(bcOffset)) > bOffsetMax) {

0 commit comments

Comments
 (0)