diff --git a/Detectors/TOF/calibration/include/TOFCalibration/TOFDiagnosticCalibrator.h b/Detectors/TOF/calibration/include/TOFCalibration/TOFDiagnosticCalibrator.h index 7b23df6040d3d..fccfcf51fdaa9 100644 --- a/Detectors/TOF/calibration/include/TOFCalibration/TOFDiagnosticCalibrator.h +++ b/Detectors/TOF/calibration/include/TOFCalibration/TOFDiagnosticCalibrator.h @@ -31,9 +31,9 @@ class TOFDiagnosticCalibrator final : public o2::calibration::TimeSlotCalibratio int mRunNumber = -1; public: - TOFDiagnosticCalibrator() = default; + TOFDiagnosticCalibrator(int minROwin = 100) : mMinROwin(minROwin) {} ~TOFDiagnosticCalibrator() final = default; - bool hasEnoughData(const Slot& slot) const final { return true; } + bool hasEnoughData(const Slot& slot) const final; void initOutput() final; void finalizeSlot(Slot& slot) final; Slot& emplaceNewSlot(bool front, TFType tstart, TFType tend) final; @@ -43,12 +43,15 @@ class TOFDiagnosticCalibrator final : public o2::calibration::TimeSlotCalibratio const std::vector& getDiagnosticVector() const { return mDiagnosticVector; } const CcdbObjectInfoVector& getDiagnosticInfoVector() const { return mccdbInfoVector; } CcdbObjectInfoVector& getDiagnosticInfoVector() { return mccdbInfoVector; } + int getMinROwin() const { return mMinROwin; } + void setMinROwin(int rowin) { mMinROwin = rowin; } private: CcdbObjectInfoVector mccdbInfoVector; std::vector mDiagnosticVector; + int mMinROwin; // minimal number of readout windows needed to finalize the object - ClassDefOverride(TOFDiagnosticCalibrator, 1); + ClassDefOverride(TOFDiagnosticCalibrator, 2); }; } // end namespace tof diff --git a/Detectors/TOF/calibration/src/TOFDiagnosticCalibrator.cxx b/Detectors/TOF/calibration/src/TOFDiagnosticCalibrator.cxx index 9a4118dbba493..f238d69bb75ed 100644 --- a/Detectors/TOF/calibration/src/TOFDiagnosticCalibrator.cxx +++ b/Detectors/TOF/calibration/src/TOFDiagnosticCalibrator.cxx @@ -28,7 +28,17 @@ void TOFDiagnosticCalibrator::initOutput() mccdbInfoVector.clear(); mDiagnosticVector.clear(); } +//---------------------------------------------------------- +bool TOFDiagnosticCalibrator::hasEnoughData(const Slot& slot) const +{ + const Diagnostic* diag = slot.getContainer(); + if (diag->getFrequencyROW() < mMinROwin) { + return false; + } + + return true; +} //---------------------------------------------------------- void TOFDiagnosticCalibrator::finalizeSlot(Slot& slot) { diff --git a/Detectors/TOF/calibration/testWorkflow/TOFDiagnosticCalibratorSpec.h b/Detectors/TOF/calibration/testWorkflow/TOFDiagnosticCalibratorSpec.h index 7887ff848d544..91b931f3b96b3 100644 --- a/Detectors/TOF/calibration/testWorkflow/TOFDiagnosticCalibratorSpec.h +++ b/Detectors/TOF/calibration/testWorkflow/TOFDiagnosticCalibratorSpec.h @@ -37,7 +37,7 @@ namespace calibration class TOFDiagnosticCalibDevice : public o2::framework::Task { public: - TOFDiagnosticCalibDevice(std::shared_ptr req, int runnumber = -1) : mCCDBRequest(req), mRunNumber(runnumber) {} + TOFDiagnosticCalibDevice(std::shared_ptr req, int runnumber = -1, int rowinMin = 100000) : mCCDBRequest(req), mRunNumber(runnumber), mMinROwin(rowinMin) {} void init(o2::framework::InitContext& ic) final { o2::base::GRPGeomHelper::instance().setRequest(mCCDBRequest); @@ -47,6 +47,7 @@ class TOFDiagnosticCalibDevice : public o2::framework::Task mCalibrator->setSlotLength(slotL); mCalibrator->setMaxSlotsDelay(delay); mCalibrator->setRunNumber(mRunNumber); + mCalibrator->setMinROwin(mMinROwin); } void finaliseCCDB(o2::framework::ConcreteDataMatcher& matcher, void* obj) final @@ -75,6 +76,7 @@ class TOFDiagnosticCalibDevice : public o2::framework::Task std::unique_ptr mCalibrator; std::shared_ptr mCCDBRequest; int mRunNumber = -1; + int mMinROwin = 100000; //________________________________________________________________ void sendOutput(DataAllocator& output) @@ -104,7 +106,7 @@ class TOFDiagnosticCalibDevice : public o2::framework::Task namespace framework { -DataProcessorSpec getTOFDiagnosticCalibDeviceSpec(int runnumber) +DataProcessorSpec getTOFDiagnosticCalibDeviceSpec(int runnumber, int rowinMin) { using device = o2::calibration::TOFDiagnosticCalibDevice; using clbUtils = o2::calibration::Utils; @@ -125,7 +127,7 @@ DataProcessorSpec getTOFDiagnosticCalibDeviceSpec(int runnumber) "tof-diagnostic-calibration", inputs, outputs, - AlgorithmSpec{adaptFromTask(ccdbRequest, runnumber)}, + AlgorithmSpec{adaptFromTask(ccdbRequest, runnumber, rowinMin)}, Options{ {"tf-per-slot", VariantType::UInt32, 5u, {"number of TFs per calibration time slot"}}, {"max-delay", VariantType::UInt32, 3u, {"number of slots in past to consider"}}}}; diff --git a/Detectors/TOF/calibration/testWorkflow/tof-diagnostic-workflow.cxx b/Detectors/TOF/calibration/testWorkflow/tof-diagnostic-workflow.cxx index 3cde7be96867a..b45fcc2b5498c 100644 --- a/Detectors/TOF/calibration/testWorkflow/tof-diagnostic-workflow.cxx +++ b/Detectors/TOF/calibration/testWorkflow/tof-diagnostic-workflow.cxx @@ -19,6 +19,7 @@ void customize(std::vector& workflowOptions) { // option allowing to set parameters workflowOptions.push_back(ConfigParamSpec{"tof-dia-run-number", o2::framework::VariantType::Int, -1, {"run number"}}); + workflowOptions.push_back(ConfigParamSpec{"tof-dia-min-rowin", o2::framework::VariantType::Int, 100000, {"min number of TOF Readout Windows, def=100k (3 s)"}}); } // ------------------------------------------------------------------ @@ -29,6 +30,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) { WorkflowSpec specs; auto runnumber = configcontext.options().get("tof-dia-run-number"); - specs.emplace_back(getTOFDiagnosticCalibDeviceSpec(runnumber)); + auto rowinMin = configcontext.options().get("tof-dia-min-rowin"); + specs.emplace_back(getTOFDiagnosticCalibDeviceSpec(runnumber, rowinMin)); return specs; }