Skip to content

Commit

Permalink
Revert "TOF: Use DPL CCDB fetcher rather than CCDBManager (#2261)" (#…
Browse files Browse the repository at this point in the history
…2265)

This reverts commit a490b25.
  • Loading branch information
Barthelemy committed Apr 26, 2024
1 parent cbad401 commit eae9cd5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Modules/TOF/include/TOF/TaskDigits.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ class TaskDigits final : public TaskInterface

int mNoiseClassSelection = -1; /// Index to discard classes of noisy channels -1 no discarding, 0 first class are discarded, 1 second class, 2 third class

o2::dataformats::CalibTimeSlewingParamTOF* mCalChannel = nullptr;
o2::dataformats::CalibLHCphaseTOF* mLHCphase = nullptr;
bool mApplyCalib = false;

////////////////
Expand Down
15 changes: 10 additions & 5 deletions Modules/TOF/src/TaskDigits.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <Framework/InputRecord.h>
#include "CommonConstants/LHCConstants.h"
#include "DataFormatsTOF/Diagnostic.h"
#include "CCDB/BasicCCDBManager.h"
#include "Framework/TimingInfo.h"
#include "DetectorsBase/GeometryManager.h"

Expand Down Expand Up @@ -239,6 +240,12 @@ void TaskDigits::startOfCycle()

void TaskDigits::monitorData(o2::framework::ProcessingContext& ctx)
{
if (mApplyCalib && !mCalChannel) {
auto creationTime = ctx.services().get<o2::framework::TimingInfo>().creation;
mCalChannel = o2::ccdb::BasicCCDBManager::instance().getForTimeStamp<o2::dataformats::CalibTimeSlewingParamTOF>("TOF/Calib/ChannelCalib", creationTime);
mLHCphase = o2::ccdb::BasicCCDBManager::instance().getForTimeStamp<o2::dataformats::CalibLHCphaseTOF>("TOF/Calib/LHCphase", creationTime);
}

// Get TOF digits
const auto& digits = ctx.inputs().get<gsl::span<o2::tof::Digit>>("tofdigits");
// Get TOF Readout window
Expand Down Expand Up @@ -378,12 +385,10 @@ void TaskDigits::monitorData(o2::framework::ProcessingContext& ctx)
o2::tof::Geo::getPos(det, pos);
float length = sqrt(pos[0] * pos[0] + pos[1] * pos[1] + pos[2] * pos[2]);

if (mApplyCalib) { // calibration
auto calChannel = ctx.inputs().get<o2::dataformats::CalibTimeSlewingParamTOF*>("channelCalib");
auto lhcPhase = ctx.inputs().get<o2::dataformats::CalibLHCphaseTOF*>("lhcPhase");
if (mCalChannel) { // calibration
float timeTDCcorr = digit.getTDC() * o2::tof::Geo::TDCBIN; // in ps
timeTDCcorr -= calChannel->evalTimeSlewing(digit.getChannel(), 0.0);
timeTDCcorr -= lhcPhase->getLHCphase(0);
timeTDCcorr -= mCalChannel->evalTimeSlewing(digit.getChannel(), 0.0);
timeTDCcorr -= mLHCphase->getLHCphase(0);
timeTDCcorr -= length * 33.356410 - 1000; // subract path (1ns margin)
bcCorrCable += int(o2::constants::lhc::LHCMaxBunches + timeTDCcorr * o2::tof::Geo::BC_TIME_INPS_INV) - o2::constants::lhc::LHCMaxBunches; // to truncate in the proper way
} else {
Expand Down

0 comments on commit eae9cd5

Please sign in to comment.