diff --git a/Modules/TOF/include/TOF/TaskDigits.h b/Modules/TOF/include/TOF/TaskDigits.h index 2bcb534777..9f5abdfcd1 100644 --- a/Modules/TOF/include/TOF/TaskDigits.h +++ b/Modules/TOF/include/TOF/TaskDigits.h @@ -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; //////////////// diff --git a/Modules/TOF/src/TaskDigits.cxx b/Modules/TOF/src/TaskDigits.cxx index bb7637843c..9df32a4129 100644 --- a/Modules/TOF/src/TaskDigits.cxx +++ b/Modules/TOF/src/TaskDigits.cxx @@ -32,6 +32,7 @@ #include #include "CommonConstants/LHCConstants.h" #include "DataFormatsTOF/Diagnostic.h" +#include "CCDB/BasicCCDBManager.h" #include "Framework/TimingInfo.h" #include "DetectorsBase/GeometryManager.h" @@ -239,6 +240,12 @@ void TaskDigits::startOfCycle() void TaskDigits::monitorData(o2::framework::ProcessingContext& ctx) { + if (mApplyCalib && !mCalChannel) { + auto creationTime = ctx.services().get().creation; + mCalChannel = o2::ccdb::BasicCCDBManager::instance().getForTimeStamp("TOF/Calib/ChannelCalib", creationTime); + mLHCphase = o2::ccdb::BasicCCDBManager::instance().getForTimeStamp("TOF/Calib/LHCphase", creationTime); + } + // Get TOF digits const auto& digits = ctx.inputs().get>("tofdigits"); // Get TOF Readout window @@ -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("channelCalib"); - auto lhcPhase = ctx.inputs().get("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 {