From 93263cb94877ce97af6d583b8ca6f624e06a9938 Mon Sep 17 00:00:00 2001 From: wpieroza Date: Wed, 5 Aug 2026 07:16:58 +0000 Subject: [PATCH 01/28] Created configuration structures for Channels, Tcm and Pm data --- .../include/DataFormatsFIT/FeeConfiguration.h | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 DataFormats/Detectors/FIT/common/include/DataFormatsFIT/FeeConfiguration.h diff --git a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/FeeConfiguration.h b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/FeeConfiguration.h new file mode 100644 index 0000000000000..616da888e8a64 --- /dev/null +++ b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/FeeConfiguration.h @@ -0,0 +1,86 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef O2_FIT_FEE_CONFIGURATION +#define O2_FIT_FEE_CONFIGURATION + +#include +#include +#include +#include + +namespace o2::fit::detector_config { +struct Tcm { + float phaseDelayA{}; + float phaseDelayC{}; +}; + +template +struct Channels { + template + static constexpr auto DefaultValue = [] { + using ValueType = std::remove_all_extents_t>; + if constexpr (std::is_same_v) { + return false; + } else { + return std::numeric_limits::max(); + } + }(); + + float timeAligments[NChannels]{}; + uint16_t cfdThresholds[NChannels]{}; + int16_t cfdZeros[NChannels]{}; + int16_t adcZeros[NChannels]{}; + uint16_t adcDelays[NChannels]{}; + float scalingFactorAdc0s[NChannels]{}; + float scalingFactorAdc1s[NChannels]{}; + bool channelMaskData[NChannels]{}; + bool channelMaskTriggers[NChannels]{}; + + constexpr Channels() { + fillDefault(timeAligments); + fillDefault(cfdThresholds); + fillDefault(cfdZeros); + fillDefault(adcZeros); + fillDefault(adcDelays); + fillDefault(scalingFactorAdc0s); + fillDefault(scalingFactorAdc1s); + fillDefault(channelMaskData); + fillDefault(channelMaskTriggers); + } + + template + [[nodiscard]] static constexpr bool isDefault(const T& value) { + return value == DefaultValue; + } + + template + static constexpr void fillDefault(T (&array)[N]) { + for (auto& element : array) { + element = DefaultValue; + } + } + + gsl::span getTimeAligments() const { return timeAligments; } + gsl::span getCfdThresholds() const { return cfdThresholds; } + gsl::span getCfdZeros() const { return cfdZeros; } + gsl::span getAdcZeros() const { return adcZeros; } + gsl::span getAdcDelays() const { return adcDelays; } + gsl::span getScalingFactorAdc0s() const { return scalingFactorAdc0s; } + gsl::span getScalingFactorAdc1s() const { return scalingFactorAdc1s; } + gsl::span getChannelMaskTriggers() const { return channelMaskTriggers; } + gsl::span getChannelMaskData() const { return channelMaskData; } +}; + +struct Pm { + uint8_t orGate{}; +}; +#endif \ No newline at end of file From 734c2be3dbd18369e1285a6ef89d40771f1b9f8a Mon Sep 17 00:00:00 2001 From: wpieroza Date: Wed, 5 Aug 2026 07:27:07 +0000 Subject: [PATCH 02/28] Cleaned detector_config::Channels structure --- .../include/DataFormatsFIT/FeeConfiguration.h | 60 ++++++++++--------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/FeeConfiguration.h b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/FeeConfiguration.h index 616da888e8a64..3e961f41dc045 100644 --- a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/FeeConfiguration.h +++ b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/FeeConfiguration.h @@ -13,11 +13,31 @@ #define O2_FIT_FEE_CONFIGURATION #include +#include +#include #include #include -#include namespace o2::fit::detector_config { +namespace helpers { +template +constexpr auto DefaultValue = [] { + using ValueType = std::remove_all_extents_t>; + if constexpr (std::is_same_v) { + return false; + } else { + return std::numeric_limits::max(); + } +}(); + +template +constexpr void fillDefaultArray(T (&array)[N]) { + for (auto& element : array) { + element = DefaultValue; + } +} +} + struct Tcm { float phaseDelayA{}; float phaseDelayC{}; @@ -25,16 +45,6 @@ struct Tcm { template struct Channels { - template - static constexpr auto DefaultValue = [] { - using ValueType = std::remove_all_extents_t>; - if constexpr (std::is_same_v) { - return false; - } else { - return std::numeric_limits::max(); - } - }(); - float timeAligments[NChannels]{}; uint16_t cfdThresholds[NChannels]{}; int16_t cfdZeros[NChannels]{}; @@ -46,27 +56,20 @@ struct Channels { bool channelMaskTriggers[NChannels]{}; constexpr Channels() { - fillDefault(timeAligments); - fillDefault(cfdThresholds); - fillDefault(cfdZeros); - fillDefault(adcZeros); - fillDefault(adcDelays); - fillDefault(scalingFactorAdc0s); - fillDefault(scalingFactorAdc1s); - fillDefault(channelMaskData); - fillDefault(channelMaskTriggers); + helpers::fillDefaultArray(timeAligments); + helpers::fillDefaultArray(cfdThresholds); + helpers::fillDefaultArray(cfdZeros); + helpers::fillDefaultArray(adcZeros); + helpers::fillDefaultArray(adcDelays); + helpers::fillDefaultArray(scalingFactorAdc0s); + helpers::fillDefaultArray(scalingFactorAdc1s); + helpers::fillDefaultArray(channelMaskData); + helpers::fillDefaultArray(channelMaskTriggers); } template [[nodiscard]] static constexpr bool isDefault(const T& value) { - return value == DefaultValue; - } - - template - static constexpr void fillDefault(T (&array)[N]) { - for (auto& element : array) { - element = DefaultValue; - } + return value == helpers::DefaultValue; } gsl::span getTimeAligments() const { return timeAligments; } @@ -83,4 +86,5 @@ struct Channels { struct Pm { uint8_t orGate{}; }; +} #endif \ No newline at end of file From cf7aa811694e7db24164e7e809a00b98376691ce Mon Sep 17 00:00:00 2001 From: wpieroza Date: Wed, 5 Aug 2026 07:47:01 +0000 Subject: [PATCH 03/28] Created FEE configuration data types for subdetectors --- .../include/DataFormatsFDD/FeeConfiguration.h | 39 ++++++++++++ .../include/DataFormatsFT0/FeeConfiguration.h | 39 ++++++++++++ .../include/DataFormatsFV0/FeeConfiguration.h | 38 ++++++++++++ .../include/DataFormatsFIT/FeeConfiguration.h | 61 ++++++++++--------- 4 files changed, 149 insertions(+), 28 deletions(-) create mode 100644 DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h create mode 100644 DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h create mode 100644 DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/FeeConfiguration.h diff --git a/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h b/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h new file mode 100644 index 0000000000000..1d0fe23eb2469 --- /dev/null +++ b/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h @@ -0,0 +1,39 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef O2_FDD_FEE_CONFIGURATION +#define O2_FDD_FEE_CONFIGURATION + +#include "CommonUtils/ConfigurableParamHelper.h" +#include "DataFormatsFIT/FeeConfiguration.h" + +namespace o2::fdd { +struct TriggersConfig +{ + float vertexTimeLowThreshold{o2::fit::config_helpers::DefaultValue}; + float vertexTimeHighThreshold{o2::fit::config_helpers::DefaultValue}; + uint16_t nChannels{o2::fit::config_helpers::DefaultValue}; + uint16_t innerRings{o2::fit::config_helpers::DefaultValue}; + uint16_t charge{o2::fit::config_helpers::DefaultValue}; + uint16_t outerRings{o2::fit::config_helpers::DefaultValue}; +}; + +struct FddFeeConfiguration : o2::conf::ConfigurableParamHelper { + static constexpr int NChannels = 16; + TriggersConfig triggers; + o2::fit::ChannelsConfig channels; + o2::fit::TcmConfig tcm; + o2::fit::PmConfig pmA[10]; + o2::fit::PmConfig pmC[10]; + O2ParamDef(FddFeeConfiguration, "FddFeeConfiguration"); +}; +} +#endif \ No newline at end of file diff --git a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h new file mode 100644 index 0000000000000..09d359cd8414b --- /dev/null +++ b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h @@ -0,0 +1,39 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef O2_FT0_FEE_CONFIGURATION +#define O2_FT0_FEE_CONFIGURATION + +#include "CommonUtils/ConfigurableParamHelper.h" +#include "DataFormatsFIT/FeeConfiguration.h" + +namespace o2::ft0 { +struct TriggersConfig +{ + float vertexTimeLowThreshold{o2::fit::config_helpers::DefaultValue}; + float vertexTimeHighThreshold{o2::fit::config_helpers::DefaultValue}; + uint16_t semicentralA{o2::fit::config_helpers::DefaultValue}; + uint16_t semicentralC{o2::fit::config_helpers::DefaultValue}; + uint16_t centralA{o2::fit::config_helpers::DefaultValue}; + uint16_t centralC{o2::fit::config_helpers::DefaultValue}; +}; + +struct Ft0FeeConfiguration : o2::conf::ConfigurableParamHelper { + static constexpr int NChannels = 212; + TriggersConfig triggers; + o2::fit::ChannelsConfig channels; + o2::fit::TcmConfig tcm; + o2::fit::PmConfig pmA[10]; + o2::fit::PmConfig pmC[10]; + O2ParamDef(Ft0FeeConfiguration, "Ft0FeeConfiguration"); +}; +} +#endif \ No newline at end of file diff --git a/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/FeeConfiguration.h b/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/FeeConfiguration.h new file mode 100644 index 0000000000000..8da0aba3fa83a --- /dev/null +++ b/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/FeeConfiguration.h @@ -0,0 +1,38 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef O2_FV0_FEE_CONFIGURATION +#define O2_FV0_FEE_CONFIGURATION + +#include "CommonUtils/ConfigurableParamHelper.h" +#include "DataFormatsFIT/FeeConfiguration.h" + +namespace o2::fv0 { +struct TriggersConfig +{ + float vertexTimeLowThreshold{o2::fit::config_helpers::DefaultValue}; + float vertexTimeHighThreshold{o2::fit::config_helpers::DefaultValue}; + uint16_t nChannels{o2::fit::config_helpers::DefaultValue}; + uint16_t innerRings{o2::fit::config_helpers::DefaultValue}; + uint16_t charge{o2::fit::config_helpers::DefaultValue}; + uint16_t outerRings{o2::fit::config_helpers::DefaultValue}; +}; + +struct Fv0FeeConfiguration : o2::conf::ConfigurableParamHelper { + static constexpr int NChannels = 48; + TriggersConfig triggers; + o2::fit::ChannelsConfig channels; + o2::fit::TcmConfig tcm; + o2::fit::PmConfig pmA[10]; + O2ParamDef(Fv0FeeConfiguration, "Fv0FeeConfiguration"); +}; +} +#endif \ No newline at end of file diff --git a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/FeeConfiguration.h b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/FeeConfiguration.h index 3e961f41dc045..195776ae9cb02 100644 --- a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/FeeConfiguration.h +++ b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/FeeConfiguration.h @@ -18,33 +18,38 @@ #include #include -namespace o2::fit::detector_config { -namespace helpers { -template -constexpr auto DefaultValue = [] { - using ValueType = std::remove_all_extents_t>; - if constexpr (std::is_same_v) { - return false; - } else { - return std::numeric_limits::max(); +namespace o2::fit { +namespace config_helpers { +struct DefaultValueType { + template + requires std::is_arithmetic_v + constexpr operator T() const noexcept + { + if constexpr (std::is_same_v) { + return false; + } else { + return std::numeric_limits::max(); + } } -}(); +}; + +inline constexpr DefaultValueType DefaultValue{}; template constexpr void fillDefaultArray(T (&array)[N]) { for (auto& element : array) { - element = DefaultValue; + element = DefaultValue; } } } -struct Tcm { - float phaseDelayA{}; - float phaseDelayC{}; +struct TcmConfig { + float phaseDelayA{config_helpers::DefaultValue}; + float phaseDelayC{config_helpers::DefaultValue}; }; template -struct Channels { +struct ChannelsConfig { float timeAligments[NChannels]{}; uint16_t cfdThresholds[NChannels]{}; int16_t cfdZeros[NChannels]{}; @@ -55,21 +60,21 @@ struct Channels { bool channelMaskData[NChannels]{}; bool channelMaskTriggers[NChannels]{}; - constexpr Channels() { - helpers::fillDefaultArray(timeAligments); - helpers::fillDefaultArray(cfdThresholds); - helpers::fillDefaultArray(cfdZeros); - helpers::fillDefaultArray(adcZeros); - helpers::fillDefaultArray(adcDelays); - helpers::fillDefaultArray(scalingFactorAdc0s); - helpers::fillDefaultArray(scalingFactorAdc1s); - helpers::fillDefaultArray(channelMaskData); - helpers::fillDefaultArray(channelMaskTriggers); + constexpr ChannelsConfig() { + config_helpers::fillDefaultArray(timeAligments); + config_helpers::fillDefaultArray(cfdThresholds); + config_helpers::fillDefaultArray(cfdZeros); + config_helpers::fillDefaultArray(adcZeros); + config_helpers::fillDefaultArray(adcDelays); + config_helpers::fillDefaultArray(scalingFactorAdc0s); + config_helpers::fillDefaultArray(scalingFactorAdc1s); + config_helpers::fillDefaultArray(channelMaskData); + config_helpers::fillDefaultArray(channelMaskTriggers); } template [[nodiscard]] static constexpr bool isDefault(const T& value) { - return value == helpers::DefaultValue; + return value == static_cast(config_helpers::DefaultValue); } gsl::span getTimeAligments() const { return timeAligments; } @@ -83,8 +88,8 @@ struct Channels { gsl::span getChannelMaskData() const { return channelMaskData; } }; -struct Pm { - uint8_t orGate{}; +struct PmConfig { + uint8_t orGate{config_helpers::DefaultValue}; }; } #endif \ No newline at end of file From 7b1adf6e58a68e488300112fc62cc41188e5edd2 Mon Sep 17 00:00:00 2001 From: wpieroza Date: Wed, 5 Aug 2026 07:57:54 +0000 Subject: [PATCH 04/28] Renamed DataFormatsFIT/FeeConfiguration.h to DataFormatsFIT/Configuration.h --- .../FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h | 2 +- .../FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h | 2 +- .../FIT/FV0/include/DataFormatsFV0/FeeConfiguration.h | 2 +- .../DataFormatsFIT/{FeeConfiguration.h => Configuration.h} | 4 ++++ 4 files changed, 7 insertions(+), 3 deletions(-) rename DataFormats/Detectors/FIT/common/include/DataFormatsFIT/{FeeConfiguration.h => Configuration.h} (96%) diff --git a/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h b/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h index 1d0fe23eb2469..e2e15fc046a34 100644 --- a/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h +++ b/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h @@ -13,7 +13,7 @@ #define O2_FDD_FEE_CONFIGURATION #include "CommonUtils/ConfigurableParamHelper.h" -#include "DataFormatsFIT/FeeConfiguration.h" +#include "DataFormatsFIT/Configuration.h" namespace o2::fdd { struct TriggersConfig diff --git a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h index 09d359cd8414b..f2344c9f3b802 100644 --- a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h +++ b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h @@ -13,7 +13,7 @@ #define O2_FT0_FEE_CONFIGURATION #include "CommonUtils/ConfigurableParamHelper.h" -#include "DataFormatsFIT/FeeConfiguration.h" +#include "DataFormatsFIT/Configuration.h" namespace o2::ft0 { struct TriggersConfig diff --git a/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/FeeConfiguration.h b/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/FeeConfiguration.h index 8da0aba3fa83a..834ec69ad10be 100644 --- a/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/FeeConfiguration.h +++ b/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/FeeConfiguration.h @@ -13,7 +13,7 @@ #define O2_FV0_FEE_CONFIGURATION #include "CommonUtils/ConfigurableParamHelper.h" -#include "DataFormatsFIT/FeeConfiguration.h" +#include "DataFormatsFIT/Configuration.h" namespace o2::fv0 { struct TriggersConfig diff --git a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/FeeConfiguration.h b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h similarity index 96% rename from DataFormats/Detectors/FIT/common/include/DataFormatsFIT/FeeConfiguration.h rename to DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h index 195776ae9cb02..2e45b244ba6c7 100644 --- a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/FeeConfiguration.h +++ b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h @@ -9,6 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +// \file FeeConfiguration.h +/// \brief Utilities to describe FEE configuration +/// \author wiktor.pierozak@cern.ch + #ifndef O2_FIT_FEE_CONFIGURATION #define O2_FIT_FEE_CONFIGURATION From 2f84eea909a926e50737377c116e5dcec1316055 Mon Sep 17 00:00:00 2001 From: wpieroza Date: Wed, 5 Aug 2026 12:07:00 +0000 Subject: [PATCH 05/28] preparing structure for configuration parsing --- .../include/DataFormatsFDD/FeeConfiguration.h | 8 ++++---- .../include/DataFormatsFIT/Configuration.h | 6 ------ .../FT0DCSMonitoring/FT0DCSConfigReader.h | 4 +++- .../dcsmonitoring/src/FT0DcsConfigReader.cxx | 9 +++++++++ .../FITDCSConfigurationDataParser.h | 20 +++++++++++++++++++ 5 files changed, 36 insertions(+), 11 deletions(-) create mode 100644 Detectors/FIT/FT0/dcsmonitoring/src/FT0DcsConfigReader.cxx create mode 100644 Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigurationDataParser.h diff --git a/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h b/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h index e2e15fc046a34..a69a702de730f 100644 --- a/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h +++ b/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h @@ -20,10 +20,10 @@ struct TriggersConfig { float vertexTimeLowThreshold{o2::fit::config_helpers::DefaultValue}; float vertexTimeHighThreshold{o2::fit::config_helpers::DefaultValue}; - uint16_t nChannels{o2::fit::config_helpers::DefaultValue}; - uint16_t innerRings{o2::fit::config_helpers::DefaultValue}; - uint16_t charge{o2::fit::config_helpers::DefaultValue}; - uint16_t outerRings{o2::fit::config_helpers::DefaultValue}; + uint16_t semicentralA{o2::fit::config_helpers::DefaultValue}; + uint16_t semicentralC{o2::fit::config_helpers::DefaultValue}; + uint16_t centralA{o2::fit::config_helpers::DefaultValue}; + uint16_t centralC{o2::fit::config_helpers::DefaultValue}; }; struct FddFeeConfiguration : o2::conf::ConfigurableParamHelper { diff --git a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h index 2e45b244ba6c7..df3ca41b55027 100644 --- a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h +++ b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h @@ -59,8 +59,6 @@ struct ChannelsConfig { int16_t cfdZeros[NChannels]{}; int16_t adcZeros[NChannels]{}; uint16_t adcDelays[NChannels]{}; - float scalingFactorAdc0s[NChannels]{}; - float scalingFactorAdc1s[NChannels]{}; bool channelMaskData[NChannels]{}; bool channelMaskTriggers[NChannels]{}; @@ -70,8 +68,6 @@ struct ChannelsConfig { config_helpers::fillDefaultArray(cfdZeros); config_helpers::fillDefaultArray(adcZeros); config_helpers::fillDefaultArray(adcDelays); - config_helpers::fillDefaultArray(scalingFactorAdc0s); - config_helpers::fillDefaultArray(scalingFactorAdc1s); config_helpers::fillDefaultArray(channelMaskData); config_helpers::fillDefaultArray(channelMaskTriggers); } @@ -86,8 +82,6 @@ struct ChannelsConfig { gsl::span getCfdZeros() const { return cfdZeros; } gsl::span getAdcZeros() const { return adcZeros; } gsl::span getAdcDelays() const { return adcDelays; } - gsl::span getScalingFactorAdc0s() const { return scalingFactorAdc0s; } - gsl::span getScalingFactorAdc1s() const { return scalingFactorAdc1s; } gsl::span getChannelMaskTriggers() const { return channelMaskTriggers; } gsl::span getChannelMaskData() const { return channelMaskData; } }; diff --git a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigReader.h b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigReader.h index 8c8a216ac65b0..cc09d571409eb 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigReader.h +++ b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigReader.h @@ -19,6 +19,7 @@ #include "FITDCSMonitoring/FITDCSConfigReader.h" #include "Rtypes.h" +#include "DataFormatsFT0/FeeConfiguration.h" namespace o2 { @@ -33,7 +34,8 @@ namespace ft0 class FT0DCSConfigReader : public o2::fit::FITDCSConfigReader { // For FT0 specific processing of DCS configurations, override base class methods here. - + public: + Ft0FeeConfiguration parseFeeConfiguration(gsl::span configBuf); ClassDefNV(FT0DCSConfigReader, 0); }; diff --git a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DcsConfigReader.cxx b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DcsConfigReader.cxx new file mode 100644 index 0000000000000..e3161e686fd2e --- /dev/null +++ b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DcsConfigReader.cxx @@ -0,0 +1,9 @@ +#include "FT0DCSMonitoring/FT0DCSConfigReader.h" +#include buffer) { + rapidjson::MemoryStream ms(buffer.data(), buffer.size()); + rapidjson::Document document; + document.ParseStream(ms); + } +} \ No newline at end of file diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigurationDataParser.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigurationDataParser.h new file mode 100644 index 0000000000000..5aea8d1fed570 --- /dev/null +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigurationDataParser.h @@ -0,0 +1,20 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file FITDCSConfigurationDataParser.h +/// \brief DCS configuration reader for FIT +/// +/// \author Andreas Molander , University of Jyvaskyla, Finland + +#ifndef O2_FIT_DCS_CONFIGURATION_DATA_PARSER_H +#define O2_FIT_DCS_CONFIGURATION_DATA_PARSER_H + +#endif \ No newline at end of file From 2174edf8dcfa5b722aac3a2b236fa77783e0c509 Mon Sep 17 00:00:00 2001 From: Wiktor Pierozak Date: Wed, 5 Aug 2026 15:09:22 +0200 Subject: [PATCH 06/28] Updated DCS code for FT0 --- DataFormats/Detectors/FIT/FT0/CMakeLists.txt | 2 + .../FIT/FT0/src/FeeConfiguration.cxx | 3 + .../FIT/FT0/dcsmonitoring/CMakeLists.txt | 2 +- .../FT0DCSMonitoring/FT0DCSConfigReader.h | 5 -- .../dcsmonitoring/src/FT0DcsConfigReader.cxx | 61 +++++++++++++++++-- 5 files changed, 62 insertions(+), 11 deletions(-) create mode 100644 DataFormats/Detectors/FIT/FT0/src/FeeConfiguration.cxx diff --git a/DataFormats/Detectors/FIT/FT0/CMakeLists.txt b/DataFormats/Detectors/FIT/FT0/CMakeLists.txt index f7d6a111f4348..bfd0a9fd1abc8 100644 --- a/DataFormats/Detectors/FIT/FT0/CMakeLists.txt +++ b/DataFormats/Detectors/FIT/FT0/CMakeLists.txt @@ -19,6 +19,7 @@ o2_add_library(DataFormatsFT0 src/CTF.cxx src/LookUpTable.cxx src/SlewingCoef.cxx + src/FeeConfiguration.cxx PUBLIC_LINK_LIBRARIES O2::FT0Base O2::DataFormatsFIT @@ -48,4 +49,5 @@ o2_target_root_dictionary(DataFormatsFT0 include/DataFormatsFT0/SpectraInfoObject.h include/DataFormatsFT0/SlewingCoef.h include/DataFormatsFT0/EventsPerBc.h + include/DataFormatsFT0/FeeConfiguration.h ) diff --git a/DataFormats/Detectors/FIT/FT0/src/FeeConfiguration.cxx b/DataFormats/Detectors/FIT/FT0/src/FeeConfiguration.cxx new file mode 100644 index 0000000000000..43170f7ec76cd --- /dev/null +++ b/DataFormats/Detectors/FIT/FT0/src/FeeConfiguration.cxx @@ -0,0 +1,3 @@ +#include "DataFormatsFT0/FeeConfiguration.hxx" + +O2ParamImpl(o2::ft0::Ft0FeeConfiguration); \ No newline at end of file diff --git a/Detectors/FIT/FT0/dcsmonitoring/CMakeLists.txt b/Detectors/FIT/FT0/dcsmonitoring/CMakeLists.txt index 3c8abdad32e6c..437ff9f66de3e 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/CMakeLists.txt +++ b/Detectors/FIT/FT0/dcsmonitoring/CMakeLists.txt @@ -10,7 +10,7 @@ # or submit itself to any jurisdiction. o2_add_library(FT0DCSMonitoring - SOURCES src/FT0DCSDataProcessor.cxx + SOURCES src/FT0DCSDataProcessor.cxx src/FT0DcsConfigReader.cxx PUBLIC_LINK_LIBRARIES O2::FITDCSMonitoring) o2_target_root_dictionary(FT0DCSMonitoring diff --git a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigReader.h b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigReader.h index cc09d571409eb..336660aa03a18 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigReader.h +++ b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigReader.h @@ -27,13 +27,8 @@ namespace ft0 { /// DCS configuration reader for FT0 -/// -/// At the moment this class doesn't differ from the base class o2::fit::FITDCSConfigReader, -/// which makes it obsolete. It exists only as an example for how to create detector specific -/// DCS configuration readers later. class FT0DCSConfigReader : public o2::fit::FITDCSConfigReader { - // For FT0 specific processing of DCS configurations, override base class methods here. public: Ft0FeeConfiguration parseFeeConfiguration(gsl::span configBuf); ClassDefNV(FT0DCSConfigReader, 0); diff --git a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DcsConfigReader.cxx b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DcsConfigReader.cxx index e3161e686fd2e..a87f537729d02 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DcsConfigReader.cxx +++ b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DcsConfigReader.cxx @@ -1,9 +1,60 @@ #include "FT0DCSMonitoring/FT0DCSConfigReader.h" -#include + +namespace { +template +bool parseJsonArray(const rapidjson::Value& node, const char* childName, T (&array)[Size]) { + if(node.HasMember(childName) == false) { + throw std::runtime_error(std::string("Failed to find node of name ") + childName); + } + auto childNode = node[childName]; + if (childNode.IsArray() == false) { + throw std::runtime_error(std::format("Node {} is not an array!", childName)); + } + auto jsonArray = childNode.GetArray(); + if(jsonArray.Size() != Size) { + throw std::runtime_error(std::format("Expected array of size {}, parsed array of size {}", Size, jsonArray.Size())); + } + for(int idx = 0; idx < Size; idx++) { + const auto& node = jsonArray[idx]; + if constexpr (std::is_same_v) { + if (!node.IsBool()) return false; + array[idx] = node.GetBool(); + } else if constexpr (std::is_floating_point_v>) { + if (!node.IsNumber()) return false; + array[idx] = node.GetFloat(); + } else if constexpr (std::is_integral_v && std::is_unsigned_v) { + if (!node.IsUint()) return false; + array[idx] = static_cast(node.GetUint()); + } else if constexpr (std::is_integral_v) { + if (!node.IsInt()) return false; + array[idx] = static_cast(node.GetInt()); + } else { + static_assert(std::is_same_v, "Unsupported type"); + } + } + return true; +} +} + namespace o2::ft0 { - Ft0FeeConfiguration FT0DCSConfigReader::parseFeeConfiguration(gsl::span buffer) { - rapidjson::MemoryStream ms(buffer.data(), buffer.size()); - rapidjson::Document document; - document.ParseStream(ms); +Ft0FeeConfiguration FT0DCSConfigReader::parseFeeConfiguration(gsl::span buffer) { + Ft0FeeConfiguration configuration; + rapidjson::MemoryStream ms(buffer.data(), buffer.size()); + rapidjson::Document document; + document.ParseStream(ms); + + if(document.HasMember("channels") == false) { + } + const auto& channels = document["channels"]; + auto timeAligments = channels["timeAligments"]; + parseJsonArray(channels, "timeAligments", configuration.channels.timeAligments); + parseJsonArray(channels, "cfdThresholds", configuration.channels.cfdThresholds); + parseJsonArray(channels, "cfdZeros", configuration.channels.cfdZeros); + parseJsonArray(channels, "adcZeros", configuration.channels.adcZeros); + parseJsonArray(channles, "adcDelays", configuration.channels.adcDelays); + parseJsonArray(channels, "channelMaskData", configuration.channels.channelMaskData); + parseJsonArray(channels, "channelMaskTriggers", configuration.channels.channelMaskTriggers); +} } \ No newline at end of file From 7152c6e27ff75ce944436e96edd97c7c6f1ea263 Mon Sep 17 00:00:00 2001 From: Wiktor Pierozak Date: Thu, 6 Aug 2026 15:53:15 +0200 Subject: [PATCH 07/28] fixed compilation issues --- DataFormats/Detectors/FIT/FT0/CMakeLists.txt | 1 - .../include/DataFormatsFT0/FeeConfiguration.h | 34 +++--- .../FIT/FT0/src/DataFormatsFT0LinkDef.h | 2 +- .../FIT/FT0/src/FeeConfiguration.cxx | 3 - .../FIT/FT0/dcsmonitoring/CMakeLists.txt | 2 +- .../dcsmonitoring/src/FT0DcsConfigReader.cxx | 112 ++++++++++-------- 6 files changed, 79 insertions(+), 75 deletions(-) delete mode 100644 DataFormats/Detectors/FIT/FT0/src/FeeConfiguration.cxx diff --git a/DataFormats/Detectors/FIT/FT0/CMakeLists.txt b/DataFormats/Detectors/FIT/FT0/CMakeLists.txt index bfd0a9fd1abc8..4909e91a395a8 100644 --- a/DataFormats/Detectors/FIT/FT0/CMakeLists.txt +++ b/DataFormats/Detectors/FIT/FT0/CMakeLists.txt @@ -19,7 +19,6 @@ o2_add_library(DataFormatsFT0 src/CTF.cxx src/LookUpTable.cxx src/SlewingCoef.cxx - src/FeeConfiguration.cxx PUBLIC_LINK_LIBRARIES O2::FT0Base O2::DataFormatsFIT diff --git a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h index f2344c9f3b802..da4954e3bb117 100644 --- a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h +++ b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h @@ -15,25 +15,25 @@ #include "CommonUtils/ConfigurableParamHelper.h" #include "DataFormatsFIT/Configuration.h" -namespace o2::ft0 { -struct TriggersConfig +namespace o2::ft0 { - float vertexTimeLowThreshold{o2::fit::config_helpers::DefaultValue}; - float vertexTimeHighThreshold{o2::fit::config_helpers::DefaultValue}; - uint16_t semicentralA{o2::fit::config_helpers::DefaultValue}; - uint16_t semicentralC{o2::fit::config_helpers::DefaultValue}; - uint16_t centralA{o2::fit::config_helpers::DefaultValue}; - uint16_t centralC{o2::fit::config_helpers::DefaultValue}; +struct TriggersConfig { + float vertexTimeLowThreshold{o2::fit::config_helpers::DefaultValue}; + float vertexTimeHighThreshold{o2::fit::config_helpers::DefaultValue}; + uint16_t semicentralA{o2::fit::config_helpers::DefaultValue}; + uint16_t semicentralC{o2::fit::config_helpers::DefaultValue}; + uint16_t centralA{o2::fit::config_helpers::DefaultValue}; + uint16_t centralC{o2::fit::config_helpers::DefaultValue}; }; -struct Ft0FeeConfiguration : o2::conf::ConfigurableParamHelper { - static constexpr int NChannels = 212; - TriggersConfig triggers; - o2::fit::ChannelsConfig channels; - o2::fit::TcmConfig tcm; - o2::fit::PmConfig pmA[10]; - o2::fit::PmConfig pmC[10]; - O2ParamDef(Ft0FeeConfiguration, "Ft0FeeConfiguration"); +struct Ft0FeeConfiguration { + static constexpr int NChannels = 212; + TriggersConfig triggers; + o2::fit::ChannelsConfig channels; + o2::fit::TcmConfig tcm; + o2::fit::PmConfig pmA[10]; + o2::fit::PmConfig pmC[10]; + ClassDefNV(Ft0FeeConfiguration, 1); }; -} +} // namespace o2::ft0 #endif \ No newline at end of file diff --git a/DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h b/DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h index 7f8c17a0cd191..411e069957646 100644 --- a/DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h +++ b/DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h @@ -57,5 +57,5 @@ #pragma link C++ class o2::ft0::SlewingCoef + ; #pragma link C++ class o2::ft0::EventsPerBc + ; - +#pragma link C++ class o2::ft0::Ft0FeeConfiguration + ; #endif diff --git a/DataFormats/Detectors/FIT/FT0/src/FeeConfiguration.cxx b/DataFormats/Detectors/FIT/FT0/src/FeeConfiguration.cxx deleted file mode 100644 index 43170f7ec76cd..0000000000000 --- a/DataFormats/Detectors/FIT/FT0/src/FeeConfiguration.cxx +++ /dev/null @@ -1,3 +0,0 @@ -#include "DataFormatsFT0/FeeConfiguration.hxx" - -O2ParamImpl(o2::ft0::Ft0FeeConfiguration); \ No newline at end of file diff --git a/Detectors/FIT/FT0/dcsmonitoring/CMakeLists.txt b/Detectors/FIT/FT0/dcsmonitoring/CMakeLists.txt index 437ff9f66de3e..15ded29c3195d 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/CMakeLists.txt +++ b/Detectors/FIT/FT0/dcsmonitoring/CMakeLists.txt @@ -11,7 +11,7 @@ o2_add_library(FT0DCSMonitoring SOURCES src/FT0DCSDataProcessor.cxx src/FT0DcsConfigReader.cxx - PUBLIC_LINK_LIBRARIES O2::FITDCSMonitoring) + PUBLIC_LINK_LIBRARIES O2::FITDCSMonitoring O2::DataFormatsFT0) o2_target_root_dictionary(FT0DCSMonitoring HEADERS include/FT0DCSMonitoring/FT0DCSConfigReader.h) diff --git a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DcsConfigReader.cxx b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DcsConfigReader.cxx index a87f537729d02..73eab55b81651 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DcsConfigReader.cxx +++ b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DcsConfigReader.cxx @@ -1,60 +1,68 @@ #include "FT0DCSMonitoring/FT0DCSConfigReader.h" #include +#include -namespace { -template -bool parseJsonArray(const rapidjson::Value& node, const char* childName, T (&array)[Size]) { - if(node.HasMember(childName) == false) { - throw std::runtime_error(std::string("Failed to find node of name ") + childName); +namespace +{ +template +bool parseJsonArray(const rapidjson::Value& node, const char* childName, T (&array)[Size]) +{ + if (node.HasMember(childName) == false) { + throw std::runtime_error(std::string("Failed to find node of name ") + childName); + } + const auto& childNode = node[childName]; + if (childNode.IsArray() == false) { + throw std::runtime_error(std::format("Node {} is not an array!", childName)); + } + auto jsonArray = childNode.GetArray(); + if (jsonArray.Size() != Size) { + throw std::runtime_error(std::format("Expected array of size {}, parsed array of size {}", Size, jsonArray.Size())); + } + for (int idx = 0; idx < Size; idx++) { + const auto& node = jsonArray[idx]; + if constexpr (std::is_same_v) { + if (!node.IsBool()) + return false; + array[idx] = node.GetBool(); + } else if constexpr (std::is_floating_point_v) { + if (!node.IsNumber()) + return false; + array[idx] = node.GetFloat(); + } else if constexpr (std::is_integral_v && std::is_unsigned_v) { + if (!node.IsUint()) + return false; + array[idx] = static_cast(node.GetUint()); + } else if constexpr (std::is_integral_v) { + if (!node.IsInt()) + return false; + array[idx] = static_cast(node.GetInt()); + } else { + static_assert(std::is_same_v, "Unsupported type"); } - auto childNode = node[childName]; - if (childNode.IsArray() == false) { - throw std::runtime_error(std::format("Node {} is not an array!", childName)); - } - auto jsonArray = childNode.GetArray(); - if(jsonArray.Size() != Size) { - throw std::runtime_error(std::format("Expected array of size {}, parsed array of size {}", Size, jsonArray.Size())); - } - for(int idx = 0; idx < Size; idx++) { - const auto& node = jsonArray[idx]; - if constexpr (std::is_same_v) { - if (!node.IsBool()) return false; - array[idx] = node.GetBool(); - } else if constexpr (std::is_floating_point_v>) { - if (!node.IsNumber()) return false; - array[idx] = node.GetFloat(); - } else if constexpr (std::is_integral_v && std::is_unsigned_v) { - if (!node.IsUint()) return false; - array[idx] = static_cast(node.GetUint()); - } else if constexpr (std::is_integral_v) { - if (!node.IsInt()) return false; - array[idx] = static_cast(node.GetInt()); - } else { - static_assert(std::is_same_v, "Unsupported type"); - } - } - return true; + } + return true; } -} - -namespace o2::ft0 { -Ft0FeeConfiguration FT0DCSConfigReader::parseFeeConfiguration(gsl::span buffer) { - Ft0FeeConfiguration configuration; - rapidjson::MemoryStream ms(buffer.data(), buffer.size()); - rapidjson::Document document; - document.ParseStream(ms); +} // namespace - if(document.HasMember("channels") == false) { +namespace o2::ft0 +{ +Ft0FeeConfiguration FT0DCSConfigReader::parseFeeConfiguration(gsl::span buffer) +{ + Ft0FeeConfiguration configuration; + rapidjson::MemoryStream ms(buffer.data(), buffer.size()); + rapidjson::Document document; + document.ParseStream(ms); - } - const auto& channels = document["channels"]; - auto timeAligments = channels["timeAligments"]; - parseJsonArray(channels, "timeAligments", configuration.channels.timeAligments); - parseJsonArray(channels, "cfdThresholds", configuration.channels.cfdThresholds); - parseJsonArray(channels, "cfdZeros", configuration.channels.cfdZeros); - parseJsonArray(channels, "adcZeros", configuration.channels.adcZeros); - parseJsonArray(channles, "adcDelays", configuration.channels.adcDelays); - parseJsonArray(channels, "channelMaskData", configuration.channels.channelMaskData); - parseJsonArray(channels, "channelMaskTriggers", configuration.channels.channelMaskTriggers); + if (document.HasMember("channels") == false) { + } + const auto& channels = document["channels"]; + const auto& timeAligments = channels["timeAligments"]; + parseJsonArray(channels, "timeAligments", configuration.channels.timeAligments); + parseJsonArray(channels, "cfdThresholds", configuration.channels.cfdThresholds); + parseJsonArray(channels, "cfdZeros", configuration.channels.cfdZeros); + parseJsonArray(channels, "adcZeros", configuration.channels.adcZeros); + parseJsonArray(channels, "adcDelays", configuration.channels.adcDelays); + parseJsonArray(channels, "channelMaskData", configuration.channels.channelMaskData); + parseJsonArray(channels, "channelMaskTriggers", configuration.channels.channelMaskTriggers); } -} \ No newline at end of file +} // namespace o2::ft0 \ No newline at end of file From 1575a2315907003e132ec1b373e7e03b8c4c2935 Mon Sep 17 00:00:00 2001 From: Wiktor Pierozak Date: Thu, 6 Aug 2026 17:54:05 +0200 Subject: [PATCH 08/28] Created config processors for subdetctors --- .../workflow/FDDDCSConfigProcessorSpec.h | 34 +++++- .../FT0DCSMonitoring/FT0DCSConfigReader.h | 4 +- .../workflow/FT0DCSConfigProcessorSpec.h | 27 ++++- .../workflow/FV0DCSConfigProcessorSpec.h | 34 +++++- .../FIT/common/dcsmonitoring/CMakeLists.txt | 4 +- .../FITDCSConfigProcessorSpec.h | 108 +++++++----------- ...nfigReader.h => FITDeadChannelMapReader.h} | 18 +-- .../dcsmonitoring/src/FITDCSConfigReader.cxx | 75 ------------ .../src/FITDeadChannelMapReader.cxx | 75 ++++++++++++ 9 files changed, 219 insertions(+), 160 deletions(-) rename Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/{FITDCSConfigReader.h => FITDeadChannelMapReader.h} (88%) delete mode 100644 Detectors/FIT/common/dcsmonitoring/src/FITDCSConfigReader.cxx create mode 100644 Detectors/FIT/common/dcsmonitoring/src/FITDeadChannelMapReader.cxx diff --git a/Detectors/FIT/FDD/dcsmonitoring/workflow/FDDDCSConfigProcessorSpec.h b/Detectors/FIT/FDD/dcsmonitoring/workflow/FDDDCSConfigProcessorSpec.h index b2844fc0ac95a..95b3a04e5525a 100644 --- a/Detectors/FIT/FDD/dcsmonitoring/workflow/FDDDCSConfigProcessorSpec.h +++ b/Detectors/FIT/FDD/dcsmonitoring/workflow/FDDDCSConfigProcessorSpec.h @@ -31,6 +31,38 @@ namespace o2 namespace framework { +class FDDDCSConfigProcessor : public o2::fit::FITDCSConfigProcessor +{ + public: + FDDDCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM) + : o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM) {} + + void init(o2::framework::InitContext& ic) final + { + initDeadChannelMapReader(); + setupDeadChannelMapReader(ic); + } + + void run(o2::framework::ProcessingContext& pc) final + { + long dataTime = getValidityTime(pc); + + gsl::span dataBuffer = pc.inputs().get>("inputConfig"); + std::string configFileName = pc.inputs().get("inputConfigFileName"); + LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); + + if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { + handleDeadChannelMapUpdate(pc,dataTime, dataBuffer); + } else { + LOG(error) << "Unknown input file: " << configFileName; + } + } + + void endOfStream(o2::framework::EndOfStreamContext& ec) final + { + } +}; + DataProcessorSpec getFDDDCSConfigProcessorSpec() { o2::header::DataDescription ddDChM = "FDD_DCHM"; @@ -43,7 +75,7 @@ DataProcessorSpec getFDDDCSConfigProcessorSpec() Inputs{{"inputConfig", o2::header::gDataOriginFDD, "DCS_CONFIG_FILE", Lifetime::Sporadic}, {"inputConfigFileName", o2::header::gDataOriginFDD, "DCS_CONFIG_NAME", Lifetime::Sporadic}}, outputs, - AlgorithmSpec{adaptFromTask("FDD", ddDChM)}, + AlgorithmSpec{adaptFromTask("FDD", ddDChM)}, Options{{"use-verbose-mode", VariantType::Bool, false, {"Use verbose mode"}}, {"filename-dchm", VariantType::String, "FDD-deadchannels.txt", {"Dead channel map file name"}}, {"valid-days-dchm", VariantType::UInt32, 180u, {"Dead channel map validity in days"}}, diff --git a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigReader.h b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigReader.h index 336660aa03a18..ddfc573d0a3e0 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigReader.h +++ b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigReader.h @@ -17,7 +17,7 @@ #ifndef O2_FT0_DCSCONFIGREADER_H #define O2_FT0_DCSCONFIGREADER_H -#include "FITDCSMonitoring/FITDCSConfigReader.h" +#include "FITDCSMonitoring/FITDeadChannelMapReader.h" #include "Rtypes.h" #include "DataFormatsFT0/FeeConfiguration.h" @@ -27,7 +27,7 @@ namespace ft0 { /// DCS configuration reader for FT0 -class FT0DCSConfigReader : public o2::fit::FITDCSConfigReader +class FT0DCSConfigReader : public o2::fit::FITDeadChannelMapReader { public: Ft0FeeConfiguration parseFeeConfiguration(gsl::span configBuf); diff --git a/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h b/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h index fe6701344530b..5e61491a5d14a 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h +++ b/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h @@ -18,7 +18,6 @@ #define O2_FT0_DCSCONFIGPROCESSOR_H #include "FITDCSMonitoring/FITDCSConfigProcessorSpec.h" -#include "FT0DCSMonitoring/FT0DCSConfigReader.h" #include "DetectorsCalibration/Utils.h" #include "Framework/WorkflowSpec.h" #include "Headers/DataHeader.h" @@ -33,15 +32,33 @@ namespace ft0 class FT0DCSConfigProcessor : public o2::fit::FITDCSConfigProcessor { - // Example of how to use another DCS config reader (subclass of o2::fit::FITDCSConfigReader) public: FT0DCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM) : o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM) {} - protected: - void initDCSConfigReader() override + void init(o2::framework::InitContext& ic) final + { + initDeadChannelMapReader(); + setupDeadChannelMapReader(ic); + } + + void run(o2::framework::ProcessingContext& pc) final + { + long dataTime = getValidityTime(pc); + + gsl::span dataBuffer = pc.inputs().get>("inputConfig"); + std::string configFileName = pc.inputs().get("inputConfigFileName"); + LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); + + if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { + handleDeadChannelMapUpdate(pc,dataTime, dataBuffer); + } else { + LOG(error) << "Unknown input file: " << configFileName; + } + } + + void endOfStream(o2::framework::EndOfStreamContext& ec) final { - mDCSConfigReader = std::make_unique(FT0DCSConfigReader()); } }; diff --git a/Detectors/FIT/FV0/dcsmonitoring/workflow/FV0DCSConfigProcessorSpec.h b/Detectors/FIT/FV0/dcsmonitoring/workflow/FV0DCSConfigProcessorSpec.h index 7c5a888312713..df95e11a81d82 100644 --- a/Detectors/FIT/FV0/dcsmonitoring/workflow/FV0DCSConfigProcessorSpec.h +++ b/Detectors/FIT/FV0/dcsmonitoring/workflow/FV0DCSConfigProcessorSpec.h @@ -31,6 +31,38 @@ namespace o2 namespace framework { +class FV0DCSConfigProcessor : public o2::fit::FITDCSConfigProcessor +{ + public: + FV0DCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM) + : o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM) {} + + void init(o2::framework::InitContext& ic) final + { + initDeadChannelMapReader(); + setupDeadChannelMapReader(ic); + } + + void run(o2::framework::ProcessingContext& pc) final + { + long dataTime = getValidityTime(pc); + + gsl::span dataBuffer = pc.inputs().get>("inputConfig"); + std::string configFileName = pc.inputs().get("inputConfigFileName"); + LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); + + if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { + handleDeadChannelMapUpdate(pc,dataTime, dataBuffer); + } else { + LOG(error) << "Unknown input file: " << configFileName; + } + } + + void endOfStream(o2::framework::EndOfStreamContext& ec) final + { + } +}; + DataProcessorSpec getFV0DCSConfigProcessorSpec() { o2::header::DataDescription ddDChM = "FV0_DCHM"; @@ -43,7 +75,7 @@ DataProcessorSpec getFV0DCSConfigProcessorSpec() Inputs{{"inputConfig", o2::header::gDataOriginFV0, "DCS_CONFIG_FILE", Lifetime::Sporadic}, {"inputConfigFileName", o2::header::gDataOriginFV0, "DCS_CONFIG_NAME", Lifetime::Sporadic}}, outputs, - AlgorithmSpec{adaptFromTask("FV0", ddDChM)}, + AlgorithmSpec{adaptFromTask("FV0", ddDChM)}, Options{{"use-verbose-mode", VariantType::Bool, false, {"Use verbose mode"}}, {"filename-dchm", VariantType::String, "FV0-deadchannels.txt", {"Dead channel map file name"}}, {"valid-days-dchm", VariantType::UInt32, 180u, {"Dead channel map validity in days"}}, diff --git a/Detectors/FIT/common/dcsmonitoring/CMakeLists.txt b/Detectors/FIT/common/dcsmonitoring/CMakeLists.txt index 7bc0820e77a00..7410d93b06976 100644 --- a/Detectors/FIT/common/dcsmonitoring/CMakeLists.txt +++ b/Detectors/FIT/common/dcsmonitoring/CMakeLists.txt @@ -10,9 +10,9 @@ # or submit itself to any jurisdiction. o2_add_library(FITDCSMonitoring - SOURCES src/FITDCSConfigReader.cxx - src/FITDCSDataProcessor.cxx + SOURCES src/FITDCSDataProcessor.cxx src/FITDCSDataReader.cxx + src/FITDeadChannelMapReader.cxx PUBLIC_LINK_LIBRARIES O2::DataFormatsFIT O2::DetectorsCalibration O2::DetectorsDCS) diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h index 18c0b593b0a02..90b29d3406754 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h @@ -19,7 +19,7 @@ #include "CCDB/CcdbApi.h" #include "DetectorsCalibration/Utils.h" -#include "FITDCSMonitoring/FITDCSConfigReader.h" +#include "FITDCSMonitoring/FITDeadChannelMapReader.h" #include "Framework/ConfigParamRegistry.h" #include "Framework/Task.h" #include "Framework/WorkflowSpec.h" @@ -44,92 +44,68 @@ class FITDCSConfigProcessor : public o2::framework::Task : mDetectorName(detectorName), mDataDescriptionDChM(dataDescriptionDChM) {} // TODO AM: how to pass dd - void init(o2::framework::InitContext& ic) final + protected: + /// Initializes the DCS config reader. + /// Can be overriden in case another reader (subclass of o2::fit::FITDeadChannelMapReader) is needed. + virtual void initDeadChannelMapReader() { - initDCSConfigReader(); - mDCSConfigReader->setFileNameDChM(ic.options().get("filename-dchm")); - mDCSConfigReader->setValidDaysDChM(ic.options().get("valid-days-dchm")); - mDCSConfigReader->setCcdbPathDChM(mDetectorName + "/Calib/DeadChannelMap"); - mVerbose = ic.options().get("use-verbose-mode"); - mDCSConfigReader->setVerboseMode(mVerbose); - mValidateUpload = !ic.options().get("no-validate"); - mDCSConfigReader->setValidateUploadMode(mValidateUpload); - - LOG(info) << "Verbose mode: " << mVerbose; - LOG(info) << "Validate upload: " << mValidateUpload; - LOG(info) << "Expected dead channel map file name: " << mDCSConfigReader->getFileNameDChM(); - LOG(info) << "Dead channel maps will be valid for " << mDCSConfigReader->getValidDaysDChM() << " days"; + mDeadChannelMapReader = std::make_unique(FITDeadChannelMapReader()); } - void run(o2::framework::ProcessingContext& pc) final - { - // Get the time of the data - auto timeNow = std::chrono::high_resolution_clock::now(); + long getValidityTime(o2::framework::ProcessingContext& pc) { long dataTime = (long)(pc.services().get().creation); - if (dataTime == 0xffffffffffffffff) { // means it is not set - dataTime = std::chrono::duration_cast(timeNow.time_since_epoch()).count(); // in ms + if (dataTime == 0xffffffffffffffff) { // means it is not set + dataTime = std::chrono::duration_cast(std::chrono::high_resolution_clock::now().time_since_epoch()).count(); // in ms } - - // Get the input file - gsl::span configBuf = pc.inputs().get>("inputConfig"); - std::string configFileName = pc.inputs().get("inputConfigFileName"); - LOG(info) << "Got input file " << configFileName << " of size " << configBuf.size(); - - if (!configFileName.compare(mDCSConfigReader->getFileNameDChM())) { - // Got dead channel map - processDChM(dataTime, configBuf); - sendDChMOutput(pc.outputs()); - mDCSConfigReader->resetStartValidityDChM(); - mDCSConfigReader->resetDChM(); - } else { - LOG(error) << "Unknown input file: " << configFileName; - } - } - - void endOfStream(o2::framework::EndOfStreamContext& ec) final - { + return dataTime; + } + + void setupDeadChannelMapReader(o2::framework::InitContext& ic) { + mDeadChannelMapReader->setFileNameDChM(ic.options().get("filename-dchm")); + mDeadChannelMapReader->setValidDaysDChM(ic.options().get("valid-days-dchm")); + mDeadChannelMapReader->setCcdbPathDChM(mDetectorName + "/Calib/DeadChannelMap"); + bool verbose = ic.options().get("use-verbose-mode"); + mDeadChannelMapReader->setVerboseMode(verbose); + bool validateUpload = !ic.options().get("no-validate"); + mDeadChannelMapReader->setValidateUploadMode(validateUpload); + + LOG(info) << "Verbose mode: " << verbose; + LOG(info) << "Validate upload: " << validateUpload; + LOG(info) << "Expected dead channel map file name: " << mDeadChannelMapReader->getFileNameDChM(); + LOG(info) << "Dead channel maps will be valid for " << mDeadChannelMapReader->getValidDaysDChM() << " days"; } - protected: - /// Initializes the DCS config reader. - /// Can be overriden in case another reader (subclass of o2::fit::FITDCSConfigReader) is needed. - virtual void initDCSConfigReader() - { - mDCSConfigReader = std::make_unique(FITDCSConfigReader()); + void handleDeadChannelMapUpdate(o2::framework::ProcessingContext& pc, long dataTime, gsl::span dataBuffer) { + processDeadChannelMap(dataTime, dataBuffer); + sendObject(pc.outputs(), mDeadChannelMapReader->getDChM(), mDeadChannelMapReader->getObjectInfoDChM(), mDataDescriptionDChM); + mDeadChannelMapReader->resetStartValidityDChM(); + mDeadChannelMapReader->resetDChM(); } - std::unique_ptr mDCSConfigReader; ///< Reader for the DCS configurations - - private: /// Processing the dead channel map - void processDChM(const long& dataTime, gsl::span configBuf) + void processDeadChannelMap(const long& dataTime, gsl::span dataBuffer) { - if (!mDCSConfigReader->isStartValidityDChMSet()) { - if (mVerbose) { - LOG(info) << "Start validity for DCS data set to = " << dataTime; - } - mDCSConfigReader->setStartValidityDChM(dataTime); + if (!mDeadChannelMapReader->isStartValidityDChMSet()) { + mDeadChannelMapReader->setStartValidityDChM(dataTime); } - mDCSConfigReader->processDChM(configBuf); - mDCSConfigReader->updateDChMCcdbObjectInfo(); + mDeadChannelMapReader->processDChM(dataBuffer); + mDeadChannelMapReader->updateDChMCcdbObjectInfo(); } - /// Sending the dead channeel map output to CCDB - void sendDChMOutput(o2::framework::DataAllocator& output) + template + void sendObject(o2::framework::DataAllocator& output, const ConfigObjectType& object, o2::ccdb::CcdbObjectInfo& info, const o2::header::DataDescription& descriptor) { - const auto& payload = mDCSConfigReader->getDChM(); - auto& info = mDCSConfigReader->getObjectInfoDChM(); - auto image = o2::ccdb::CcdbApi::createObjectImage(&payload, &info); + auto image = o2::ccdb::CcdbApi::createObjectImage(&object, &info); LOG(info) << "Sending object " << info.getPath() << "/" << info.getFileName() << " of size " << image->size() << " bytes, valid for " << info.getStartValidityTimestamp() << " : " << info.getEndValidityTimestamp(); - output.snapshot(Output{o2::calibration::Utils::gDataOriginCDBPayload, mDataDescriptionDChM, 0}, *image.get()); - output.snapshot(Output{o2::calibration::Utils::gDataOriginCDBWrapper, mDataDescriptionDChM, 0}, info); + output.snapshot(Output{o2::calibration::Utils::gDataOriginCDBPayload, descriptor, 0}, *image.get()); + output.snapshot(Output{o2::calibration::Utils::gDataOriginCDBWrapper, descriptor, 0}, info); } + std::unique_ptr mDeadChannelMapReader; + private: std::string mDetectorName; ///< Detector name o2::header::DataDescription mDataDescriptionDChM; ///< DataDescription for the dead channel map - bool mVerbose = false; ///< Verbose mode - bool mValidateUpload = true; ///< Validate upload }; } // namespace fit diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigReader.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDeadChannelMapReader.h similarity index 88% rename from Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigReader.h rename to Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDeadChannelMapReader.h index c43607e091493..ef3821ddcfb6c 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigReader.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDeadChannelMapReader.h @@ -9,13 +9,13 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file FITDCSConfigReader.h +/// \file FITDeadChannelMapReader.h /// \brief DCS configuration reader for FIT /// /// \author Andreas Molander , University of Jyvaskyla, Finland -#ifndef O2_FIT_DCSCONFIGREADER_H -#define O2_FIT_DCSCONFIGREADER_H +#ifndef O2_FIT_DEAD_CHANNEL_MAP_READER_H +#define O2_FIT_DEAD_CHANNEL_MAP_READER_H #include "CCDB/CcdbObjectInfo.h" #include "DataFormatsFIT/DeadChannelMap.h" @@ -28,11 +28,11 @@ namespace o2 namespace fit { -class FITDCSConfigReader +class FITDeadChannelMapReader { public: - FITDCSConfigReader() = default; - ~FITDCSConfigReader() = default; + FITDeadChannelMapReader() = default; + ~FITDeadChannelMapReader() = default; virtual void processDChM(gsl::span configBuf); void updateDChMCcdbObjectInfo(); @@ -73,10 +73,12 @@ class FITDCSConfigReader o2::ccdb::CcdbObjectInfo mCcdbObjectInfoDChM; ///< CCDB object info for the dead channel map bool mValidateUpload = true; ///< Validate upload mode - ClassDefNV(FITDCSConfigReader, 1); + std::string mFilenameFeeConfig; + + ClassDefNV(FITDeadChannelMapReader, 1); }; } // namespace fit } // namespace o2 -#endif // O2_FIT_DCSCONFIGREADER_H \ No newline at end of file +#endif // O2_FIT_DEAD_CHANNEL_MAP_READER_H \ No newline at end of file diff --git a/Detectors/FIT/common/dcsmonitoring/src/FITDCSConfigReader.cxx b/Detectors/FIT/common/dcsmonitoring/src/FITDCSConfigReader.cxx deleted file mode 100644 index 3540d3a2f33c0..0000000000000 --- a/Detectors/FIT/common/dcsmonitoring/src/FITDCSConfigReader.cxx +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file FITDCSConfigReader.cxx -/// \brief FIT reader for DCS configurations -/// -/// \author Andreas Molander , University of Jyvaskyla, Finland - -#include "FITDCSMonitoring/FITDCSConfigReader.h" - -#include "DetectorsCalibration/Utils.h" - -#include -#include - -using namespace o2::fit; - -void FITDCSConfigReader::processDChM(gsl::span configBuf) -{ - LOG(info) << "Processing dead channel map"; - - // AM: need to specify the size, - // otherwise the configBuf.data() pointer might point to an array that is too long, - // the array sometimes includes "extra memory from previous runs" - std::istringstream iss(std::string(configBuf.data(), configBuf.size())); - uint8_t iLine = 0; // line 0 corresponds to cahnnel id 0 and so on - - for (std::string line; std::getline(iss, line);) { - mDChM.setChannelAlive(iLine, std::stoi(line) == 1); - iLine++; - } - - if (getVerboseMode()) { - LOGP(info, "Processed {} channels", iLine); - } -} - -void FITDCSConfigReader::updateDChMCcdbObjectInfo() -{ - std::map metadata; - o2::calibration::Utils::prepareCCDBobjectInfo(mDChM, mCcdbObjectInfoDChM, mCcdbPathDChM, metadata, getStartValidityDChM(), getEndValidityDChM()); - mCcdbObjectInfoDChM.setValidateUpload(getValidateUploadMode()); -} - -const o2::fit::DeadChannelMap& FITDCSConfigReader::getDChM() const { return mDChM; } -void FITDCSConfigReader::resetDChM() { mDChM.clear(); } -const std::string& FITDCSConfigReader::getCcdbPathDChm() const { return mCcdbPathDChM; } -void FITDCSConfigReader::setCcdbPathDChM(const std::string& ccdbPath) { mCcdbPathDChM = ccdbPath; } -const long FITDCSConfigReader::getStartValidityDChM() const { return mStartValidityDChM; } -const long FITDCSConfigReader::getEndValidityDChM() const { return mStartValidityDChM + getValidDaysDChM() * o2::ccdb::CcdbObjectInfo::DAY; } -void FITDCSConfigReader::setStartValidityDChM(const long startValidity) { mStartValidityDChM = startValidity; } -const bool FITDCSConfigReader::isStartValidityDChMSet() const { return mStartValidityDChM != o2::ccdb::CcdbObjectInfo::INFINITE_TIMESTAMP; } -void FITDCSConfigReader::resetStartValidityDChM() { mStartValidityDChM = o2::ccdb::CcdbObjectInfo::INFINITE_TIMESTAMP; } -const o2::ccdb::CcdbObjectInfo& FITDCSConfigReader::getObjectInfoDChM() const { return mCcdbObjectInfoDChM; } -o2::ccdb::CcdbObjectInfo& FITDCSConfigReader::getObjectInfoDChM() { return mCcdbObjectInfoDChM; } - -const std::string& FITDCSConfigReader::getFileNameDChM() const { return mFileNameDChM; } -void FITDCSConfigReader::setFileNameDChM(const std::string& fileName) { mFileNameDChM = fileName; } - -const uint FITDCSConfigReader::getValidDaysDChM() const { return mValidDaysDChM; } -void FITDCSConfigReader::setValidDaysDChM(const uint validDays) { mValidDaysDChM = validDays; } - -const bool FITDCSConfigReader::getVerboseMode() const { return mVerbose; } -void FITDCSConfigReader::setVerboseMode(const bool verboseMode) { mVerbose = verboseMode; } - -const bool FITDCSConfigReader::getValidateUploadMode() const { return mValidateUpload; } -void FITDCSConfigReader::setValidateUploadMode(const bool validateUpload) { mValidateUpload = validateUpload; }; \ No newline at end of file diff --git a/Detectors/FIT/common/dcsmonitoring/src/FITDeadChannelMapReader.cxx b/Detectors/FIT/common/dcsmonitoring/src/FITDeadChannelMapReader.cxx new file mode 100644 index 0000000000000..a926df10d26ad --- /dev/null +++ b/Detectors/FIT/common/dcsmonitoring/src/FITDeadChannelMapReader.cxx @@ -0,0 +1,75 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file FITDeadChannelMapReader.cxx +/// \brief FIT reader for DCS configurations +/// +/// \author Andreas Molander , University of Jyvaskyla, Finland + +#include "FITDCSMonitoring/FITDeadChannelMapReader.h" + +#include "DetectorsCalibration/Utils.h" + +#include +#include + +using namespace o2::fit; + +void FITDeadChannelMapReader::processDChM(gsl::span configBuf) +{ + LOG(info) << "Processing dead channel map"; + + // AM: need to specify the size, + // otherwise the configBuf.data() pointer might point to an array that is too long, + // the array sometimes includes "extra memory from previous runs" + std::istringstream iss(std::string(configBuf.data(), configBuf.size())); + uint8_t iLine = 0; // line 0 corresponds to cahnnel id 0 and so on + + for (std::string line; std::getline(iss, line);) { + mDChM.setChannelAlive(iLine, std::stoi(line) == 1); + iLine++; + } + + if (getVerboseMode()) { + LOGP(info, "Processed {} channels", iLine); + } +} + +void FITDeadChannelMapReader::updateDChMCcdbObjectInfo() +{ + std::map metadata; + o2::calibration::Utils::prepareCCDBobjectInfo(mDChM, mCcdbObjectInfoDChM, mCcdbPathDChM, metadata, getStartValidityDChM(), getEndValidityDChM()); + mCcdbObjectInfoDChM.setValidateUpload(getValidateUploadMode()); +} + +const o2::fit::DeadChannelMap& FITDeadChannelMapReader::getDChM() const { return mDChM; } +void FITDeadChannelMapReader::resetDChM() { mDChM.clear(); } +const std::string& FITDeadChannelMapReader::getCcdbPathDChm() const { return mCcdbPathDChM; } +void FITDeadChannelMapReader::setCcdbPathDChM(const std::string& ccdbPath) { mCcdbPathDChM = ccdbPath; } +const long FITDeadChannelMapReader::getStartValidityDChM() const { return mStartValidityDChM; } +const long FITDeadChannelMapReader::getEndValidityDChM() const { return mStartValidityDChM + getValidDaysDChM() * o2::ccdb::CcdbObjectInfo::DAY; } +void FITDeadChannelMapReader::setStartValidityDChM(const long startValidity) { mStartValidityDChM = startValidity; } +const bool FITDeadChannelMapReader::isStartValidityDChMSet() const { return mStartValidityDChM != o2::ccdb::CcdbObjectInfo::INFINITE_TIMESTAMP; } +void FITDeadChannelMapReader::resetStartValidityDChM() { mStartValidityDChM = o2::ccdb::CcdbObjectInfo::INFINITE_TIMESTAMP; } +const o2::ccdb::CcdbObjectInfo& FITDeadChannelMapReader::getObjectInfoDChM() const { return mCcdbObjectInfoDChM; } +o2::ccdb::CcdbObjectInfo& FITDeadChannelMapReader::getObjectInfoDChM() { return mCcdbObjectInfoDChM; } + +const std::string& FITDeadChannelMapReader::getFileNameDChM() const { return mFileNameDChM; } +void FITDeadChannelMapReader::setFileNameDChM(const std::string& fileName) { mFileNameDChM = fileName; } + +const uint FITDeadChannelMapReader::getValidDaysDChM() const { return mValidDaysDChM; } +void FITDeadChannelMapReader::setValidDaysDChM(const uint validDays) { mValidDaysDChM = validDays; } + +const bool FITDeadChannelMapReader::getVerboseMode() const { return mVerbose; } +void FITDeadChannelMapReader::setVerboseMode(const bool verboseMode) { mVerbose = verboseMode; } + +const bool FITDeadChannelMapReader::getValidateUploadMode() const { return mValidateUpload; } +void FITDeadChannelMapReader::setValidateUploadMode(const bool validateUpload) { mValidateUpload = validateUpload; }; \ No newline at end of file From 967fe04e1fcf181473e61fd47d7b2b0b5f29417c Mon Sep 17 00:00:00 2001 From: Wiktor Pierozak Date: Thu, 6 Aug 2026 18:28:22 +0200 Subject: [PATCH 09/28] Moved FT0DCSConfigProcessor to seperate file --- .../FIT/FT0/dcsmonitoring/CMakeLists.txt | 2 +- .../FT0DCSMonitoring/FT0DCSConfigProcessor.h | 25 +++++++++ .../src/FT0DCSConfigProcessor.cxx | 28 ++++++++++ .../workflow/FT0DCSConfigProcessorSpec.h | 51 ++----------------- .../FIT/common/dcsmonitoring/CMakeLists.txt | 3 +- .../FITDCSConfigProcessorSpec.h | 6 +-- .../FITDeadChannelMapReader.h | 2 - .../src/FITDCSMonitoringLinkDef.h | 2 - 8 files changed, 62 insertions(+), 57 deletions(-) create mode 100644 Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigProcessor.h create mode 100644 Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx diff --git a/Detectors/FIT/FT0/dcsmonitoring/CMakeLists.txt b/Detectors/FIT/FT0/dcsmonitoring/CMakeLists.txt index 15ded29c3195d..f2ff1aaf4acd9 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/CMakeLists.txt +++ b/Detectors/FIT/FT0/dcsmonitoring/CMakeLists.txt @@ -10,7 +10,7 @@ # or submit itself to any jurisdiction. o2_add_library(FT0DCSMonitoring - SOURCES src/FT0DCSDataProcessor.cxx src/FT0DcsConfigReader.cxx + SOURCES src/FT0DCSDataProcessor.cxx src/FT0DcsConfigReader.cxx src/FT0DCSConfigProcessor.cxx PUBLIC_LINK_LIBRARIES O2::FITDCSMonitoring O2::DataFormatsFT0) o2_target_root_dictionary(FT0DCSMonitoring diff --git a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigProcessor.h b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigProcessor.h new file mode 100644 index 0000000000000..7dae935c996cc --- /dev/null +++ b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigProcessor.h @@ -0,0 +1,25 @@ +#ifndef O2_FT0_DCSCONFIGPROCESSOR_H +#define O2_FT0_DCSCONFIGPROCESSOR_H + +#include "FITDCSMonitoring/FITDCSConfigProcessorSpec.h" +#include "DetectorsCalibration/Utils.h" +#include "Framework/WorkflowSpec.h" +#include "Headers/DataHeader.h" + +#include +#include + +namespace o2::ft0 +{ +class FT0DCSConfigProcessor : public o2::fit::FITDCSConfigProcessor +{ + public: + FT0DCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM) + : o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM) {} + + void init(o2::framework::InitContext& ic) final; + void run(o2::framework::ProcessingContext& pc) final; + void endOfStream(o2::framework::EndOfStreamContext& ec) final; +}; +} +#endif // O2_FT0_DCSCONFIGPROCESSOR_H \ No newline at end of file diff --git a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx new file mode 100644 index 0000000000000..04a58ffa5cf71 --- /dev/null +++ b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx @@ -0,0 +1,28 @@ +#include "FT0DCSMonitoring/FT0DCSConfigProcessor.h" + +namespace o2::ft0 { +void FT0DCSConfigProcessor::init(o2::framework::InitContext& ic) +{ + initDeadChannelMapReader(); + setupDeadChannelMapReader(ic); +} + +void FT0DCSConfigProcessor::run(o2::framework::ProcessingContext& pc) +{ + long dataTime = getValidityTime(pc); + + gsl::span dataBuffer = pc.inputs().get>("inputConfig"); + std::string configFileName = pc.inputs().get("inputConfigFileName"); + LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); + + if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { + handleDeadChannelMapUpdate(pc,dataTime, dataBuffer); + } else { + LOG(error) << "Unknown input file: " << configFileName; + } +} + +void FT0DCSConfigProcessor::endOfStream(o2::framework::EndOfStreamContext& ec) +{ +} +} \ No newline at end of file diff --git a/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h b/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h index 5e61491a5d14a..727a0297344d9 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h +++ b/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h @@ -14,10 +14,10 @@ /// /// \author Andreas Molander , University of Jyvaskyla, Finland -#ifndef O2_FT0_DCSCONFIGPROCESSOR_H -#define O2_FT0_DCSCONFIGPROCESSOR_H +#ifndef O2_FT0_DCSCONFIGPROCESSOR_SPEC_H +#define O2_FT0_DCSCONFIGPROCESSOR_SPEC_H -#include "FITDCSMonitoring/FITDCSConfigProcessorSpec.h" +#include "FT0DCSMonitoring/FT0DCSConfigProcessor.h" #include "DetectorsCalibration/Utils.h" #include "Framework/WorkflowSpec.h" #include "Headers/DataHeader.h" @@ -25,48 +25,8 @@ #include #include -namespace o2 +namespace o2::framework { -namespace ft0 -{ - -class FT0DCSConfigProcessor : public o2::fit::FITDCSConfigProcessor -{ - public: - FT0DCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM) - : o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM) {} - - void init(o2::framework::InitContext& ic) final - { - initDeadChannelMapReader(); - setupDeadChannelMapReader(ic); - } - - void run(o2::framework::ProcessingContext& pc) final - { - long dataTime = getValidityTime(pc); - - gsl::span dataBuffer = pc.inputs().get>("inputConfig"); - std::string configFileName = pc.inputs().get("inputConfigFileName"); - LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); - - if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { - handleDeadChannelMapUpdate(pc,dataTime, dataBuffer); - } else { - LOG(error) << "Unknown input file: " << configFileName; - } - } - - void endOfStream(o2::framework::EndOfStreamContext& ec) final - { - } -}; - -} // namespace ft0 - -namespace framework -{ - DataProcessorSpec getFT0DCSConfigProcessorSpec() { o2::header::DataDescription ddDChM = "FT0_DCHM"; @@ -87,6 +47,5 @@ DataProcessorSpec getFT0DCSConfigProcessorSpec() } } // namespace framework -} // namespace o2 -#endif // O2_FT0_DCSCONFIGPROCESSOR_H +#endif // O2_FT0_DCSCONFIGPROCESSOR_SPEC_H diff --git a/Detectors/FIT/common/dcsmonitoring/CMakeLists.txt b/Detectors/FIT/common/dcsmonitoring/CMakeLists.txt index 7410d93b06976..b76269805330f 100644 --- a/Detectors/FIT/common/dcsmonitoring/CMakeLists.txt +++ b/Detectors/FIT/common/dcsmonitoring/CMakeLists.txt @@ -19,5 +19,4 @@ o2_add_library(FITDCSMonitoring # TODO AM: remove include/FITDCSMonitoring/FITDCSDataReader.h when dictionaries are created in DataFormatsFIT instead o2_target_root_dictionary(FITDCSMonitoring - HEADERS include/FITDCSMonitoring/FITDCSConfigReader.h - include/FITDCSMonitoring/FITDCSDataReader.h) + HEADERS include/FITDCSMonitoring/FITDCSDataReader.h) diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h index 90b29d3406754..6c977daa5ae89 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h @@ -30,8 +30,6 @@ #include #include -using namespace o2::framework; - namespace o2 { namespace fit @@ -98,8 +96,8 @@ class FITDCSConfigProcessor : public o2::framework::Task auto image = o2::ccdb::CcdbApi::createObjectImage(&object, &info); LOG(info) << "Sending object " << info.getPath() << "/" << info.getFileName() << " of size " << image->size() << " bytes, valid for " << info.getStartValidityTimestamp() << " : " << info.getEndValidityTimestamp(); - output.snapshot(Output{o2::calibration::Utils::gDataOriginCDBPayload, descriptor, 0}, *image.get()); - output.snapshot(Output{o2::calibration::Utils::gDataOriginCDBWrapper, descriptor, 0}, info); + output.snapshot(o2::framework::Output{o2::calibration::Utils::gDataOriginCDBPayload, descriptor, 0}, *image.get()); + output.snapshot(o2::framework::Output{o2::calibration::Utils::gDataOriginCDBWrapper, descriptor, 0}, info); } std::unique_ptr mDeadChannelMapReader; diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDeadChannelMapReader.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDeadChannelMapReader.h index ef3821ddcfb6c..7d3ffb7b583bb 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDeadChannelMapReader.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDeadChannelMapReader.h @@ -74,8 +74,6 @@ class FITDeadChannelMapReader bool mValidateUpload = true; ///< Validate upload mode std::string mFilenameFeeConfig; - - ClassDefNV(FITDeadChannelMapReader, 1); }; } // namespace fit diff --git a/Detectors/FIT/common/dcsmonitoring/src/FITDCSMonitoringLinkDef.h b/Detectors/FIT/common/dcsmonitoring/src/FITDCSMonitoringLinkDef.h index 521673ad062f3..8658965baede6 100644 --- a/Detectors/FIT/common/dcsmonitoring/src/FITDCSMonitoringLinkDef.h +++ b/Detectors/FIT/common/dcsmonitoring/src/FITDCSMonitoringLinkDef.h @@ -16,8 +16,6 @@ #pragma link off all functions; #pragma link C++ std::unordered_map < uint8_t, bool> + ; -#pragma link C++ struct o2::fit::DeadChannelMap + ; - // TODO AM: Move this to DataFormatsFIT when unused class warning is solved. #pragma link C++ class std::unordered_map < o2::dcs::DataPointIdentifier, o2::fit::DCSDPValues> + ; From ee61e3d2b56a553e01849cdd5f671ea88d558489 Mon Sep 17 00:00:00 2001 From: Wiktor Pierozak Date: Fri, 7 Aug 2026 09:17:04 +0200 Subject: [PATCH 10/28] Moved FV0 and FDD config processor classes to dedicated headers and source files --- .../FIT/FDD/dcsmonitoring/CMakeLists.txt | 5 ++- .../FDDDCSMonitoring/FDDDCSConfigProcessor.h | 31 ++++++++++++++++ .../src/FDDDCSConfigProcessor.cxx | 28 ++++++++++++++ .../workflow/FDDDCSConfigProcessorSpec.h | 37 +------------------ .../FIT/FV0/dcsmonitoring/CMakeLists.txt | 5 ++- .../FV0DCSMonitoring/FV0DCSConfigProcessor.h | 30 +++++++++++++++ .../src/FV0DCSConfigProcessor.cxx | 28 ++++++++++++++ .../workflow/FV0DCSConfigProcessorSpec.h | 37 +------------------ 8 files changed, 127 insertions(+), 74 deletions(-) create mode 100644 Detectors/FIT/FDD/dcsmonitoring/include/FDDDCSMonitoring/FDDDCSConfigProcessor.h create mode 100644 Detectors/FIT/FDD/dcsmonitoring/src/FDDDCSConfigProcessor.cxx create mode 100644 Detectors/FIT/FV0/dcsmonitoring/include/FV0DCSMonitoring/FV0DCSConfigProcessor.h create mode 100644 Detectors/FIT/FV0/dcsmonitoring/src/FV0DCSConfigProcessor.cxx diff --git a/Detectors/FIT/FDD/dcsmonitoring/CMakeLists.txt b/Detectors/FIT/FDD/dcsmonitoring/CMakeLists.txt index a13227dc90605..11ce378ab3a54 100644 --- a/Detectors/FIT/FDD/dcsmonitoring/CMakeLists.txt +++ b/Detectors/FIT/FDD/dcsmonitoring/CMakeLists.txt @@ -10,7 +10,7 @@ # or submit itself to any jurisdiction. o2_add_library(FDDDCSMonitoring - SOURCES src/FDDDCSDataProcessor.cxx + SOURCES src/FDDDCSDataProcessor.cxx src/FDDDCSConfigProcessor.cxx PUBLIC_LINK_LIBRARIES O2::FITDCSMonitoring) o2_add_executable(dcs-sim-workflow @@ -30,4 +30,5 @@ o2_add_executable(dcs-config-workflow SOURCES workflow/fdd-dcs-config-workflow.cxx PUBLIC_LINK_LIBRARIES O2::DetectorsCalibration O2::FITDCSMonitoring - O2::Framework) + O2::Framework + O2::FDDDCSMonitoring) diff --git a/Detectors/FIT/FDD/dcsmonitoring/include/FDDDCSMonitoring/FDDDCSConfigProcessor.h b/Detectors/FIT/FDD/dcsmonitoring/include/FDDDCSMonitoring/FDDDCSConfigProcessor.h new file mode 100644 index 0000000000000..6a94c80c935a5 --- /dev/null +++ b/Detectors/FIT/FDD/dcsmonitoring/include/FDDDCSMonitoring/FDDDCSConfigProcessor.h @@ -0,0 +1,31 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \author Wiktor Pierożak , AGH University of Krakow, Poland + +#ifndef O2_FDD_DCS_CONFIG_PROCESSOR_H +#define O2_FDD_DCS_CONFIG_PROCESSOR_H + +#include "FITDCSMonitoring/FITDCSConfigProcessorSpec.h" + +namespace o2::fdd { +class FDDDCSConfigProcessor : public o2::fit::FITDCSConfigProcessor +{ + public: + FDDDCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM) + : o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM) {} + + void init(o2::framework::InitContext& ic) final; + void run(o2::framework::ProcessingContext& pc) final; + void endOfStream(o2::framework::EndOfStreamContext& ec) final; +}; +} +#endif \ No newline at end of file diff --git a/Detectors/FIT/FDD/dcsmonitoring/src/FDDDCSConfigProcessor.cxx b/Detectors/FIT/FDD/dcsmonitoring/src/FDDDCSConfigProcessor.cxx new file mode 100644 index 0000000000000..e4533f308119e --- /dev/null +++ b/Detectors/FIT/FDD/dcsmonitoring/src/FDDDCSConfigProcessor.cxx @@ -0,0 +1,28 @@ +#include "FDDDCSMonitoring/FDDDCSConfigProcessor.h" + +namespace o2::fdd { +void FDDDCSConfigProcessor::init(o2::framework::InitContext& ic) +{ + initDeadChannelMapReader(); + setupDeadChannelMapReader(ic); +} + +void FDDDCSConfigProcessor::run(o2::framework::ProcessingContext& pc) +{ + long dataTime = getValidityTime(pc); + + gsl::span dataBuffer = pc.inputs().get>("inputConfig"); + std::string configFileName = pc.inputs().get("inputConfigFileName"); + LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); + + if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { + handleDeadChannelMapUpdate(pc,dataTime, dataBuffer); + } else { + LOG(error) << "Unknown input file: " << configFileName; + } +} + +void FDDDCSConfigProcessor::endOfStream(o2::framework::EndOfStreamContext& ec) +{ +} +} \ No newline at end of file diff --git a/Detectors/FIT/FDD/dcsmonitoring/workflow/FDDDCSConfigProcessorSpec.h b/Detectors/FIT/FDD/dcsmonitoring/workflow/FDDDCSConfigProcessorSpec.h index 95b3a04e5525a..867035d39d765 100644 --- a/Detectors/FIT/FDD/dcsmonitoring/workflow/FDDDCSConfigProcessorSpec.h +++ b/Detectors/FIT/FDD/dcsmonitoring/workflow/FDDDCSConfigProcessorSpec.h @@ -17,7 +17,7 @@ #ifndef O2_FDD_DCSCONFIGPROCESSOR_H #define O2_FDD_DCSCONFIGPROCESSOR_H -#include "FITDCSMonitoring/FITDCSConfigProcessorSpec.h" +#include "FDDDCSMonitoring/FDDDCSConfigProcessor.h" #include "DetectorsCalibration/Utils.h" #include "Framework/WorkflowSpec.h" #include "Headers/DataHeader.h" @@ -30,39 +30,6 @@ namespace o2 namespace framework { - -class FDDDCSConfigProcessor : public o2::fit::FITDCSConfigProcessor -{ - public: - FDDDCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM) - : o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM) {} - - void init(o2::framework::InitContext& ic) final - { - initDeadChannelMapReader(); - setupDeadChannelMapReader(ic); - } - - void run(o2::framework::ProcessingContext& pc) final - { - long dataTime = getValidityTime(pc); - - gsl::span dataBuffer = pc.inputs().get>("inputConfig"); - std::string configFileName = pc.inputs().get("inputConfigFileName"); - LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); - - if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { - handleDeadChannelMapUpdate(pc,dataTime, dataBuffer); - } else { - LOG(error) << "Unknown input file: " << configFileName; - } - } - - void endOfStream(o2::framework::EndOfStreamContext& ec) final - { - } -}; - DataProcessorSpec getFDDDCSConfigProcessorSpec() { o2::header::DataDescription ddDChM = "FDD_DCHM"; @@ -75,7 +42,7 @@ DataProcessorSpec getFDDDCSConfigProcessorSpec() Inputs{{"inputConfig", o2::header::gDataOriginFDD, "DCS_CONFIG_FILE", Lifetime::Sporadic}, {"inputConfigFileName", o2::header::gDataOriginFDD, "DCS_CONFIG_NAME", Lifetime::Sporadic}}, outputs, - AlgorithmSpec{adaptFromTask("FDD", ddDChM)}, + AlgorithmSpec{adaptFromTask("FDD", ddDChM)}, Options{{"use-verbose-mode", VariantType::Bool, false, {"Use verbose mode"}}, {"filename-dchm", VariantType::String, "FDD-deadchannels.txt", {"Dead channel map file name"}}, {"valid-days-dchm", VariantType::UInt32, 180u, {"Dead channel map validity in days"}}, diff --git a/Detectors/FIT/FV0/dcsmonitoring/CMakeLists.txt b/Detectors/FIT/FV0/dcsmonitoring/CMakeLists.txt index 7508e24fc069c..f90431f1972a8 100644 --- a/Detectors/FIT/FV0/dcsmonitoring/CMakeLists.txt +++ b/Detectors/FIT/FV0/dcsmonitoring/CMakeLists.txt @@ -10,7 +10,7 @@ # or submit itself to any jurisdiction. o2_add_library(FV0DCSMonitoring - SOURCES src/FV0DCSDataProcessor.cxx + SOURCES src/FV0DCSDataProcessor.cxx src/FV0DCSConfigProcessor.cxx PUBLIC_LINK_LIBRARIES O2::FITDCSMonitoring) o2_add_executable(dcs-sim-workflow @@ -30,4 +30,5 @@ o2_add_executable(dcs-config-workflow SOURCES workflow/fv0-dcs-config-workflow.cxx PUBLIC_LINK_LIBRARIES O2::DetectorsCalibration O2::FITDCSMonitoring - O2::Framework) + O2::Framework + O2::FV0DCSMonitoring) diff --git a/Detectors/FIT/FV0/dcsmonitoring/include/FV0DCSMonitoring/FV0DCSConfigProcessor.h b/Detectors/FIT/FV0/dcsmonitoring/include/FV0DCSMonitoring/FV0DCSConfigProcessor.h new file mode 100644 index 0000000000000..1b6e69939edfd --- /dev/null +++ b/Detectors/FIT/FV0/dcsmonitoring/include/FV0DCSMonitoring/FV0DCSConfigProcessor.h @@ -0,0 +1,30 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \author Wiktor Pierożak , AGH University of Krakow, Poland + +#ifndef O2_FV0_DCS_CONFIG_PROCESSOR_H +#define O2_FV0_DCS_CONFIG_PROCESSOR_H +#include "FITDCSMonitoring/FITDCSConfigProcessorSpec.h" + +namespace o2::fv0 { +class FV0DCSConfigProcessor : public o2::fit::FITDCSConfigProcessor +{ + public: + FV0DCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM) + : o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM) {} + + void init(o2::framework::InitContext& ic) final; + void run(o2::framework::ProcessingContext& pc) final; + void endOfStream(o2::framework::EndOfStreamContext& ec) final; +}; +} +#endif \ No newline at end of file diff --git a/Detectors/FIT/FV0/dcsmonitoring/src/FV0DCSConfigProcessor.cxx b/Detectors/FIT/FV0/dcsmonitoring/src/FV0DCSConfigProcessor.cxx new file mode 100644 index 0000000000000..404ffdd09369a --- /dev/null +++ b/Detectors/FIT/FV0/dcsmonitoring/src/FV0DCSConfigProcessor.cxx @@ -0,0 +1,28 @@ +#include "FV0DCSMonitoring/FV0DCSConfigProcessor.h" + +namespace o2::fv0 { +void FV0DCSConfigProcessor::init(o2::framework::InitContext& ic) +{ + initDeadChannelMapReader(); + setupDeadChannelMapReader(ic); +} + +void FV0DCSConfigProcessor::run(o2::framework::ProcessingContext& pc) +{ + long dataTime = getValidityTime(pc); + + gsl::span dataBuffer = pc.inputs().get>("inputConfig"); + std::string configFileName = pc.inputs().get("inputConfigFileName"); + LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); + + if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { + handleDeadChannelMapUpdate(pc,dataTime, dataBuffer); + } else { + LOG(error) << "Unknown input file: " << configFileName; + } +} + +void FV0DCSConfigProcessor::endOfStream(o2::framework::EndOfStreamContext& ec) +{ +} +} \ No newline at end of file diff --git a/Detectors/FIT/FV0/dcsmonitoring/workflow/FV0DCSConfigProcessorSpec.h b/Detectors/FIT/FV0/dcsmonitoring/workflow/FV0DCSConfigProcessorSpec.h index df95e11a81d82..6343c1dd9d4f1 100644 --- a/Detectors/FIT/FV0/dcsmonitoring/workflow/FV0DCSConfigProcessorSpec.h +++ b/Detectors/FIT/FV0/dcsmonitoring/workflow/FV0DCSConfigProcessorSpec.h @@ -17,7 +17,7 @@ #ifndef O2_FV0_DCSCONFIGPROCESSOR_H #define O2_FV0_DCSCONFIGPROCESSOR_H -#include "FITDCSMonitoring/FITDCSConfigProcessorSpec.h" +#include "FV0DCSMonitoring/FV0DCSConfigProcessor.h" #include "DetectorsCalibration/Utils.h" #include "Framework/WorkflowSpec.h" #include "Headers/DataHeader.h" @@ -30,39 +30,6 @@ namespace o2 namespace framework { - -class FV0DCSConfigProcessor : public o2::fit::FITDCSConfigProcessor -{ - public: - FV0DCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM) - : o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM) {} - - void init(o2::framework::InitContext& ic) final - { - initDeadChannelMapReader(); - setupDeadChannelMapReader(ic); - } - - void run(o2::framework::ProcessingContext& pc) final - { - long dataTime = getValidityTime(pc); - - gsl::span dataBuffer = pc.inputs().get>("inputConfig"); - std::string configFileName = pc.inputs().get("inputConfigFileName"); - LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); - - if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { - handleDeadChannelMapUpdate(pc,dataTime, dataBuffer); - } else { - LOG(error) << "Unknown input file: " << configFileName; - } - } - - void endOfStream(o2::framework::EndOfStreamContext& ec) final - { - } -}; - DataProcessorSpec getFV0DCSConfigProcessorSpec() { o2::header::DataDescription ddDChM = "FV0_DCHM"; @@ -75,7 +42,7 @@ DataProcessorSpec getFV0DCSConfigProcessorSpec() Inputs{{"inputConfig", o2::header::gDataOriginFV0, "DCS_CONFIG_FILE", Lifetime::Sporadic}, {"inputConfigFileName", o2::header::gDataOriginFV0, "DCS_CONFIG_NAME", Lifetime::Sporadic}}, outputs, - AlgorithmSpec{adaptFromTask("FV0", ddDChM)}, + AlgorithmSpec{adaptFromTask("FV0", ddDChM)}, Options{{"use-verbose-mode", VariantType::Bool, false, {"Use verbose mode"}}, {"filename-dchm", VariantType::String, "FV0-deadchannels.txt", {"Dead channel map file name"}}, {"valid-days-dchm", VariantType::UInt32, 180u, {"Dead channel map validity in days"}}, From 3142db3dfb0cf89eca6cace14cfb3c4c6c56e45e Mon Sep 17 00:00:00 2001 From: Wiktor Pierozak Date: Fri, 7 Aug 2026 11:36:39 +0200 Subject: [PATCH 11/28] Created FT0FeeConfigurationReader class --- .../FIT/FT0/dcsmonitoring/CMakeLists.txt | 5 +- ...igReader.h => FT0FEEConfigurationReader.h} | 16 +- .../src/FT0DCSMonitoringLinkDef.h | 2 - .../dcsmonitoring/src/FT0DcsConfigReader.cxx | 68 --------- .../src/FT0FEEConfigurationReader.cxx | 37 +++++ .../workflow/FT0DCSConfigProcessorSpec.h | 9 +- .../FITFEEConfigurationReader.h | 139 ++++++++++++++++++ 7 files changed, 190 insertions(+), 86 deletions(-) rename Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/{FT0DCSConfigReader.h => FT0FEEConfigurationReader.h} (77%) delete mode 100644 Detectors/FIT/FT0/dcsmonitoring/src/FT0DcsConfigReader.cxx create mode 100644 Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx create mode 100644 Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h diff --git a/Detectors/FIT/FT0/dcsmonitoring/CMakeLists.txt b/Detectors/FIT/FT0/dcsmonitoring/CMakeLists.txt index f2ff1aaf4acd9..287fc5d5fee7a 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/CMakeLists.txt +++ b/Detectors/FIT/FT0/dcsmonitoring/CMakeLists.txt @@ -10,12 +10,9 @@ # or submit itself to any jurisdiction. o2_add_library(FT0DCSMonitoring - SOURCES src/FT0DCSDataProcessor.cxx src/FT0DcsConfigReader.cxx src/FT0DCSConfigProcessor.cxx + SOURCES src/FT0DCSDataProcessor.cxx src/FT0DCSConfigProcessor.cxx src/FT0FEEConfigurationReader.cxx PUBLIC_LINK_LIBRARIES O2::FITDCSMonitoring O2::DataFormatsFT0) -o2_target_root_dictionary(FT0DCSMonitoring - HEADERS include/FT0DCSMonitoring/FT0DCSConfigReader.h) - o2_add_executable(dcs-sim-workflow COMPONENT_NAME ft0 SOURCES workflow/ft0-dcs-sim-workflow.cxx diff --git a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigReader.h b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0FEEConfigurationReader.h similarity index 77% rename from Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigReader.h rename to Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0FEEConfigurationReader.h index ddfc573d0a3e0..8f136642fe493 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigReader.h +++ b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0FEEConfigurationReader.h @@ -17,24 +17,18 @@ #ifndef O2_FT0_DCSCONFIGREADER_H #define O2_FT0_DCSCONFIGREADER_H -#include "FITDCSMonitoring/FITDeadChannelMapReader.h" -#include "Rtypes.h" +#include "FITDCSMonitoring/FITFEEConfigurationReader.h" #include "DataFormatsFT0/FeeConfiguration.h" -namespace o2 -{ -namespace ft0 -{ - -/// DCS configuration reader for FT0 -class FT0DCSConfigReader : public o2::fit::FITDeadChannelMapReader +namespace o2::ft0 { +class FT0FEEConfigurationReader : public o2::fit::FITFEEConfigurationReader { public: Ft0FeeConfiguration parseFeeConfiguration(gsl::span configBuf); - ClassDefNV(FT0DCSConfigReader, 0); + private: + void parseFT0TriggersConfiguration(const rapidjson::Value& root, const char* triggersNodeName, TriggersConfig& config); }; } // namespace ft0 -} // namespace o2 #endif // O2_FT0_DCSCONFIGREADER_H \ No newline at end of file diff --git a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSMonitoringLinkDef.h b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSMonitoringLinkDef.h index 50a9e7f35e25f..c85dd2d378ccb 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSMonitoringLinkDef.h +++ b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSMonitoringLinkDef.h @@ -15,6 +15,4 @@ #pragma link off all classes; #pragma link off all functions; -#pragma link C++ class o2::ft0::FT0DCSConfigReader + ; - #endif diff --git a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DcsConfigReader.cxx b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DcsConfigReader.cxx deleted file mode 100644 index 73eab55b81651..0000000000000 --- a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DcsConfigReader.cxx +++ /dev/null @@ -1,68 +0,0 @@ -#include "FT0DCSMonitoring/FT0DCSConfigReader.h" -#include -#include - -namespace -{ -template -bool parseJsonArray(const rapidjson::Value& node, const char* childName, T (&array)[Size]) -{ - if (node.HasMember(childName) == false) { - throw std::runtime_error(std::string("Failed to find node of name ") + childName); - } - const auto& childNode = node[childName]; - if (childNode.IsArray() == false) { - throw std::runtime_error(std::format("Node {} is not an array!", childName)); - } - auto jsonArray = childNode.GetArray(); - if (jsonArray.Size() != Size) { - throw std::runtime_error(std::format("Expected array of size {}, parsed array of size {}", Size, jsonArray.Size())); - } - for (int idx = 0; idx < Size; idx++) { - const auto& node = jsonArray[idx]; - if constexpr (std::is_same_v) { - if (!node.IsBool()) - return false; - array[idx] = node.GetBool(); - } else if constexpr (std::is_floating_point_v) { - if (!node.IsNumber()) - return false; - array[idx] = node.GetFloat(); - } else if constexpr (std::is_integral_v && std::is_unsigned_v) { - if (!node.IsUint()) - return false; - array[idx] = static_cast(node.GetUint()); - } else if constexpr (std::is_integral_v) { - if (!node.IsInt()) - return false; - array[idx] = static_cast(node.GetInt()); - } else { - static_assert(std::is_same_v, "Unsupported type"); - } - } - return true; -} -} // namespace - -namespace o2::ft0 -{ -Ft0FeeConfiguration FT0DCSConfigReader::parseFeeConfiguration(gsl::span buffer) -{ - Ft0FeeConfiguration configuration; - rapidjson::MemoryStream ms(buffer.data(), buffer.size()); - rapidjson::Document document; - document.ParseStream(ms); - - if (document.HasMember("channels") == false) { - } - const auto& channels = document["channels"]; - const auto& timeAligments = channels["timeAligments"]; - parseJsonArray(channels, "timeAligments", configuration.channels.timeAligments); - parseJsonArray(channels, "cfdThresholds", configuration.channels.cfdThresholds); - parseJsonArray(channels, "cfdZeros", configuration.channels.cfdZeros); - parseJsonArray(channels, "adcZeros", configuration.channels.adcZeros); - parseJsonArray(channels, "adcDelays", configuration.channels.adcDelays); - parseJsonArray(channels, "channelMaskData", configuration.channels.channelMaskData); - parseJsonArray(channels, "channelMaskTriggers", configuration.channels.channelMaskTriggers); -} -} // namespace o2::ft0 \ No newline at end of file diff --git a/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx b/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx new file mode 100644 index 0000000000000..2725cfb661e26 --- /dev/null +++ b/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx @@ -0,0 +1,37 @@ +#include "FT0DCSMonitoring/FT0FEEConfigurationReader.h" +#include +#include + +namespace o2::ft0 +{ +Ft0FeeConfiguration FT0FEEConfigurationReader::parseFeeConfiguration(gsl::span buffer) +{ + Ft0FeeConfiguration configuration; + rapidjson::MemoryStream ms(buffer.data(), buffer.size()); + rapidjson::Document document; + document.ParseStream(ms); + + parseChannelData(document, "channels", configuration.channels); + parseTcmConfig(document, "tcm", configuration.tcm); + parsePmsArray(document, "pm_a", configuration.pmA); + parsePmsArray(document, "pm_c", configuration.pmC); + parseFT0TriggersConfiguration(document, "triggers", configuration.triggers); +} + +void FT0FEEConfigurationReader::parseFT0TriggersConfiguration(const rapidjson::Value& root, const char* triggersNodeName, TriggersConfig& config) { + const auto& triggersNode = root["triggers"]; + const auto& vertexTimeLowThresholdNode = triggersNode["vertex_time_low_threshold"]; + const auto& vertexTimeHighThresholdNode = triggersNode["vertex_time_high_threshold"]; + const auto& semicentralANode = triggersNode["semi_central_a"]; + const auto& semicentralCNode = triggersNode["semi_central_c"]; + const auto& centralANode = triggersNode["central_a"]; + const auto& centralCNode = triggersNode["central_c"]; + + config.vertexTimeLowThreshold = vertexTimeLowThresholdNode.GetInt(); + config.vertexTimeHighThreshold = vertexTimeHighThresholdNode.GetInt(); + config.semicentralA = semicentralANode.GetUint(); + config.semicentralC = semicentralCNode.GetUint(); + config.centralA = centralANode.GetUint(); + config.centralC = centralCNode.GetUint(); +} +} // namespace o2::ft0 \ No newline at end of file diff --git a/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h b/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h index 727a0297344d9..f863b556395be 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h +++ b/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h @@ -34,6 +34,10 @@ DataProcessorSpec getFT0DCSConfigProcessorSpec() outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBPayload, ddDChM}, Lifetime::Sporadic); outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBWrapper, ddDChM}, Lifetime::Sporadic); + o2::header::DataDescription feeConifg = "FT0_FEE_CONFIG"; + outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBPayload, feeConifg}, Lifetime::Sporadic); + outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBWrapper, feeConifg}, Lifetime::Sporadic); + return DataProcessorSpec{ "ft0-dcs-config-processor", Inputs{{"inputConfig", o2::header::gDataOriginFT0, "DCS_CONFIG_FILE", Lifetime::Sporadic}, @@ -43,7 +47,10 @@ DataProcessorSpec getFT0DCSConfigProcessorSpec() Options{{"use-verbose-mode", VariantType::Bool, false, {"Use verbose mode"}}, {"filename-dchm", VariantType::String, "FT0-deadchannels.txt", {"Dead channel map file name"}}, {"valid-days-dchm", VariantType::UInt32, 180u, {"Dead channel map validity in days"}}, - {"no-validate", VariantType::Bool, false, {"Don't validate the CCDB uploads"}}}}; + {"no-validate", VariantType::Bool, false, {"Don't validate the CCDB uploads"}}, + {"filename-fee-config", VariantType::String, "ft0-fee-config.json", {"FEE configuration file name"}} + } + }; } } // namespace framework diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h new file mode 100644 index 0000000000000..cb2714014035c --- /dev/null +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h @@ -0,0 +1,139 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file FITDCSConfigurationDataParser.h +/// \brief DCS configuration reader for FIT +/// +/// \author Andreas Molander , University of Jyvaskyla, Finland + +#ifndef O2_FIT_DCS_CONFIGURATION_DATA_READER_H +#define O2_FIT_DCS_CONFIGURATION_DATA_READER_H + +#include +#include "DataFormatsFIT/Configuration.h" +#include "DetectorsCalibration/Utils.h" + +namespace o2::fit { +class FITFEEConfigurationReader { +public: +template +o2::ccdb::CcdbObjectInfo createObjectInfo(const FeeConfigType& configObject, long startValidityTimestamp, const std::map metadata) { + o2::ccdb::CcdbObjectInfo objectInfo; + o2::calibration::Utils::prepareCCDBobjectInfo(configObject, objectInfo, mCcdbPath, metadata, startValidityTimestamp, o2::ccdb::CcdbObjectInfo::INFINITE_TIMESTAMP); + return objectInfo; +} +void setCcdbPath(const std::string& path) { + mCcdbPath = path; +} +protected: + template + void parseJsonArray(const rapidjson::Value& node, const char* childName, T (&array)[Size]) + { + if (node.HasMember(childName) == false) { + throw std::runtime_error(std::string("Failed to find node of name ") + childName); + } + const auto& childNode = node[childName]; + if (childNode.IsArray() == false) { + throw std::runtime_error(std::format("Node {} is not an array!", childName)); + } + auto jsonArray = childNode.GetArray(); + if (jsonArray.Size() != Size) { + throw std::runtime_error(std::format("Expected array of size {}, parsed array of size {}", Size, jsonArray.Size())); + } + for (int idx = 0; idx < Size; idx++) { + const auto& node = jsonArray[idx]; + if constexpr (std::is_same_v) { + if (!node.IsBool()) { + throw std::runtime_error(std::format("{} is not a bool array", childName)); + } + array[idx] = node.GetBool(); + } else if constexpr (std::is_floating_point_v) { + if (!node.IsNumber()) { + throw std::runtime_error(std::format("{} is not an floating point array", childName)); + } + array[idx] = node.GetFloat(); + } else if constexpr (std::is_integral_v && std::is_unsigned_v) { + if (!node.IsUint() ){ + throw std::runtime_error(std::format("{} is not an unsigned integer array", childName)); + } + array[idx] = static_cast(node.GetUint()); + } else if constexpr (std::is_integral_v) { + if (!node.IsInt()) { + throw std::runtime_error(std::format("{} is not an integer array", childName)); + } + array[idx] = static_cast(node.GetInt()); + } else { + static_assert(std::is_same_v, "Unsupported type"); + } + } + } + + template + void parseChannelData(const rapidjson::Value& root, const char* channelsNodeName, ChannelsConfig& channelsConfiguration) { + const auto& channelsNode = root["channels"]; + parseJsonArray(channelsNode, "time_aligments", channelsConfiguration.timeAligments); + parseJsonArray(channelsNode, "cfd_thresholds", channelsConfiguration.cfdThresholds); + parseJsonArray(channelsNode, "cfd_zeros", channelsConfiguration.cfdZeros); + parseJsonArray(channelsNode, "adc_zeros", channelsConfiguration.adcZeros); + parseJsonArray(channelsNode, "adc_delays", channelsConfiguration.adcDelays); + parseJsonArray(channelsNode, "channel_mask_data", channelsConfiguration.channelMaskData); + parseJsonArray(channelsNode, "channel_mask_triggers", channelsConfiguration.channelMaskTriggers); + } + + void parseTcmConfig(const rapidjson::Value& root, const char* tcmNodeName, TcmConfig& tcmConfig) { + if (!root.HasMember(tcmNodeName)) { + std::runtime_error(std::format("Cannot find {}", tcmNodeName)); + } + const auto& tcmNode = root[tcmNodeName]; + if (!tcmNode.HasMember("phase_delay_a") || !tcmNode.HasMember("phase_delay_c")) { + throw std::runtime_error("Invalid TCM configuration node!"); + } + const auto& phaseDelayANode = tcmNode["phase_delay_a"]; + const auto& phaseDelayCNode = tcmNode["phase_delay_c"]; + tcmConfig.phaseDelayA = phaseDelayANode.GetDouble(); + tcmConfig.phaseDelayC = phaseDelayCNode.GetDouble(); + } + + void parsePmConfig(const rapidjson::Value& pmNode, PmConfig& pmConfig) { + if (!pmNode.HasMember("or_gate")) { + throw std::runtime_error("Invalid PM configuration node"); + } + const auto& orGateNode = pmNode["or_gate"]; + pmConfig.orGate = orGateNode.GetUint(); + } + + template + void parsePmsArray(const rapidjson::Value& root, const char* pmArrayNodeName, PmConfig (&pmConfig)[Size]) { + if(root.HasMember(pmArrayNodeName) == false) { + throw std::runtime_error(std::format("Failed to find {} node", pmArrayNodeName)); + } + const auto& pmArrayNode = root[pmArrayNodeName]; + if(pmArrayNode.IsArray() == false) { + std::runtime_error(std::format("{} node is not an array!", pmArrayNodeName)); + } + const auto& pmArray = pmArrayNode.GetArray(); + if (pmArray.Size() != Size) { + throw std::runtime_error(std::format("Received data for {} PMs, but expected {}", pmArray.Size(), Size)); + } + for(int idx = 0; idx < pmArray.Size(); idx++) { + const auto& pm = pmArray[idx]; + if(pm.IsObject() == false) { + throw std::runtime_error("Encountered non-object element in PM array"); + } + parsePmConfig(pm, pmConfig[idx]); + } + } +private: + std::string mCcdbPath; +}; +} + +#endif \ No newline at end of file From 9323b446571680f2de13a31ebeffb60ccbf85a58 Mon Sep 17 00:00:00 2001 From: Wiktor Pierozak Date: Fri, 7 Aug 2026 13:46:31 +0200 Subject: [PATCH 12/28] Created schema validation for FEE configuration --- .../include/DataFormatsFT0/FeeConfiguration.h | 4 +- .../include/DataFormatsFIT/Configuration.h | 109 +++++----- .../src/FT0FEEConfigurationReader.cxx | 8 +- .../FIT/common/dcsmonitoring/CMakeLists.txt | 1 + .../FITFEEConfigurationReader.h | 201 +++++++++--------- .../src/FITFEEConfigurationReader.cxx | 89 ++++++++ 6 files changed, 258 insertions(+), 154 deletions(-) create mode 100644 Detectors/FIT/common/dcsmonitoring/src/FITFEEConfigurationReader.cxx diff --git a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h index da4954e3bb117..09ff152577c6b 100644 --- a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h +++ b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h @@ -18,8 +18,8 @@ namespace o2::ft0 { struct TriggersConfig { - float vertexTimeLowThreshold{o2::fit::config_helpers::DefaultValue}; - float vertexTimeHighThreshold{o2::fit::config_helpers::DefaultValue}; + int16_t vertexTimeLowThreshold{o2::fit::config_helpers::DefaultValue}; + int16_t vertexTimeHighThreshold{o2::fit::config_helpers::DefaultValue}; uint16_t semicentralA{o2::fit::config_helpers::DefaultValue}; uint16_t semicentralC{o2::fit::config_helpers::DefaultValue}; uint16_t centralA{o2::fit::config_helpers::DefaultValue}; diff --git a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h index df3ca41b55027..bbc8a3c8a5119 100644 --- a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h +++ b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h @@ -22,72 +22,77 @@ #include #include -namespace o2::fit { -namespace config_helpers { +namespace o2::fit +{ +namespace config_helpers +{ struct DefaultValueType { - template - requires std::is_arithmetic_v - constexpr operator T() const noexcept - { - if constexpr (std::is_same_v) { - return false; - } else { - return std::numeric_limits::max(); - } + template + requires std::is_arithmetic_v + constexpr operator T() const noexcept + { + if constexpr (std::is_same_v) { + return false; + } else { + return std::numeric_limits::max(); } + } }; inline constexpr DefaultValueType DefaultValue{}; -template -constexpr void fillDefaultArray(T (&array)[N]) { - for (auto& element : array) { - element = DefaultValue; - } -} +template +constexpr void fillDefaultArray(T (&array)[N]) +{ + for (auto& element : array) { + element = DefaultValue; + } } +} // namespace config_helpers struct TcmConfig { - float phaseDelayA{config_helpers::DefaultValue}; - float phaseDelayC{config_helpers::DefaultValue}; + float phaseDelayA{config_helpers::DefaultValue}; + float phaseDelayC{config_helpers::DefaultValue}; }; -template -struct ChannelsConfig { - float timeAligments[NChannels]{}; - uint16_t cfdThresholds[NChannels]{}; - int16_t cfdZeros[NChannels]{}; - int16_t adcZeros[NChannels]{}; - uint16_t adcDelays[NChannels]{}; - bool channelMaskData[NChannels]{}; - bool channelMaskTriggers[NChannels]{}; +struct PmConfig { + uint8_t orGate{config_helpers::DefaultValue}; +}; - constexpr ChannelsConfig() { - config_helpers::fillDefaultArray(timeAligments); - config_helpers::fillDefaultArray(cfdThresholds); - config_helpers::fillDefaultArray(cfdZeros); - config_helpers::fillDefaultArray(adcZeros); - config_helpers::fillDefaultArray(adcDelays); - config_helpers::fillDefaultArray(channelMaskData); - config_helpers::fillDefaultArray(channelMaskTriggers); - } +template +struct ChannelsConfig { + float timeAligments[NChannels]{}; + uint16_t cfdThresholds[NChannels]{}; + int16_t cfdZeros[NChannels]{}; + int16_t adcZeros[NChannels]{}; + uint16_t adcDelays[NChannels]{}; + bool channelMaskData[NChannels]{}; + bool channelMaskTriggers[NChannels]{}; - template - [[nodiscard]] static constexpr bool isDefault(const T& value) { - return value == static_cast(config_helpers::DefaultValue); - } + constexpr ChannelsConfig() + { + config_helpers::fillDefaultArray(timeAligments); + config_helpers::fillDefaultArray(cfdThresholds); + config_helpers::fillDefaultArray(cfdZeros); + config_helpers::fillDefaultArray(adcZeros); + config_helpers::fillDefaultArray(adcDelays); + config_helpers::fillDefaultArray(channelMaskData); + config_helpers::fillDefaultArray(channelMaskTriggers); + } - gsl::span getTimeAligments() const { return timeAligments; } - gsl::span getCfdThresholds() const { return cfdThresholds; } - gsl::span getCfdZeros() const { return cfdZeros; } - gsl::span getAdcZeros() const { return adcZeros; } - gsl::span getAdcDelays() const { return adcDelays; } - gsl::span getChannelMaskTriggers() const { return channelMaskTriggers; } - gsl::span getChannelMaskData() const { return channelMaskData; } -}; + template + [[nodiscard]] static constexpr bool isDefault(const T& value) + { + return value == static_cast(config_helpers::DefaultValue); + } -struct PmConfig { - uint8_t orGate{config_helpers::DefaultValue}; + gsl::span getTimeAligments() const { return timeAligments; } + gsl::span getCfdThresholds() const { return cfdThresholds; } + gsl::span getCfdZeros() const { return cfdZeros; } + gsl::span getAdcZeros() const { return adcZeros; } + gsl::span getAdcDelays() const { return adcDelays; } + gsl::span getChannelMaskTriggers() const { return channelMaskTriggers; } + gsl::span getChannelMaskData() const { return channelMaskData; } }; -} +} // namespace o2::fit #endif \ No newline at end of file diff --git a/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx b/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx index 2725cfb661e26..e800b6384c19c 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx +++ b/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx @@ -11,6 +11,11 @@ Ft0FeeConfiguration FT0FEEConfigurationReader::parseFeeConfiguration(gsl::span +#include #include "DataFormatsFIT/Configuration.h" #include "DetectorsCalibration/Utils.h" -namespace o2::fit { -class FITFEEConfigurationReader { -public: -template -o2::ccdb::CcdbObjectInfo createObjectInfo(const FeeConfigType& configObject, long startValidityTimestamp, const std::map metadata) { +namespace o2::fit +{ +class FITFEEConfigurationReader +{ + public: + FITFEEConfigurationReader(); + + template + o2::ccdb::CcdbObjectInfo createObjectInfo(const FeeConfigType& configObject, long startValidityTimestamp, const std::map metadata) + { o2::ccdb::CcdbObjectInfo objectInfo; o2::calibration::Utils::prepareCCDBobjectInfo(configObject, objectInfo, mCcdbPath, metadata, startValidityTimestamp, o2::ccdb::CcdbObjectInfo::INFINITE_TIMESTAMP); return objectInfo; -} -void setCcdbPath(const std::string& path) { + } + + void setCcdbPath(const std::string& path) + { mCcdbPath = path; -} -protected: - template - void parseJsonArray(const rapidjson::Value& node, const char* childName, T (&array)[Size]) - { - if (node.HasMember(childName) == false) { - throw std::runtime_error(std::string("Failed to find node of name ") + childName); + } + + protected: + template + void parseJsonArray(const rapidjson::Value& node, const char* childName, T (&array)[Size]) + { + if (node.HasMember(childName) == false) { + throw std::runtime_error(std::string("Failed to find node of name ") + childName); + } + const auto& childNode = node[childName]; + if (childNode.IsArray() == false) { + throw std::runtime_error(std::format("Node {} is not an array!", childName)); + } + auto jsonArray = childNode.GetArray(); + if (jsonArray.Size() != Size) { + throw std::runtime_error(std::format("Expected array of size {}, parsed array of size {}", Size, jsonArray.Size())); + } + for (int idx = 0; idx < Size; idx++) { + const auto& node = jsonArray[idx]; + if constexpr (std::is_same_v) { + if (!node.IsBool()) { + throw std::runtime_error(std::format("{} is not a bool array", childName)); } - const auto& childNode = node[childName]; - if (childNode.IsArray() == false) { - throw std::runtime_error(std::format("Node {} is not an array!", childName)); + array[idx] = node.GetBool(); + } else if constexpr (std::is_floating_point_v) { + if (!node.IsNumber()) { + throw std::runtime_error(std::format("{} is not an floating point array", childName)); } - auto jsonArray = childNode.GetArray(); - if (jsonArray.Size() != Size) { - throw std::runtime_error(std::format("Expected array of size {}, parsed array of size {}", Size, jsonArray.Size())); + array[idx] = node.GetFloat(); + } else if constexpr (std::is_integral_v && std::is_unsigned_v) { + if (!node.IsUint()) { + throw std::runtime_error(std::format("{} is not an unsigned integer array", childName)); } - for (int idx = 0; idx < Size; idx++) { - const auto& node = jsonArray[idx]; - if constexpr (std::is_same_v) { - if (!node.IsBool()) { - throw std::runtime_error(std::format("{} is not a bool array", childName)); - } - array[idx] = node.GetBool(); - } else if constexpr (std::is_floating_point_v) { - if (!node.IsNumber()) { - throw std::runtime_error(std::format("{} is not an floating point array", childName)); - } - array[idx] = node.GetFloat(); - } else if constexpr (std::is_integral_v && std::is_unsigned_v) { - if (!node.IsUint() ){ - throw std::runtime_error(std::format("{} is not an unsigned integer array", childName)); - } - array[idx] = static_cast(node.GetUint()); - } else if constexpr (std::is_integral_v) { - if (!node.IsInt()) { - throw std::runtime_error(std::format("{} is not an integer array", childName)); - } - array[idx] = static_cast(node.GetInt()); - } else { - static_assert(std::is_same_v, "Unsupported type"); - } + array[idx] = static_cast(node.GetUint()); + } else if constexpr (std::is_integral_v) { + if (!node.IsInt()) { + throw std::runtime_error(std::format("{} is not an integer array", childName)); } + array[idx] = static_cast(node.GetInt()); + } else { + static_assert(std::is_same_v, "Unsupported type"); + } } + } - template - void parseChannelData(const rapidjson::Value& root, const char* channelsNodeName, ChannelsConfig& channelsConfiguration) { - const auto& channelsNode = root["channels"]; - parseJsonArray(channelsNode, "time_aligments", channelsConfiguration.timeAligments); - parseJsonArray(channelsNode, "cfd_thresholds", channelsConfiguration.cfdThresholds); - parseJsonArray(channelsNode, "cfd_zeros", channelsConfiguration.cfdZeros); - parseJsonArray(channelsNode, "adc_zeros", channelsConfiguration.adcZeros); - parseJsonArray(channelsNode, "adc_delays", channelsConfiguration.adcDelays); - parseJsonArray(channelsNode, "channel_mask_data", channelsConfiguration.channelMaskData); - parseJsonArray(channelsNode, "channel_mask_triggers", channelsConfiguration.channelMaskTriggers); - } + template + void parseChannelData(const rapidjson::Value& root, const char* channelsNodeName, ChannelsConfig& channelsConfiguration) + { + const auto& channelsNode = root["channels"]; + parseJsonArray(channelsNode, "time_aligments", channelsConfiguration.timeAligments); + parseJsonArray(channelsNode, "cfd_thresholds", channelsConfiguration.cfdThresholds); + parseJsonArray(channelsNode, "cfd_zeros", channelsConfiguration.cfdZeros); + parseJsonArray(channelsNode, "adc_zeros", channelsConfiguration.adcZeros); + parseJsonArray(channelsNode, "adc_delays", channelsConfiguration.adcDelays); + parseJsonArray(channelsNode, "channel_mask_data", channelsConfiguration.channelMaskData); + parseJsonArray(channelsNode, "channel_mask_triggers", channelsConfiguration.channelMaskTriggers); + } - void parseTcmConfig(const rapidjson::Value& root, const char* tcmNodeName, TcmConfig& tcmConfig) { - if (!root.HasMember(tcmNodeName)) { - std::runtime_error(std::format("Cannot find {}", tcmNodeName)); - } - const auto& tcmNode = root[tcmNodeName]; - if (!tcmNode.HasMember("phase_delay_a") || !tcmNode.HasMember("phase_delay_c")) { - throw std::runtime_error("Invalid TCM configuration node!"); - } - const auto& phaseDelayANode = tcmNode["phase_delay_a"]; - const auto& phaseDelayCNode = tcmNode["phase_delay_c"]; - tcmConfig.phaseDelayA = phaseDelayANode.GetDouble(); - tcmConfig.phaseDelayC = phaseDelayCNode.GetDouble(); - } + void parseTcmConfig(const rapidjson::Value& root, const char* tcmNodeName, TcmConfig& tcmConfig); + void parsePmConfig(const rapidjson::Value& pmNode, PmConfig& pmConfig); - void parsePmConfig(const rapidjson::Value& pmNode, PmConfig& pmConfig) { - if (!pmNode.HasMember("or_gate")) { - throw std::runtime_error("Invalid PM configuration node"); - } - const auto& orGateNode = pmNode["or_gate"]; - pmConfig.orGate = orGateNode.GetUint(); + template + void parsePmsArray(const rapidjson::Value& root, const char* pmArrayNodeName, PmConfig (&pmConfig)[Size]) + { + if (root.HasMember(pmArrayNodeName) == false) { + throw std::runtime_error(std::format("Failed to find {} node", pmArrayNodeName)); } - - template - void parsePmsArray(const rapidjson::Value& root, const char* pmArrayNodeName, PmConfig (&pmConfig)[Size]) { - if(root.HasMember(pmArrayNodeName) == false) { - throw std::runtime_error(std::format("Failed to find {} node", pmArrayNodeName)); - } - const auto& pmArrayNode = root[pmArrayNodeName]; - if(pmArrayNode.IsArray() == false) { - std::runtime_error(std::format("{} node is not an array!", pmArrayNodeName)); - } - const auto& pmArray = pmArrayNode.GetArray(); - if (pmArray.Size() != Size) { - throw std::runtime_error(std::format("Received data for {} PMs, but expected {}", pmArray.Size(), Size)); - } - for(int idx = 0; idx < pmArray.Size(); idx++) { - const auto& pm = pmArray[idx]; - if(pm.IsObject() == false) { - throw std::runtime_error("Encountered non-object element in PM array"); - } - parsePmConfig(pm, pmConfig[idx]); - } + const auto& pmArrayNode = root[pmArrayNodeName]; + if (pmArrayNode.IsArray() == false) { + std::runtime_error(std::format("{} node is not an array!", pmArrayNodeName)); + } + const auto& pmArray = pmArrayNode.GetArray(); + if (pmArray.Size() != Size) { + throw std::runtime_error(std::format("Received data for {} PMs, but expected {}", pmArray.Size(), Size)); } -private: - std::string mCcdbPath; + for (int idx = 0; idx < pmArray.Size(); idx++) { + const auto& pm = pmArray[idx]; + if (pm.IsObject() == false) { + throw std::runtime_error("Encountered non-object element in PM array"); + } + parsePmConfig(pm, pmConfig[idx]); + } + } + + bool validateSchema(const rapidjson::Document& docs); + + const std::string& getSchemaString() const + { + return configurationSchema; + } + + private: + static std::string configurationSchema; + + std::string mCcdbPath; + std::unique_ptr mSchema; }; -} +} // namespace o2::fit #endif \ No newline at end of file diff --git a/Detectors/FIT/common/dcsmonitoring/src/FITFEEConfigurationReader.cxx b/Detectors/FIT/common/dcsmonitoring/src/FITFEEConfigurationReader.cxx new file mode 100644 index 0000000000000..8c86b8bd54c50 --- /dev/null +++ b/Detectors/FIT/common/dcsmonitoring/src/FITFEEConfigurationReader.cxx @@ -0,0 +1,89 @@ +#include "FITDCSMonitoring/FITFEEConfigurationReader.h" + +namespace o2::fit +{ +FITFEEConfigurationReader::FITFEEConfigurationReader() +{ + rapidjson::Document schemaDocument; + schemaDocument.Parse(configurationSchema.c_str()); + if (schemaDocument.HasParseError()) { + throw std::runtime_error("Cannot parse FIT FEE JSON schema"); + } + mSchema = std::make_unique(schemaDocument); +} + +void FITFEEConfigurationReader::parseTcmConfig(const rapidjson::Value& root, const char* tcmNodeName, TcmConfig& tcmConfig) +{ + if (!root.HasMember(tcmNodeName)) { + std::runtime_error(std::format("Cannot find {}", tcmNodeName)); + } + const auto& tcmNode = root[tcmNodeName]; + if (!tcmNode.HasMember("phase_delay_a") || !tcmNode.HasMember("phase_delay_c")) { + throw std::runtime_error("Invalid TCM configuration node!"); + } + const auto& phaseDelayANode = tcmNode["phase_delay_a"]; + const auto& phaseDelayCNode = tcmNode["phase_delay_c"]; + tcmConfig.phaseDelayA = phaseDelayANode.GetDouble(); + tcmConfig.phaseDelayC = phaseDelayCNode.GetDouble(); +} + +void FITFEEConfigurationReader::parsePmConfig(const rapidjson::Value& pmNode, PmConfig& pmConfig) +{ + if (!pmNode.HasMember("or_gate")) { + throw std::runtime_error("Invalid PM configuration node"); + } + const auto& orGateNode = pmNode["or_gate"]; + pmConfig.orGate = orGateNode.GetUint(); +} + +bool FITFEEConfigurationReader::validateSchema(const rapidjson::Document& docs) +{ + rapidjson::SchemaValidator validator(*mSchema); + if (docs.Accept(validator) == false) { + return false; + } + return true; +} + +std::string FITFEEConfigurationReader::configurationSchema = R"SCH( + { + "type": "object", + "properties": { + "channels": { + "type": "object", + "properties": { + "time_aligments": {"type": "array"}, + "cfd_thresholds": {"type": "array"}, + "cfd_zeros": {"type": "array"}, + "adc_zeros": {"type": "array"}, + "adc_delays": {"type": "array"}, + "channel_mask_data": {"type": "array"}, + "channel_mask_triggers": {"type": "array"} + }, + "required": ["time_aligments", "cfd_thresholds", "cfd_zeros", + "adc_zeros", "adc_delays", "channel_mask_data", "channel_mask_triggers"] + }, + "tcm" : { + "type": "object", + "properties": { + "phase_delay_a": {"type": "number"}, + "phase_delay_c": {"type": "number"} + } + }, + "pm_a":{ + "type": "array", + "items": {"type": "object"} + }, + "pm_c": { + "type": "array", + "items": {"type": "object"} + }, + "triggers": { + "type": "object", + "additionalProperties" : { "type": "number" } + } + }, + "required": ["channels", "tcm", "triggers"] + } + )SCH"; +} // namespace o2::fit \ No newline at end of file From d173b8896db2726dfcb7f66aabf6a0753c94044a Mon Sep 17 00:00:00 2001 From: Wiktor Pierozak Date: Fri, 7 Aug 2026 14:37:57 +0200 Subject: [PATCH 13/28] Created base class for DCS configuration readers, wired FEE configuration parser to FT0 task --- .../FT0DCSMonitoring/FT0DCSConfigProcessor.h | 6 +- .../FT0FEEConfigurationReader.h | 14 +++- .../src/FT0DCSConfigProcessor.cxx | 33 +++++--- .../FITDCSMonitoring/FITDCSBaseConfigReader.h | 79 +++++++++++++++++++ .../FITDCSConfigProcessorSpec.h | 22 ++++-- .../FITFEEConfigurationReader.h | 16 +--- 6 files changed, 134 insertions(+), 36 deletions(-) create mode 100644 Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSBaseConfigReader.h diff --git a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigProcessor.h b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigProcessor.h index 7dae935c996cc..64c682250d5f1 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigProcessor.h +++ b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigProcessor.h @@ -2,6 +2,7 @@ #define O2_FT0_DCSCONFIGPROCESSOR_H #include "FITDCSMonitoring/FITDCSConfigProcessorSpec.h" +#include "FT0DCSMonitoring/FT0FEEConfigurationReader.h" #include "DetectorsCalibration/Utils.h" #include "Framework/WorkflowSpec.h" #include "Headers/DataHeader.h" @@ -20,6 +21,9 @@ class FT0DCSConfigProcessor : public o2::fit::FITDCSConfigProcessor void init(o2::framework::InitContext& ic) final; void run(o2::framework::ProcessingContext& pc) final; void endOfStream(o2::framework::EndOfStreamContext& ec) final; + + private: + FT0FEEConfigurationReader mFeeConfigurationReader; }; -} +} // namespace o2::ft0 #endif // O2_FT0_DCSCONFIGPROCESSOR_H \ No newline at end of file diff --git a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0FEEConfigurationReader.h b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0FEEConfigurationReader.h index 8f136642fe493..a2c2ff3624cf3 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0FEEConfigurationReader.h +++ b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0FEEConfigurationReader.h @@ -22,13 +22,19 @@ namespace o2::ft0 { -class FT0FEEConfigurationReader : public o2::fit::FITFEEConfigurationReader { - public: +class FT0FEEConfigurationReader : public o2::fit::FITFEEConfigurationReader +{ + public: + FT0FEEConfigurationReader() + { + setDataDescriptor("FT0_FEE_CONFIG"); + } Ft0FeeConfiguration parseFeeConfiguration(gsl::span configBuf); - private: + + private: void parseFT0TriggersConfiguration(const rapidjson::Value& root, const char* triggersNodeName, TriggersConfig& config); }; -} // namespace ft0 +} // namespace o2::ft0 #endif // O2_FT0_DCSCONFIGREADER_H \ No newline at end of file diff --git a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx index 04a58ffa5cf71..4a371f5975dcd 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx +++ b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx @@ -1,28 +1,35 @@ #include "FT0DCSMonitoring/FT0DCSConfigProcessor.h" -namespace o2::ft0 { +namespace o2::ft0 +{ void FT0DCSConfigProcessor::init(o2::framework::InitContext& ic) { - initDeadChannelMapReader(); - setupDeadChannelMapReader(ic); + initDeadChannelMapReader(); + setupDeadChannelMapReader(ic); + setupFeeConfigurationReader(ic, mFeeConfigurationReader); } void FT0DCSConfigProcessor::run(o2::framework::ProcessingContext& pc) { - long dataTime = getValidityTime(pc); + long dataTime = getValidityTime(pc); - gsl::span dataBuffer = pc.inputs().get>("inputConfig"); - std::string configFileName = pc.inputs().get("inputConfigFileName"); - LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); + gsl::span dataBuffer = pc.inputs().get>("inputConfig"); + std::string configFileName = pc.inputs().get("inputConfigFileName"); + LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); - if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { - handleDeadChannelMapUpdate(pc,dataTime, dataBuffer); - } else { - LOG(error) << "Unknown input file: " << configFileName; - } + if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { + handleDeadChannelMapUpdate(pc, dataTime, dataBuffer); + } + if (mFeeConfigurationReader.matchFilename(configFileName)) { + Ft0FeeConfiguration feeConfiguration = mFeeConfigurationReader.parseFeeConfiguration(dataBuffer); + o2::ccdb::CcdbObjectInfo objectInfo = mFeeConfigurationReader.createObjectInfo(feeConfiguration, dataTime, {}); + sendObject(pc.outputs(), feeConfiguration, objectInfo, mFeeConfigurationReader.getDataDescriptor()); + } else { + LOG(error) << "Unknown input file: " << configFileName; + } } void FT0DCSConfigProcessor::endOfStream(o2::framework::EndOfStreamContext& ec) { } -} \ No newline at end of file +} // namespace o2::ft0 \ No newline at end of file diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSBaseConfigReader.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSBaseConfigReader.h new file mode 100644 index 0000000000000..cc07e814da650 --- /dev/null +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSBaseConfigReader.h @@ -0,0 +1,79 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef O2_FIT_DCS_BASE_CONFIG_READER_H +#define O2_FIT_DCS_BASE_CONFIG_READER_H + +#include "DetectorsCalibration/Utils.h" + +namespace o2::fit +{ +class FITDCSBaseConfigReader +{ + public: + template + o2::ccdb::CcdbObjectInfo createObjectInfo(const FeeConfigType& configObject, long startValidityTimestamp, long endValidityTimestamp, const std::map& metadata) + { + o2::ccdb::CcdbObjectInfo objectInfo; + o2::calibration::Utils::prepareCCDBobjectInfo(configObject, objectInfo, mCcdbPath, metadata, startValidityTimestamp, endValidityTimestamp); + objectInfo.setValidateUpload(mValidateUpload); + return objectInfo; + } + + void setCcdbPath(const std::string& path) + { + mCcdbPath = path; + } + const std::string& getCcdbPath() const + { + return mCcdbPath; + } + + void setFilename(const std::string& filename) + { + mFilename = filename; + } + const std::string& getFilename() const + { + return mFilename; + } + + bool matchFilename(const std::string& filename) + { + return mFilename == filename; + } + + void setValidateUpload(bool validate) + { + mValidateUpload = validate; + } + bool getValidateUpload() const + { + return mValidateUpload; + } + + void setDataDescriptor(o2::header::DataDescription descriptor) + { + mDataDescriptor = descriptor; + } + const o2::header::DataDescription& getDataDescriptor() const + { + return mDataDescriptor; + } + + private: + std::string mCcdbPath; + o2::header::DataDescription mDataDescriptor; + std::string mFilename; + bool mValidateUpload; +}; +} // namespace o2::fit +#endif \ No newline at end of file diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h index 6c977daa5ae89..edc084cc9b722 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h @@ -20,6 +20,7 @@ #include "CCDB/CcdbApi.h" #include "DetectorsCalibration/Utils.h" #include "FITDCSMonitoring/FITDeadChannelMapReader.h" +#include "FITDCSMonitoring/FITFEEConfigurationReader.h" #include "Framework/ConfigParamRegistry.h" #include "Framework/Task.h" #include "Framework/WorkflowSpec.h" @@ -50,15 +51,17 @@ class FITDCSConfigProcessor : public o2::framework::Task mDeadChannelMapReader = std::make_unique(FITDeadChannelMapReader()); } - long getValidityTime(o2::framework::ProcessingContext& pc) { + long getValidityTime(o2::framework::ProcessingContext& pc) + { long dataTime = (long)(pc.services().get().creation); - if (dataTime == 0xffffffffffffffff) { // means it is not set + if (dataTime == 0xffffffffffffffff) { // means it is not set dataTime = std::chrono::duration_cast(std::chrono::high_resolution_clock::now().time_since_epoch()).count(); // in ms } return dataTime; - } + } - void setupDeadChannelMapReader(o2::framework::InitContext& ic) { + void setupDeadChannelMapReader(o2::framework::InitContext& ic) + { mDeadChannelMapReader->setFileNameDChM(ic.options().get("filename-dchm")); mDeadChannelMapReader->setValidDaysDChM(ic.options().get("valid-days-dchm")); mDeadChannelMapReader->setCcdbPathDChM(mDetectorName + "/Calib/DeadChannelMap"); @@ -73,7 +76,13 @@ class FITDCSConfigProcessor : public o2::framework::Task LOG(info) << "Dead channel maps will be valid for " << mDeadChannelMapReader->getValidDaysDChM() << " days"; } - void handleDeadChannelMapUpdate(o2::framework::ProcessingContext& pc, long dataTime, gsl::span dataBuffer) { + void setupFeeConfigurationReader(o2::framework::InitContext& ic, FITFEEConfigurationReader& feeConfig) + { + feeConfig.setFilename(ic.options().get("filename-fee-config")); + } + + void handleDeadChannelMapUpdate(o2::framework::ProcessingContext& pc, long dataTime, gsl::span dataBuffer) + { processDeadChannelMap(dataTime, dataBuffer); sendObject(pc.outputs(), mDeadChannelMapReader->getDChM(), mDeadChannelMapReader->getObjectInfoDChM(), mDataDescriptionDChM); mDeadChannelMapReader->resetStartValidityDChM(); @@ -90,7 +99,7 @@ class FITDCSConfigProcessor : public o2::framework::Task mDeadChannelMapReader->updateDChMCcdbObjectInfo(); } - template + template void sendObject(o2::framework::DataAllocator& output, const ConfigObjectType& object, o2::ccdb::CcdbObjectInfo& info, const o2::header::DataDescription& descriptor) { auto image = o2::ccdb::CcdbApi::createObjectImage(&object, &info); @@ -101,6 +110,7 @@ class FITDCSConfigProcessor : public o2::framework::Task } std::unique_ptr mDeadChannelMapReader; + private: std::string mDetectorName; ///< Detector name o2::header::DataDescription mDataDescriptionDChM; ///< DataDescription for the dead channel map diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h index be334b4f43841..68c7b3c064945 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h @@ -21,25 +21,19 @@ #include #include "DataFormatsFIT/Configuration.h" #include "DetectorsCalibration/Utils.h" +#include "FITDCSMonitoring/FITDCSBaseConfigReader.h" namespace o2::fit { -class FITFEEConfigurationReader +class FITFEEConfigurationReader : public FITDCSBaseConfigReader { public: FITFEEConfigurationReader(); template - o2::ccdb::CcdbObjectInfo createObjectInfo(const FeeConfigType& configObject, long startValidityTimestamp, const std::map metadata) + o2::ccdb::CcdbObjectInfo createObjectInfo(const FeeConfigType& configObject, long startValidityTimestamp, const std::map& metadata) { - o2::ccdb::CcdbObjectInfo objectInfo; - o2::calibration::Utils::prepareCCDBobjectInfo(configObject, objectInfo, mCcdbPath, metadata, startValidityTimestamp, o2::ccdb::CcdbObjectInfo::INFINITE_TIMESTAMP); - return objectInfo; - } - - void setCcdbPath(const std::string& path) - { - mCcdbPath = path; + return FITDCSBaseConfigReader::createObjectInfo(configObject, startValidityTimestamp, o2::ccdb::CcdbObjectInfo::INFINITE_TIMESTAMP, metadata); } protected: @@ -133,8 +127,6 @@ class FITFEEConfigurationReader private: static std::string configurationSchema; - - std::string mCcdbPath; std::unique_ptr mSchema; }; } // namespace o2::fit From abd01f29f924ec8e71772ec26aebae1674eb7493 Mon Sep 17 00:00:00 2001 From: Wiktor Pierozak Date: Fri, 7 Aug 2026 17:38:01 +0200 Subject: [PATCH 14/28] Refactored FITFEEConfigurationReader for better code reusability --- .../FT0FEEConfigurationReader.h | 6 +- .../src/FT0FEEConfigurationReader.cxx | 18 +-- .../FIT/common/dcsmonitoring/CMakeLists.txt | 1 - .../FITDCSConfigProcessorSpec.h | 3 +- .../FITFEEConfigurationReader.h | 109 +++++++++++++++++- .../src/FITFEEConfigurationReader.cxx | 89 -------------- 6 files changed, 110 insertions(+), 116 deletions(-) delete mode 100644 Detectors/FIT/common/dcsmonitoring/src/FITFEEConfigurationReader.cxx diff --git a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0FEEConfigurationReader.h b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0FEEConfigurationReader.h index a2c2ff3624cf3..9eed6b19f7712 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0FEEConfigurationReader.h +++ b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0FEEConfigurationReader.h @@ -22,7 +22,7 @@ namespace o2::ft0 { -class FT0FEEConfigurationReader : public o2::fit::FITFEEConfigurationReader +class FT0FEEConfigurationReader : public o2::fit::FITFEEConfigurationReader { public: FT0FEEConfigurationReader() @@ -30,9 +30,7 @@ class FT0FEEConfigurationReader : public o2::fit::FITFEEConfigurationReader setDataDescriptor("FT0_FEE_CONFIG"); } Ft0FeeConfiguration parseFeeConfiguration(gsl::span configBuf); - - private: - void parseFT0TriggersConfiguration(const rapidjson::Value& root, const char* triggersNodeName, TriggersConfig& config); + void parseTriggers(const rapidjson::Value& root, const char* triggersNodeName, TriggersConfig& config); }; } // namespace o2::ft0 diff --git a/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx b/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx index e800b6384c19c..448ca22f6edcd 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx +++ b/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx @@ -6,24 +6,10 @@ namespace o2::ft0 { Ft0FeeConfiguration FT0FEEConfigurationReader::parseFeeConfiguration(gsl::span buffer) { - Ft0FeeConfiguration configuration; - rapidjson::MemoryStream ms(buffer.data(), buffer.size()); - rapidjson::Document document; - document.ParseStream(ms); - - if (validateSchema(document) == false) { - std::string_view bufferView(buffer.data(), buffer.size()); - throw std::runtime_error(std::format("Received document does not match FEE configuration schema! Document: {}; Schema: {}", bufferView, getSchemaString())); - } - - parseChannelData(document, "channels", configuration.channels); - parseTcmConfig(document, "tcm", configuration.tcm); - parsePmsArray(document, "pm_a", configuration.pmA); - parsePmsArray(document, "pm_c", configuration.pmC); - parseFT0TriggersConfiguration(document, "triggers", configuration.triggers); + FITFEEConfigurationReader::parseFeeConfiguration(buffer); } -void FT0FEEConfigurationReader::parseFT0TriggersConfiguration(const rapidjson::Value& root, const char* triggersNodeName, TriggersConfig& config) +void FT0FEEConfigurationReader::parseTriggers(const rapidjson::Value& root, const char* triggersNodeName, TriggersConfig& config) { const auto& triggersNode = root["triggers"]; const auto& vertexTimeLowThresholdNode = triggersNode["vertex_time_low_threshold"]; diff --git a/Detectors/FIT/common/dcsmonitoring/CMakeLists.txt b/Detectors/FIT/common/dcsmonitoring/CMakeLists.txt index 66a7695a2276c..b76269805330f 100644 --- a/Detectors/FIT/common/dcsmonitoring/CMakeLists.txt +++ b/Detectors/FIT/common/dcsmonitoring/CMakeLists.txt @@ -13,7 +13,6 @@ o2_add_library(FITDCSMonitoring SOURCES src/FITDCSDataProcessor.cxx src/FITDCSDataReader.cxx src/FITDeadChannelMapReader.cxx - src/FITFEEConfigurationReader.cxx PUBLIC_LINK_LIBRARIES O2::DataFormatsFIT O2::DetectorsCalibration O2::DetectorsDCS) diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h index edc084cc9b722..182f07e8fbb29 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h @@ -76,7 +76,8 @@ class FITDCSConfigProcessor : public o2::framework::Task LOG(info) << "Dead channel maps will be valid for " << mDeadChannelMapReader->getValidDaysDChM() << " days"; } - void setupFeeConfigurationReader(o2::framework::InitContext& ic, FITFEEConfigurationReader& feeConfig) + template + void setupFeeConfigurationReader(o2::framework::InitContext& ic, FITFEEConfigurationReader& feeConfig) { feeConfig.setFilename(ic.options().get("filename-fee-config")); } diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h index 68c7b3c064945..49cf46c1ce1e3 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h @@ -25,10 +25,19 @@ namespace o2::fit { +template class FITFEEConfigurationReader : public FITDCSBaseConfigReader { public: - FITFEEConfigurationReader(); + FITFEEConfigurationReader() + { + rapidjson::Document schemaDocument; + schemaDocument.Parse(configurationSchema.c_str()); + if (schemaDocument.HasParseError()) { + throw std::runtime_error("Cannot parse FIT FEE JSON schema"); + } + mSchema = std::make_unique(schemaDocument); + } template o2::ccdb::CcdbObjectInfo createObjectInfo(const FeeConfigType& configObject, long startValidityTimestamp, const std::map& metadata) @@ -37,6 +46,25 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader } protected: + template + ConfigType parseFeeConfiguration(gsl::span buffer) + { + ConfigType configuration; + rapidjson::MemoryStream ms(buffer.data(), buffer.size()); + rapidjson::Document document; + document.ParseStream(ms); + + if (validateSchema(document) == false) { + std::string_view bufferView(buffer.data(), buffer.size()); + throw std::runtime_error(std::format("Received document does not match FEE configuration schema! Document: {}; Schema: {}", bufferView, getSchemaString())); + } + + parseChannelData(document, "channels", configuration.channels); + parseTcmConfig(document, "tcm", configuration.tcm); + parsePmsArray(document, "pm_a", configuration.pmA); + parsePmsArray(document, "pm_c", configuration.pmC); + static_cast(this)->parseTriggers(document, "triggers", configuration.triggers); + } template void parseJsonArray(const rapidjson::Value& node, const char* childName, T (&array)[Size]) { @@ -92,8 +120,29 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader parseJsonArray(channelsNode, "channel_mask_triggers", channelsConfiguration.channelMaskTriggers); } - void parseTcmConfig(const rapidjson::Value& root, const char* tcmNodeName, TcmConfig& tcmConfig); - void parsePmConfig(const rapidjson::Value& pmNode, PmConfig& pmConfig); + void parseTcmConfig(const rapidjson::Value& root, const char* tcmNodeName, TcmConfig& tcmConfig) + { + if (!root.HasMember(tcmNodeName)) { + std::runtime_error(std::format("Cannot find {}", tcmNodeName)); + } + const auto& tcmNode = root[tcmNodeName]; + if (!tcmNode.HasMember("phase_delay_a") || !tcmNode.HasMember("phase_delay_c")) { + throw std::runtime_error("Invalid TCM configuration node!"); + } + const auto& phaseDelayANode = tcmNode["phase_delay_a"]; + const auto& phaseDelayCNode = tcmNode["phase_delay_c"]; + tcmConfig.phaseDelayA = phaseDelayANode.GetDouble(); + tcmConfig.phaseDelayC = phaseDelayCNode.GetDouble(); + } + + void parsePmConfig(const rapidjson::Value& pmNode, PmConfig& pmConfig) + { + if (!pmNode.HasMember("or_gate")) { + throw std::runtime_error("Invalid PM configuration node"); + } + const auto& orGateNode = pmNode["or_gate"]; + pmConfig.orGate = orGateNode.GetUint(); + } template void parsePmsArray(const rapidjson::Value& root, const char* pmArrayNodeName, PmConfig (&pmConfig)[Size]) @@ -118,7 +167,14 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader } } - bool validateSchema(const rapidjson::Document& docs); + bool validateSchema(const rapidjson::Document& docs) + { + rapidjson::SchemaValidator validator(*mSchema); + if (docs.Accept(validator) == false) { + return false; + } + return true; + } const std::string& getSchemaString() const { @@ -126,9 +182,52 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader } private: - static std::string configurationSchema; + static const std::string configurationSchema; std::unique_ptr mSchema; }; + +template +const std::string FITFEEConfigurationReader::configurationSchema = R"SCH( + { + "type": "object", + "properties": { + "channels": { + "type": "object", + "properties": { + "time_aligments": {"type": "array"}, + "cfd_thresholds": {"type": "array"}, + "cfd_zeros": {"type": "array"}, + "adc_zeros": {"type": "array"}, + "adc_delays": {"type": "array"}, + "channel_mask_data": {"type": "array"}, + "channel_mask_triggers": {"type": "array"} + }, + "required": ["time_aligments", "cfd_thresholds", "cfd_zeros", + "adc_zeros", "adc_delays", "channel_mask_data", "channel_mask_triggers"] + }, + "tcm" : { + "type": "object", + "properties": { + "phase_delay_a": {"type": "number"}, + "phase_delay_c": {"type": "number"} + } + }, + "pm_a":{ + "type": "array", + "items": {"type": "object"} + }, + "pm_c": { + "type": "array", + "items": {"type": "object"} + }, + "triggers": { + "type": "object", + "additionalProperties" : { "type": "number" } + } + }, + "required": ["channels", "tcm", "triggers"] + } + )SCH"; } // namespace o2::fit #endif \ No newline at end of file diff --git a/Detectors/FIT/common/dcsmonitoring/src/FITFEEConfigurationReader.cxx b/Detectors/FIT/common/dcsmonitoring/src/FITFEEConfigurationReader.cxx deleted file mode 100644 index 8c86b8bd54c50..0000000000000 --- a/Detectors/FIT/common/dcsmonitoring/src/FITFEEConfigurationReader.cxx +++ /dev/null @@ -1,89 +0,0 @@ -#include "FITDCSMonitoring/FITFEEConfigurationReader.h" - -namespace o2::fit -{ -FITFEEConfigurationReader::FITFEEConfigurationReader() -{ - rapidjson::Document schemaDocument; - schemaDocument.Parse(configurationSchema.c_str()); - if (schemaDocument.HasParseError()) { - throw std::runtime_error("Cannot parse FIT FEE JSON schema"); - } - mSchema = std::make_unique(schemaDocument); -} - -void FITFEEConfigurationReader::parseTcmConfig(const rapidjson::Value& root, const char* tcmNodeName, TcmConfig& tcmConfig) -{ - if (!root.HasMember(tcmNodeName)) { - std::runtime_error(std::format("Cannot find {}", tcmNodeName)); - } - const auto& tcmNode = root[tcmNodeName]; - if (!tcmNode.HasMember("phase_delay_a") || !tcmNode.HasMember("phase_delay_c")) { - throw std::runtime_error("Invalid TCM configuration node!"); - } - const auto& phaseDelayANode = tcmNode["phase_delay_a"]; - const auto& phaseDelayCNode = tcmNode["phase_delay_c"]; - tcmConfig.phaseDelayA = phaseDelayANode.GetDouble(); - tcmConfig.phaseDelayC = phaseDelayCNode.GetDouble(); -} - -void FITFEEConfigurationReader::parsePmConfig(const rapidjson::Value& pmNode, PmConfig& pmConfig) -{ - if (!pmNode.HasMember("or_gate")) { - throw std::runtime_error("Invalid PM configuration node"); - } - const auto& orGateNode = pmNode["or_gate"]; - pmConfig.orGate = orGateNode.GetUint(); -} - -bool FITFEEConfigurationReader::validateSchema(const rapidjson::Document& docs) -{ - rapidjson::SchemaValidator validator(*mSchema); - if (docs.Accept(validator) == false) { - return false; - } - return true; -} - -std::string FITFEEConfigurationReader::configurationSchema = R"SCH( - { - "type": "object", - "properties": { - "channels": { - "type": "object", - "properties": { - "time_aligments": {"type": "array"}, - "cfd_thresholds": {"type": "array"}, - "cfd_zeros": {"type": "array"}, - "adc_zeros": {"type": "array"}, - "adc_delays": {"type": "array"}, - "channel_mask_data": {"type": "array"}, - "channel_mask_triggers": {"type": "array"} - }, - "required": ["time_aligments", "cfd_thresholds", "cfd_zeros", - "adc_zeros", "adc_delays", "channel_mask_data", "channel_mask_triggers"] - }, - "tcm" : { - "type": "object", - "properties": { - "phase_delay_a": {"type": "number"}, - "phase_delay_c": {"type": "number"} - } - }, - "pm_a":{ - "type": "array", - "items": {"type": "object"} - }, - "pm_c": { - "type": "array", - "items": {"type": "object"} - }, - "triggers": { - "type": "object", - "additionalProperties" : { "type": "number" } - } - }, - "required": ["channels", "tcm", "triggers"] - } - )SCH"; -} // namespace o2::fit \ No newline at end of file From 4ce80114bed97f941fa122ce5e76f2a38b44b18d Mon Sep 17 00:00:00 2001 From: Wiktor Pierozak Date: Mon, 10 Aug 2026 14:39:43 +0200 Subject: [PATCH 15/28] Implemented basic unit tests for FITFEEConfigurationReader --- .../include/DataFormatsFIT/Configuration.h | 23 ++ .../src/FT0FEEConfigurationReader.cxx | 2 +- Detectors/FIT/common/CMakeLists.txt | 1 + .../FITFEEConfigurationReader.h | 51 +++- Detectors/FIT/common/tests/CMakeLists.txt | 16 ++ .../FITFEEConfigurationReaderTest.cxx | 255 ++++++++++++++++++ 6 files changed, 334 insertions(+), 14 deletions(-) create mode 100644 Detectors/FIT/common/tests/CMakeLists.txt create mode 100644 Detectors/FIT/common/tests/dcsmonitoring/FITFEEConfigurationReaderTest.cxx diff --git a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h index bbc8a3c8a5119..064b26b1c154f 100644 --- a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h +++ b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h @@ -21,6 +21,7 @@ #include #include #include +#include namespace o2::fit { @@ -53,10 +54,14 @@ constexpr void fillDefaultArray(T (&array)[N]) struct TcmConfig { float phaseDelayA{config_helpers::DefaultValue}; float phaseDelayC{config_helpers::DefaultValue}; + + bool operator==(const TcmConfig&) const = default; }; struct PmConfig { uint8_t orGate{config_helpers::DefaultValue}; + + bool operator==(const PmConfig&) const = default; }; template @@ -93,6 +98,24 @@ struct ChannelsConfig { gsl::span getAdcDelays() const { return adcDelays; } gsl::span getChannelMaskTriggers() const { return channelMaskTriggers; } gsl::span getChannelMaskData() const { return channelMaskData; } + + bool operator==(const ChannelsConfig& other) const + { + return std::equal(std::begin(timeAligments), std::end(timeAligments), + std::begin(other.timeAligments)) && + std::equal(std::begin(cfdThresholds), std::end(cfdThresholds), + std::begin(other.cfdThresholds)) && + std::equal(std::begin(cfdZeros), std::end(cfdZeros), + std::begin(other.cfdZeros)) && + std::equal(std::begin(adcZeros), std::end(adcZeros), + std::begin(other.adcZeros)) && + std::equal(std::begin(adcDelays), std::end(adcDelays), + std::begin(other.adcDelays)) && + std::equal(std::begin(channelMaskData), std::end(channelMaskData), + std::begin(other.channelMaskData)) && + std::equal(std::begin(channelMaskTriggers), std::end(channelMaskTriggers), + std::begin(other.channelMaskTriggers)); + } }; } // namespace o2::fit #endif \ No newline at end of file diff --git a/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx b/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx index 448ca22f6edcd..fada569f96c8c 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx +++ b/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx @@ -6,7 +6,7 @@ namespace o2::ft0 { Ft0FeeConfiguration FT0FEEConfigurationReader::parseFeeConfiguration(gsl::span buffer) { - FITFEEConfigurationReader::parseFeeConfiguration(buffer); + return FITFEEConfigurationReader::parseFeeConfiguration(buffer); } void FT0FEEConfigurationReader::parseTriggers(const rapidjson::Value& root, const char* triggersNodeName, TriggersConfig& config) diff --git a/Detectors/FIT/common/CMakeLists.txt b/Detectors/FIT/common/CMakeLists.txt index 1066814a6cbaa..3a3949f3df442 100644 --- a/Detectors/FIT/common/CMakeLists.txt +++ b/Detectors/FIT/common/CMakeLists.txt @@ -13,4 +13,5 @@ add_subdirectory(calibration) add_subdirectory(dcsmonitoring) if(BUILD_TESTING) add_subdirectory(dcsmonitoring/macros) + add_subdirectory(tests) endif() diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h index 49cf46c1ce1e3..47b8c3a6f8fda 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h @@ -54,9 +54,10 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader rapidjson::Document document; document.ParseStream(ms); - if (validateSchema(document) == false) { + std::string validationErrorMessage; + if (validateSchema(document, validationErrorMessage) == false) { std::string_view bufferView(buffer.data(), buffer.size()); - throw std::runtime_error(std::format("Received document does not match FEE configuration schema! Document: {}; Schema: {}", bufferView, getSchemaString())); + throw std::runtime_error("Received document does not match FEE configuration schema! Error message: " + validationErrorMessage); } parseChannelData(document, "channels", configuration.channels); @@ -64,6 +65,8 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader parsePmsArray(document, "pm_a", configuration.pmA); parsePmsArray(document, "pm_c", configuration.pmC); static_cast(this)->parseTriggers(document, "triggers", configuration.triggers); + + return configuration; } template void parseJsonArray(const rapidjson::Value& node, const char* childName, T (&array)[Size]) @@ -110,7 +113,7 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader template void parseChannelData(const rapidjson::Value& root, const char* channelsNodeName, ChannelsConfig& channelsConfiguration) { - const auto& channelsNode = root["channels"]; + const auto& channelsNode = root[channelsNodeName]; parseJsonArray(channelsNode, "time_aligments", channelsConfiguration.timeAligments); parseJsonArray(channelsNode, "cfd_thresholds", channelsConfiguration.cfdThresholds); parseJsonArray(channelsNode, "cfd_zeros", channelsConfiguration.cfdZeros); @@ -167,10 +170,22 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader } } - bool validateSchema(const rapidjson::Document& docs) + bool validateSchema(const rapidjson::Document& docs, std::string& errorMessage) { rapidjson::SchemaValidator validator(*mSchema); if (docs.Accept(validator) == false) { + rapidjson::StringBuffer buffer; + std::ostringstream ss; + validator.GetInvalidSchemaPointer().StringifyUriFragment(buffer); + ss << "Invalid schema: " << buffer.GetString() << '\n'; + ss << "Invalid keyword: " << validator.GetInvalidSchemaKeyword() << '\n'; + + buffer.Clear(); + + validator.GetInvalidDocumentPointer().StringifyUriFragment(buffer); + ss << "Invalid document: " << buffer.GetString() << '\n'; + + errorMessage = ss.str(); return false; } return true; @@ -194,13 +209,13 @@ const std::string FITFEEConfigurationReader::configurat "channels": { "type": "object", "properties": { - "time_aligments": {"type": "array"}, - "cfd_thresholds": {"type": "array"}, - "cfd_zeros": {"type": "array"}, - "adc_zeros": {"type": "array"}, - "adc_delays": {"type": "array"}, - "channel_mask_data": {"type": "array"}, - "channel_mask_triggers": {"type": "array"} + "time_aligments": {"type": "array", "items": {"type": "integer"}}, + "cfd_thresholds": {"type": "array", "items": {"type": "integer"}}, + "cfd_zeros": {"type": "array", "items": {"type": "integer"}}, + "adc_zeros": {"type": "array", "items": {"type": "integer"}}, + "adc_delays": {"type": "array", "items": {"type": "integer"}}, + "channel_mask_data": {"type": "array", "items": {"type": "boolean"}}, + "channel_mask_triggers": {"type": "array", "items": {"type": "boolean"}} }, "required": ["time_aligments", "cfd_thresholds", "cfd_zeros", "adc_zeros", "adc_delays", "channel_mask_data", "channel_mask_triggers"] @@ -214,11 +229,21 @@ const std::string FITFEEConfigurationReader::configurat }, "pm_a":{ "type": "array", - "items": {"type": "object"} + "items": { + "type": "object", + "properties": { + "or_gate": {"type": "number"} + } + } }, "pm_c": { "type": "array", - "items": {"type": "object"} + "items": { + "type": "object", + "properties": { + "or_gate": {"type": "number"} + } + } }, "triggers": { "type": "object", diff --git a/Detectors/FIT/common/tests/CMakeLists.txt b/Detectors/FIT/common/tests/CMakeLists.txt new file mode 100644 index 0000000000000..d3272a4a97c6c --- /dev/null +++ b/Detectors/FIT/common/tests/CMakeLists.txt @@ -0,0 +1,16 @@ +# Copyright 2019-2020 CERN and copyright holders of ALICE O2. +# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +# All rights not expressly granted are reserved. +# +# This software is distributed under the terms of the GNU General Public +# License v3 (GPL Version 3), copied verbatim in the file "COPYING". +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization +# or submit itself to any jurisdiction. + +o2_add_test(FITFEEConfigurationReader + COMPONENT_NAME fit_fee_config_reader + LABELS fit + PUBLIC_LINK_LIBRARIES O2::DataFormatsFIT O2::FITDCSMonitoring + SOURCES dcsmonitoring/FITFEEConfigurationReaderTest.cxx) \ No newline at end of file diff --git a/Detectors/FIT/common/tests/dcsmonitoring/FITFEEConfigurationReaderTest.cxx b/Detectors/FIT/common/tests/dcsmonitoring/FITFEEConfigurationReaderTest.cxx new file mode 100644 index 0000000000000..c8302a5159678 --- /dev/null +++ b/Detectors/FIT/common/tests/dcsmonitoring/FITFEEConfigurationReaderTest.cxx @@ -0,0 +1,255 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#define BOOST_TEST_MODULE Test FITDCSMonitoring FITFEEConfigurationReader +#define BOOST_TEST_MAIN +#define BOOST_TEST_DYN_LINK + +#include +#include +#include "FITDCSMonitoring/FITFEEConfigurationReader.h" +#include "DataFormatsFIT/Configuration.h" + +using namespace o2::fit; + +BOOST_AUTO_TEST_SUITE(o2_fit_dcs_monitoring) +// Dummy structure for trigger data for complete definition of FEE configuration structure +struct SimpleTriggers { + int32_t triggerA; +}; + +// Test configuration structure +struct SimpleConfiguration { + static constexpr int NChannels = 5; + SimpleTriggers triggers; + o2::fit::ChannelsConfig channels; + o2::fit::TcmConfig tcm; + o2::fit::PmConfig pmA[2]; + o2::fit::PmConfig pmC[2]; +}; + +class SimpleFITFEEConfigurationReader: public FITFEEConfigurationReader{ +public: + // Dummy method to parse dummy triggers payload + SimpleTriggers parseTriggers(const rapidjson::Value& node, const char* childName, SimpleTriggers& triggers) { + triggers.triggerA = 32; + } + using FITFEEConfigurationReader::parseFeeConfiguration; + using FITFEEConfigurationReader::parseJsonArray; + using FITFEEConfigurationReader::parseChannelData; + using FITFEEConfigurationReader::parseTcmConfig; + using FITFEEConfigurationReader::parsePmConfig; + using FITFEEConfigurationReader::parsePmsArray; + using FITFEEConfigurationReader::validateSchema; +}; + +BOOST_AUTO_TEST_CASE(shouldParseSinglePmConfig) +{ + const uint8_t orGateValue = 20; + rapidjson::Document doc; + doc.SetObject(); + auto& allocator = doc.GetAllocator(); + + doc.AddMember("or_gate", orGateValue, allocator); + SimpleFITFEEConfigurationReader reader; + + PmConfig pmConfig; + reader.parsePmConfig(doc, pmConfig); + + BOOST_CHECK(pmConfig.orGate == orGateValue); +} + +BOOST_AUTO_TEST_CASE(shouldParseTcmConfig) { + const float phaseDelayAValue = 1.2; + const float phaseDelayCValue = -1.3; + + rapidjson::Document doc; + doc.SetObject(); + auto& allocator = doc.GetAllocator(); + + rapidjson::Value tcmConfigJson(rapidjson::kObjectType); + tcmConfigJson.AddMember("phase_delay_a", phaseDelayAValue, allocator); + tcmConfigJson.AddMember("phase_delay_c", phaseDelayCValue, allocator); + + doc.AddMember("tcm_config", tcmConfigJson, allocator); + TcmConfig tcmConfig; + + SimpleFITFEEConfigurationReader reader; + reader.parseTcmConfig(doc, "tcm_config", tcmConfig); + + TcmConfig expectedConfig = {.phaseDelayA = phaseDelayAValue, .phaseDelayC = phaseDelayCValue}; + BOOST_CHECK(tcmConfig == expectedConfig); +} + +BOOST_AUTO_TEST_CASE(shouldParseArrayOfPmConfigs) { + uint8_t pmAOrGate[2] = {3, 4}; + uint8_t pmCOrGate[2] = {5, 6}; + + rapidjson::Document doc; + doc.SetObject(); + auto& allocator = doc.GetAllocator(); + + rapidjson::Value pmAJson(rapidjson::kArrayType); + rapidjson::Value pmCJson(rapidjson::kArrayType); + + for(int idx = 0; idx < sizeof(pmAOrGate); idx++) { + rapidjson::Value pm(rapidjson::kObjectType); + pm.AddMember("or_gate", pmAOrGate[idx], allocator); + pmAJson.PushBack(pm, allocator); + } + + for(int idx = 0; idx < sizeof(pmCOrGate); idx++) { + rapidjson::Value pm(rapidjson::kObjectType); + pm.AddMember("or_gate", pmCOrGate[idx], allocator); + pmCJson.PushBack(pm, allocator); + } + + doc.AddMember("pm_a", pmAJson, allocator); + doc.AddMember("pm_c", pmCJson, allocator); + + PmConfig pmAParsed[2]; + PmConfig pmCParsed[2]; + + SimpleFITFEEConfigurationReader reader; + reader.parsePmsArray(doc, "pm_a", pmAParsed); + reader.parsePmsArray(doc, "pm_c", pmCParsed); + + for(int idx= 0; idx < sizeof(pmAParsed); idx++) { + BOOST_CHECK(pmAParsed[idx].orGate == pmAOrGate[idx]); + } + + for(int idx= 0; idx < sizeof(pmAParsed); idx++) { + BOOST_CHECK(pmCParsed[idx].orGate == pmCOrGate[idx]); + } +} + +BOOST_AUTO_TEST_CASE(shouldThrowOnInconsistentPmsArraySize) { + uint8_t pmAOrGate[2] = {0}; + + rapidjson::Document doc; + doc.SetObject(); + auto& allocator = doc.GetAllocator(); + + rapidjson::Value pmAJson(rapidjson::kArrayType); + + for(int idx = 0; idx < sizeof(pmAOrGate); idx++) { + rapidjson::Value pm(rapidjson::kObjectType); + pm.AddMember("or_gate", pmAOrGate[0], allocator); + pmAJson.PushBack(pm, allocator); + } + + doc.AddMember("pm_a", pmAJson, allocator); + + PmConfig pmAParsed[3]; + + SimpleFITFEEConfigurationReader reader; + BOOST_CHECK_THROW(reader.parsePmsArray(doc, "pm_a", pmAParsed), std::runtime_error); +} + +BOOST_AUTO_TEST_CASE(shouldParseChannelsConfig) +{ + constexpr size_t NTestChannels = 4; + + float timeAligments[NTestChannels] = {1.1f, 2.2f, 3.3f, 4.4f}; + uint16_t cfdThresholds[NTestChannels] = {10, 20, 30, 40}; + int16_t cfdZeros[NTestChannels] = {-1, -2, -3, -4}; + int16_t adcZeros[NTestChannels] = {100, 200, 300, 400}; + uint16_t adcDelays[NTestChannels] = {5, 6, 7, 8}; + bool channelMaskData[NTestChannels] = {true, false, true, false}; + bool channelMaskTriggers[NTestChannels] = {false, true, false, true}; + + rapidjson::Document doc; + doc.SetObject(); + auto& allocator = doc.GetAllocator(); + + rapidjson::Value channels(rapidjson::kObjectType); + + rapidjson::Value timeAligmentsJson(rapidjson::kArrayType); + rapidjson::Value cfdThresholdsJson(rapidjson::kArrayType); + rapidjson::Value cfdZerosJson(rapidjson::kArrayType); + rapidjson::Value adcZerosJson(rapidjson::kArrayType); + rapidjson::Value adcDelaysJson(rapidjson::kArrayType); + rapidjson::Value channelMaskDataJson(rapidjson::kArrayType); + rapidjson::Value channelMaskTriggersJson(rapidjson::kArrayType); + + for (size_t idx = 0; idx < NTestChannels; ++idx) { + timeAligmentsJson.PushBack(timeAligments[idx], allocator); + cfdThresholdsJson.PushBack(cfdThresholds[idx], allocator); + cfdZerosJson.PushBack(cfdZeros[idx], allocator); + adcZerosJson.PushBack(adcZeros[idx], allocator); + adcDelaysJson.PushBack(adcDelays[idx], allocator); + channelMaskDataJson.PushBack(channelMaskData[idx], allocator); + channelMaskTriggersJson.PushBack(channelMaskTriggers[idx], allocator); + } + + channels.AddMember("time_aligments", timeAligmentsJson, allocator); + channels.AddMember("cfd_thresholds", cfdThresholdsJson, allocator); + channels.AddMember("cfd_zeros", cfdZerosJson, allocator); + channels.AddMember("adc_zeros", adcZerosJson, allocator); + channels.AddMember("adc_delays", adcDelaysJson, allocator); + channels.AddMember("channel_mask_data", channelMaskDataJson, allocator); + channels.AddMember("channel_mask_triggers", channelMaskTriggersJson, allocator); + + doc.AddMember("channels", channels, allocator); + + ChannelsConfig parsed{}; + + SimpleFITFEEConfigurationReader reader; + reader.parseChannelData(doc, "channels", parsed); + + for (size_t idx = 0; idx < NTestChannels; ++idx) { + BOOST_CHECK_EQUAL(parsed.timeAligments[idx], timeAligments[idx]); + BOOST_CHECK_EQUAL(parsed.cfdThresholds[idx], cfdThresholds[idx]); + BOOST_CHECK_EQUAL(parsed.cfdZeros[idx], cfdZeros[idx]); + BOOST_CHECK_EQUAL(parsed.adcZeros[idx], adcZeros[idx]); + BOOST_CHECK_EQUAL(parsed.adcDelays[idx], adcDelays[idx]); + BOOST_CHECK_EQUAL(parsed.channelMaskData[idx], channelMaskData[idx]); + BOOST_CHECK_EQUAL(parsed.channelMaskTriggers[idx], + channelMaskTriggers[idx]); + } +} + +BOOST_AUTO_TEST_CASE(shouldAcceptValidFeeConfigurationPayload) { + rapidjson::Document doc; + doc.Parse(R"json( + { + "channels" : { + "time_aligments": [1,2,3,4], + "cfd_thresholds": [10,20,30,40], + "cfd_zeros": [11,22,33,44], + "adc_zeros": [21,22,23,24], + "adc_delays": [31,32,33,34], + "channel_mask_data": [true, false, true, false], + "channel_mask_triggers": [true, true, false, false] + }, + "pm_a": [ + {"or_gate": 1.21}, + {"or_gate": 1.22} + ], + "pm_c": [ + {"or_gate": 0.1}, + {"or_gate": 0.2} + ], + "tcm": { + "phase_delay_a": 3.3, + "phase_delay_c": 4.4 + }, + "triggers": { + "trigger_a": 123 + } + } + )json"); + + SimpleFITFEEConfigurationReader reader; + std::string errorMessage; + BOOST_CHECK_MESSAGE(reader.validateSchema(doc, errorMessage), errorMessage); +} +BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file From f1efb898dabf399844c6e4855cb1c51f5c27ee66 Mon Sep 17 00:00:00 2001 From: Wiktor Pierozak Date: Mon, 10 Aug 2026 18:02:31 +0200 Subject: [PATCH 16/28] Fixed FEE configuration serialization issue --- .../include/DataFormatsFT0/FeeConfiguration.h | 3 + .../FIT/FT0/src/DataFormatsFT0LinkDef.h | 4 +- .../Detectors/FIT/common/CMakeLists.txt | 3 +- .../include/DataFormatsFIT/Configuration.h | 7 +- .../FIT/common/src/DataFormatsFITLinkDef.h | 3 + .../src/FT0DCSConfigProcessor.cxx | 30 +++-- .../workflow/FT0DCSConfigProcessorSpec.h | 7 +- Detectors/FIT/FT0/macros/CMakeLists.txt | 6 + Detectors/FIT/FT0/macros/fetchFt0FeeConfig.C | 127 ++++++++++++++++++ .../FITDCSConfigProcessorSpec.h | 2 + .../FITFEEConfigurationReader.h | 20 ++- 11 files changed, 190 insertions(+), 22 deletions(-) create mode 100644 Detectors/FIT/FT0/macros/fetchFt0FeeConfig.C diff --git a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h index 09ff152577c6b..be238a6c4b73a 100644 --- a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h +++ b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h @@ -14,6 +14,7 @@ #include "CommonUtils/ConfigurableParamHelper.h" #include "DataFormatsFIT/Configuration.h" +#include namespace o2::ft0 { @@ -24,6 +25,8 @@ struct TriggersConfig { uint16_t semicentralC{o2::fit::config_helpers::DefaultValue}; uint16_t centralA{o2::fit::config_helpers::DefaultValue}; uint16_t centralC{o2::fit::config_helpers::DefaultValue}; + + ClassDefNV(TriggersConfig, 1); }; struct Ft0FeeConfiguration { diff --git a/DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h b/DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h index 411e069957646..b08e2d1a6f461 100644 --- a/DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h +++ b/DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h @@ -57,5 +57,7 @@ #pragma link C++ class o2::ft0::SlewingCoef + ; #pragma link C++ class o2::ft0::EventsPerBc + ; -#pragma link C++ class o2::ft0::Ft0FeeConfiguration + ; +#pragma link C++ struct o2::ft0::Ft0FeeConfiguration + ; +#pragma link C++ struct o2::ft0::TriggersConfig + ; +#pragma link C++ struct o2::fit::ChannelsConfig < 212> + ; #endif diff --git a/DataFormats/Detectors/FIT/common/CMakeLists.txt b/DataFormats/Detectors/FIT/common/CMakeLists.txt index 61dbcabc7f087..5d41438cecf7d 100644 --- a/DataFormats/Detectors/FIT/common/CMakeLists.txt +++ b/DataFormats/Detectors/FIT/common/CMakeLists.txt @@ -23,4 +23,5 @@ o2_target_root_dictionary(DataFormatsFIT include/DataFormatsFIT/LookUpTable.h include/DataFormatsFIT/Triggers.h include/DataFormatsFIT/ChannelData.h - include/DataFormatsFIT/Digit.h) + include/DataFormatsFIT/Digit.h + include/DataFormatsFIT/Configuration.h) diff --git a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h index 064b26b1c154f..b39ee1df7535f 100644 --- a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h +++ b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h @@ -22,6 +22,7 @@ #include #include #include +#include namespace o2::fit { @@ -56,12 +57,14 @@ struct TcmConfig { float phaseDelayC{config_helpers::DefaultValue}; bool operator==(const TcmConfig&) const = default; + ClassDefNV(TcmConfig, 1); }; struct PmConfig { uint8_t orGate{config_helpers::DefaultValue}; - + // charge thershold bool operator==(const PmConfig&) const = default; + ClassDefNV(PmConfig, 1); }; template @@ -116,6 +119,8 @@ struct ChannelsConfig { std::equal(std::begin(channelMaskTriggers), std::end(channelMaskTriggers), std::begin(other.channelMaskTriggers)); } + + ClassDefNV(ChannelsConfig, 1); }; } // namespace o2::fit #endif \ No newline at end of file diff --git a/DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h b/DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h index e005315e2d6a0..671841523961a 100644 --- a/DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h +++ b/DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h @@ -25,6 +25,9 @@ #pragma link C++ std::vector < std::pair < uint64_t, int>> + ; #pragma link C++ struct o2::fit::DCSDPValues + ; + +#pragma link C++ struct o2::fit::TcmConfig + ; +#pragma link C++ struct o2::fit::PmConfig + ; /* #include "DetectorsCommonDataFormats/DetID.h" #pragma link C++ struct o2::fit::ChannelData + ; diff --git a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx index 4a371f5975dcd..4b8fe6a27de7c 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx +++ b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx @@ -11,21 +11,25 @@ void FT0DCSConfigProcessor::init(o2::framework::InitContext& ic) void FT0DCSConfigProcessor::run(o2::framework::ProcessingContext& pc) { - long dataTime = getValidityTime(pc); + try { + long dataTime = getValidityTime(pc); - gsl::span dataBuffer = pc.inputs().get>("inputConfig"); - std::string configFileName = pc.inputs().get("inputConfigFileName"); - LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); + gsl::span dataBuffer = pc.inputs().get>("inputConfig"); + std::string configFileName = pc.inputs().get("inputConfigFileName"); + LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); - if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { - handleDeadChannelMapUpdate(pc, dataTime, dataBuffer); - } - if (mFeeConfigurationReader.matchFilename(configFileName)) { - Ft0FeeConfiguration feeConfiguration = mFeeConfigurationReader.parseFeeConfiguration(dataBuffer); - o2::ccdb::CcdbObjectInfo objectInfo = mFeeConfigurationReader.createObjectInfo(feeConfiguration, dataTime, {}); - sendObject(pc.outputs(), feeConfiguration, objectInfo, mFeeConfigurationReader.getDataDescriptor()); - } else { - LOG(error) << "Unknown input file: " << configFileName; + if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { + handleDeadChannelMapUpdate(pc, dataTime, dataBuffer); + } + if (mFeeConfigurationReader.matchFilename(configFileName)) { + Ft0FeeConfiguration feeConfiguration = mFeeConfigurationReader.parseFeeConfiguration(dataBuffer); + o2::ccdb::CcdbObjectInfo objectInfo = mFeeConfigurationReader.createObjectInfo(feeConfiguration, dataTime, {}); + sendObject(pc.outputs(), feeConfiguration, objectInfo, mFeeConfigurationReader.getDataDescriptor()); + } else { + LOG(error) << "Unknown input file: " << configFileName; + } + } catch (std::exception& e) { + LOG(error) << "Exception: " << e.what(); } } diff --git a/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h b/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h index f863b556395be..96997d7a176f4 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h +++ b/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h @@ -48,11 +48,10 @@ DataProcessorSpec getFT0DCSConfigProcessorSpec() {"filename-dchm", VariantType::String, "FT0-deadchannels.txt", {"Dead channel map file name"}}, {"valid-days-dchm", VariantType::UInt32, 180u, {"Dead channel map validity in days"}}, {"no-validate", VariantType::Bool, false, {"Don't validate the CCDB uploads"}}, - {"filename-fee-config", VariantType::String, "ft0-fee-config.json", {"FEE configuration file name"}} - } - }; + {"filename-fee-config", VariantType::String, "ft0-fee-config.json", {"FEE configuration file name"}}, + {"valid-days-fee-config", VariantType::UInt32, 180u, {"FEE configuration validity in days"}}}}; } -} // namespace framework +} // namespace o2::framework #endif // O2_FT0_DCSCONFIGPROCESSOR_SPEC_H diff --git a/Detectors/FIT/FT0/macros/CMakeLists.txt b/Detectors/FIT/FT0/macros/CMakeLists.txt index 17491ca4962c1..6e7b33ab87798 100644 --- a/Detectors/FIT/FT0/macros/CMakeLists.txt +++ b/Detectors/FIT/FT0/macros/CMakeLists.txt @@ -19,3 +19,9 @@ o2_add_test_root_macro(FT0readEventsPerBc.C O2::CCDB O2::DataFormatsFT0 LABELS ft0) + +o2_add_test_root_macro(fetchFt0FeeConfig.C + PUBLIC_LINK_LIBRARIES + O2::CCDB + O2::DataFormatsFT0 + LABELS ft0) \ No newline at end of file diff --git a/Detectors/FIT/FT0/macros/fetchFt0FeeConfig.C b/Detectors/FIT/FT0/macros/fetchFt0FeeConfig.C new file mode 100644 index 0000000000000..a5ae72351ab5d --- /dev/null +++ b/Detectors/FIT/FT0/macros/fetchFt0FeeConfig.C @@ -0,0 +1,127 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#if !defined(__CLING__) || defined(__ROOTCLING__) + +#include "CCDB/CcdbApi.h" +#include "DataFormatsFT0/FeeConfiguration.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#endif + +void fetchFt0FeeConfig(const std::string ccdbUrl = "http://alice-ccdb.cern.ch", long timestamp = -1, const std::string fileName = "ft0-fee-config.json", const std::string ccdbPath = "FT0/Config/FeeConfiguration") +{ + o2::ccdb::CcdbApi ccdbApi; + ccdbApi.init(ccdbUrl); + + std::map metadata; + std::unique_ptr config(ccdbApi.retrieveFromTFileAny(ccdbPath, metadata, timestamp)); + + if (!config) { + throw std::runtime_error("Cannot retrieve Ft0FeeConfiguration from CCDB path " + ccdbPath); + } + + rapidjson::Document doc; + doc.SetObject(); + auto& allocator = doc.GetAllocator(); + + rapidjson::Value channels(rapidjson::kObjectType); + rapidjson::Value timeAligments(rapidjson::kArrayType); + rapidjson::Value cfdThresholds(rapidjson::kArrayType); + rapidjson::Value cfdZeros(rapidjson::kArrayType); + rapidjson::Value adcZeros(rapidjson::kArrayType); + rapidjson::Value adcDelays(rapidjson::kArrayType); + rapidjson::Value channelMaskData(rapidjson::kArrayType); + rapidjson::Value channelMaskTriggers(rapidjson::kArrayType); + + for (int i = 0; i < o2::ft0::Ft0FeeConfiguration::NChannels; ++i) { + timeAligments.PushBack(config->channels.timeAligments[i], allocator); + cfdThresholds.PushBack(config->channels.cfdThresholds[i], allocator); + cfdZeros.PushBack(config->channels.cfdZeros[i], allocator); + adcZeros.PushBack(config->channels.adcZeros[i], allocator); + adcDelays.PushBack(config->channels.adcDelays[i], allocator); + channelMaskData.PushBack(config->channels.channelMaskData[i], allocator); + channelMaskTriggers.PushBack(config->channels.channelMaskTriggers[i], allocator); + } + + channels.AddMember("time_aligments", timeAligments, allocator); + channels.AddMember("cfd_thresholds", cfdThresholds, allocator); + channels.AddMember("cfd_zeros", cfdZeros, allocator); + channels.AddMember("adc_zeros", adcZeros, allocator); + channels.AddMember("adc_delays", adcDelays, allocator); + channels.AddMember("channel_mask_data", channelMaskData, allocator); + channels.AddMember("channel_mask_triggers", channelMaskTriggers, allocator); + doc.AddMember("channels", channels, allocator); + + rapidjson::Value tcm(rapidjson::kObjectType); + tcm.AddMember("phase_delay_a", config->tcm.phaseDelayA, allocator); + tcm.AddMember("phase_delay_c", config->tcm.phaseDelayC, allocator); + doc.AddMember("tcm", tcm, allocator); + + rapidjson::Value pmA(rapidjson::kArrayType); + + for (int i = 0; i < 10; ++i) { + rapidjson::Value pm(rapidjson::kObjectType); + + pm.AddMember("or_gate", config->pmA[i].orGate, allocator); + pmA.PushBack(pm, allocator); + } + doc.AddMember("pm_a", pmA, allocator); + + rapidjson::Value pmC(rapidjson::kArrayType); + for (int i = 0; i < 10; ++i) { + rapidjson::Value pm(rapidjson::kObjectType); + pm.AddMember("or_gate", config->pmC[i].orGate, allocator); + pmC.PushBack(pm, allocator); + } + doc.AddMember("pm_c", pmC, allocator); + + rapidjson::Value triggers(rapidjson::kObjectType); + triggers.AddMember("vertex_time_low_threshold", config->triggers.vertexTimeLowThreshold, allocator); + + triggers.AddMember("vertex_time_high_threshold", config->triggers.vertexTimeHighThreshold, allocator); + triggers.AddMember("semicentral_a", config->triggers.semicentralA, allocator); + triggers.AddMember("semicentral_c", config->triggers.semicentralC, allocator); + triggers.AddMember("central_a", config->triggers.centralA, allocator); + triggers.AddMember("central_c", config->triggers.centralC, allocator); + doc.AddMember("triggers", triggers, allocator); + + rapidjson::StringBuffer buffer; + rapidjson::PrettyWriter writer(buffer); + + doc.Accept(writer); + + if (fileName.empty()) { + std::cout << buffer.GetString() << '\n'; + return; + } + + std::ofstream output(fileName); + + if (!output) { + throw std::runtime_error( + "Cannot open output file " + fileName); + } + + output << buffer.GetString() << '\n'; + + std::cout << "FT0 FEE configuration written to " << fileName << '\n'; +} diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h index 182f07e8fbb29..d98c9166e6922 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h @@ -80,6 +80,8 @@ class FITDCSConfigProcessor : public o2::framework::Task void setupFeeConfigurationReader(o2::framework::InitContext& ic, FITFEEConfigurationReader& feeConfig) { feeConfig.setFilename(ic.options().get("filename-fee-config")); + feeConfig.setCcdbPath(mDetectorName + "/Config/FeeConfiguration"); + feeConfig.setValidityPeriodInDays(ic.options().get("valid-days-fee-config")); } void handleDeadChannelMapUpdate(o2::framework::ProcessingContext& pc, long dataTime, gsl::span dataBuffer) diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h index 47b8c3a6f8fda..3a2aa389e1eb0 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h @@ -42,7 +42,22 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader template o2::ccdb::CcdbObjectInfo createObjectInfo(const FeeConfigType& configObject, long startValidityTimestamp, const std::map& metadata) { - return FITDCSBaseConfigReader::createObjectInfo(configObject, startValidityTimestamp, o2::ccdb::CcdbObjectInfo::INFINITE_TIMESTAMP, metadata); + return FITDCSBaseConfigReader::createObjectInfo(configObject, startValidityTimestamp, getValidityTimestamp(startValidityTimestamp), metadata); + } + + long getValidityTimestamp(long startTimestamp) + { + return startTimestamp + mValidDays * o2::ccdb::CcdbObjectInfo::DAY; + } + + void setValidityPeriodInDays(long days) + { + mValidDays = days; + } + + long getValidityPeriodInDays() + { + return mValidDays; } protected: @@ -80,7 +95,7 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader } auto jsonArray = childNode.GetArray(); if (jsonArray.Size() != Size) { - throw std::runtime_error(std::format("Expected array of size {}, parsed array of size {}", Size, jsonArray.Size())); + throw std::runtime_error(std::format("Array {}. Expected array of size {}, parsed array of size {}", childName, Size, jsonArray.Size())); } for (int idx = 0; idx < Size; idx++) { const auto& node = jsonArray[idx]; @@ -199,6 +214,7 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader private: static const std::string configurationSchema; std::unique_ptr mSchema; + long mValidDays{180u}; }; template From a1a512a3e1621170675ea5b9dbd460b8c5ce02e2 Mon Sep 17 00:00:00 2001 From: Wiktor Pierozak Date: Tue, 11 Aug 2026 10:26:48 +0200 Subject: [PATCH 17/28] Created HvConfigurationReader and refactor DCSMonitoring classes --- DataFormats/Detectors/FIT/FT0/CMakeLists.txt | 1 + .../include/DataFormatsFT0/HvConfiguration.h | 27 ++++++ .../FIT/FT0/src/DataFormatsFT0LinkDef.h | 2 + .../include/DataFormatsFIT/Configuration.h | 12 +++ .../FDDDCSMonitoring/FDDDCSConfigProcessor.h | 7 +- .../FT0DCSMonitoring/FT0DCSConfigProcessor.h | 6 +- .../FT0FEEConfigurationReader.h | 4 - .../src/FT0DCSConfigProcessor.cxx | 10 ++- .../workflow/FT0DCSConfigProcessorSpec.h | 12 ++- .../FV0DCSMonitoring/FV0DCSConfigProcessor.h | 7 +- .../FIT/common/dcsmonitoring/CMakeLists.txt | 2 + .../include/FITDCSMonitoring/DcsCcdbInfo.h | 74 +++++++++++++++++ .../FITDCSMonitoring/FITDCSBaseConfigReader.h | 82 ++++++++++-------- .../FITDCSConfigProcessorSpec.h | 83 ++++++++----------- .../FITFEEConfigurationReader.h | 67 +-------------- .../FITHvConfigurationReader.h | 77 +++++++++++++++++ .../src/FITDCSBaseConfigReader.cxx | 50 +++++++++++ .../src/FITDCSConfigProcessorSpec.cxx | 59 +++++++++++++ 18 files changed, 419 insertions(+), 163 deletions(-) create mode 100644 DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/HvConfiguration.h create mode 100644 Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/DcsCcdbInfo.h create mode 100644 Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITHvConfigurationReader.h create mode 100644 Detectors/FIT/common/dcsmonitoring/src/FITDCSBaseConfigReader.cxx create mode 100644 Detectors/FIT/common/dcsmonitoring/src/FITDCSConfigProcessorSpec.cxx diff --git a/DataFormats/Detectors/FIT/FT0/CMakeLists.txt b/DataFormats/Detectors/FIT/FT0/CMakeLists.txt index 4909e91a395a8..05e51615b223f 100644 --- a/DataFormats/Detectors/FIT/FT0/CMakeLists.txt +++ b/DataFormats/Detectors/FIT/FT0/CMakeLists.txt @@ -49,4 +49,5 @@ o2_target_root_dictionary(DataFormatsFT0 include/DataFormatsFT0/SlewingCoef.h include/DataFormatsFT0/EventsPerBc.h include/DataFormatsFT0/FeeConfiguration.h + include/DataFormatsFT0/HvConfiguration.h ) diff --git a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/HvConfiguration.h b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/HvConfiguration.h new file mode 100644 index 0000000000000..934e8cff32785 --- /dev/null +++ b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/HvConfiguration.h @@ -0,0 +1,27 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef O2_FT0_HV_CONFIGURATION +#define O2_FT0_HV_CONFIGURATION + +#include "CommonUtils/ConfigurableParamHelper.h" +#include "DataFormatsFIT/Configuration.h" +#include + +namespace o2::ft0 +{ +struct Ft0HvConfiguration { + static constexpr int NChannels = 212; + o2::fit::HvChannelsConfig channels; + ClassDefNV(Ft0HvConfiguration, 1); +}; +} // namespace o2::ft0 +#endif \ No newline at end of file diff --git a/DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h b/DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h index b08e2d1a6f461..f6019a360ad26 100644 --- a/DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h +++ b/DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h @@ -60,4 +60,6 @@ #pragma link C++ struct o2::ft0::Ft0FeeConfiguration + ; #pragma link C++ struct o2::ft0::TriggersConfig + ; #pragma link C++ struct o2::fit::ChannelsConfig < 212> + ; +#pragma link C++ struct o2::ft0::Ft0HvConfiguration + ; +#pragma link C++ struct o2::fit::HvChannelsConfig < 212> + ; #endif diff --git a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h index b39ee1df7535f..00b3fdd2485d0 100644 --- a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h +++ b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h @@ -122,5 +122,17 @@ struct ChannelsConfig { ClassDefNV(ChannelsConfig, 1); }; + +template +struct HvChannelsConfig { + float gain[NChannels]; + + constexpr HvChannelsConfig() + { + config_helpers::fillDefaultArray(gain); + } + + ClassDefNV(HvChannelsConfig, 1); +}; } // namespace o2::fit #endif \ No newline at end of file diff --git a/Detectors/FIT/FDD/dcsmonitoring/include/FDDDCSMonitoring/FDDDCSConfigProcessor.h b/Detectors/FIT/FDD/dcsmonitoring/include/FDDDCSMonitoring/FDDDCSConfigProcessor.h index 6a94c80c935a5..20c332f302e67 100644 --- a/Detectors/FIT/FDD/dcsmonitoring/include/FDDDCSMonitoring/FDDDCSConfigProcessor.h +++ b/Detectors/FIT/FDD/dcsmonitoring/include/FDDDCSMonitoring/FDDDCSConfigProcessor.h @@ -16,16 +16,17 @@ #include "FITDCSMonitoring/FITDCSConfigProcessorSpec.h" -namespace o2::fdd { +namespace o2::fdd +{ class FDDDCSConfigProcessor : public o2::fit::FITDCSConfigProcessor { public: FDDDCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM) - : o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM) {} + : o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM, {}, {}) {} void init(o2::framework::InitContext& ic) final; void run(o2::framework::ProcessingContext& pc) final; void endOfStream(o2::framework::EndOfStreamContext& ec) final; }; -} +} // namespace o2::fdd #endif \ No newline at end of file diff --git a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigProcessor.h b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigProcessor.h index 64c682250d5f1..d89d811a520de 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigProcessor.h +++ b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigProcessor.h @@ -3,6 +3,7 @@ #include "FITDCSMonitoring/FITDCSConfigProcessorSpec.h" #include "FT0DCSMonitoring/FT0FEEConfigurationReader.h" +#include "FITDCSMonitoring/FITHvConfigurationReader.h" #include "DetectorsCalibration/Utils.h" #include "Framework/WorkflowSpec.h" #include "Headers/DataHeader.h" @@ -15,8 +16,8 @@ namespace o2::ft0 class FT0DCSConfigProcessor : public o2::fit::FITDCSConfigProcessor { public: - FT0DCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM) - : o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM) {} + FT0DCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM, const o2::header::DataDescription& dataDescriptionFeeConfig, const o2::header::DataDescription& dataDescriptionHvConfig) + : o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM, dataDescriptionFeeConfig, dataDescriptionHvConfig) {} void init(o2::framework::InitContext& ic) final; void run(o2::framework::ProcessingContext& pc) final; @@ -24,6 +25,7 @@ class FT0DCSConfigProcessor : public o2::fit::FITDCSConfigProcessor private: FT0FEEConfigurationReader mFeeConfigurationReader; + o2::fit::FITHvConfigurationReader mHvConfigurationReader; }; } // namespace o2::ft0 #endif // O2_FT0_DCSCONFIGPROCESSOR_H \ No newline at end of file diff --git a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0FEEConfigurationReader.h b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0FEEConfigurationReader.h index 9eed6b19f7712..9469f9ef63abb 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0FEEConfigurationReader.h +++ b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0FEEConfigurationReader.h @@ -25,10 +25,6 @@ namespace o2::ft0 class FT0FEEConfigurationReader : public o2::fit::FITFEEConfigurationReader { public: - FT0FEEConfigurationReader() - { - setDataDescriptor("FT0_FEE_CONFIG"); - } Ft0FeeConfiguration parseFeeConfiguration(gsl::span configBuf); void parseTriggers(const rapidjson::Value& root, const char* triggersNodeName, TriggersConfig& config); }; diff --git a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx index 4b8fe6a27de7c..0ddbe96e70248 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx +++ b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx @@ -1,4 +1,5 @@ #include "FT0DCSMonitoring/FT0DCSConfigProcessor.h" +#include "DataFormatsFT0/HvConfiguration.h" namespace o2::ft0 { @@ -7,6 +8,7 @@ void FT0DCSConfigProcessor::init(o2::framework::InitContext& ic) initDeadChannelMapReader(); setupDeadChannelMapReader(ic); setupFeeConfigurationReader(ic, mFeeConfigurationReader); + setupHvConfigurationReader(ic, mHvConfigurationReader); } void FT0DCSConfigProcessor::run(o2::framework::ProcessingContext& pc) @@ -23,8 +25,12 @@ void FT0DCSConfigProcessor::run(o2::framework::ProcessingContext& pc) } if (mFeeConfigurationReader.matchFilename(configFileName)) { Ft0FeeConfiguration feeConfiguration = mFeeConfigurationReader.parseFeeConfiguration(dataBuffer); - o2::ccdb::CcdbObjectInfo objectInfo = mFeeConfigurationReader.createObjectInfo(feeConfiguration, dataTime, {}); - sendObject(pc.outputs(), feeConfiguration, objectInfo, mFeeConfigurationReader.getDataDescriptor()); + o2::ccdb::CcdbObjectInfo objectInfo = mFeeConfigCcdbInfo.createObjectInfo(feeConfiguration, dataTime, {}); + sendObject(pc.outputs(), feeConfiguration, objectInfo, getFeeConfigDescription()); + } else if (mHvConfigurationReader.matchFilename(configFileName)) { + Ft0HvConfiguration hvConfig = mHvConfigurationReader.parseHvConfiguration(dataBuffer); + o2::ccdb::CcdbObjectInfo objectInfo = mHvConfigCcdbInfo.createObjectInfo(hvConfig, dataTime, {}); + sendObject(pc.outputs(), hvConfig, objectInfo, getHvConfigDescription()); } else { LOG(error) << "Unknown input file: " << configFileName; } diff --git a/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h b/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h index 96997d7a176f4..53eadb47c94c0 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h +++ b/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h @@ -34,16 +34,20 @@ DataProcessorSpec getFT0DCSConfigProcessorSpec() outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBPayload, ddDChM}, Lifetime::Sporadic); outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBWrapper, ddDChM}, Lifetime::Sporadic); - o2::header::DataDescription feeConifg = "FT0_FEE_CONFIG"; - outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBPayload, feeConifg}, Lifetime::Sporadic); - outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBWrapper, feeConifg}, Lifetime::Sporadic); + o2::header::DataDescription ddFeeConfig = "FT0_FEE_CONFIG"; + outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBPayload, ddFeeConfig}, Lifetime::Sporadic); + outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBWrapper, ddFeeConfig}, Lifetime::Sporadic); + + o2::header::DataDescription ddHvConfig = "FT0_HV_CONFIG"; + outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBPayload, ddHvConfig}, Lifetime::Sporadic); + outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBWrapper, ddHvConfig}, Lifetime::Sporadic); return DataProcessorSpec{ "ft0-dcs-config-processor", Inputs{{"inputConfig", o2::header::gDataOriginFT0, "DCS_CONFIG_FILE", Lifetime::Sporadic}, {"inputConfigFileName", o2::header::gDataOriginFT0, "DCS_CONFIG_NAME", Lifetime::Sporadic}}, outputs, - AlgorithmSpec{adaptFromTask("FT0", ddDChM)}, + AlgorithmSpec{adaptFromTask("FT0", ddDChM, ddFeeConfig, ddHvConfig)}, Options{{"use-verbose-mode", VariantType::Bool, false, {"Use verbose mode"}}, {"filename-dchm", VariantType::String, "FT0-deadchannels.txt", {"Dead channel map file name"}}, {"valid-days-dchm", VariantType::UInt32, 180u, {"Dead channel map validity in days"}}, diff --git a/Detectors/FIT/FV0/dcsmonitoring/include/FV0DCSMonitoring/FV0DCSConfigProcessor.h b/Detectors/FIT/FV0/dcsmonitoring/include/FV0DCSMonitoring/FV0DCSConfigProcessor.h index 1b6e69939edfd..fd3519a6f7187 100644 --- a/Detectors/FIT/FV0/dcsmonitoring/include/FV0DCSMonitoring/FV0DCSConfigProcessor.h +++ b/Detectors/FIT/FV0/dcsmonitoring/include/FV0DCSMonitoring/FV0DCSConfigProcessor.h @@ -15,16 +15,17 @@ #define O2_FV0_DCS_CONFIG_PROCESSOR_H #include "FITDCSMonitoring/FITDCSConfigProcessorSpec.h" -namespace o2::fv0 { +namespace o2::fv0 +{ class FV0DCSConfigProcessor : public o2::fit::FITDCSConfigProcessor { public: FV0DCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM) - : o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM) {} + : o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM, {}, {}) {} void init(o2::framework::InitContext& ic) final; void run(o2::framework::ProcessingContext& pc) final; void endOfStream(o2::framework::EndOfStreamContext& ec) final; }; -} +} // namespace o2::fv0 #endif \ No newline at end of file diff --git a/Detectors/FIT/common/dcsmonitoring/CMakeLists.txt b/Detectors/FIT/common/dcsmonitoring/CMakeLists.txt index b76269805330f..bd49845f5d8d1 100644 --- a/Detectors/FIT/common/dcsmonitoring/CMakeLists.txt +++ b/Detectors/FIT/common/dcsmonitoring/CMakeLists.txt @@ -13,6 +13,8 @@ o2_add_library(FITDCSMonitoring SOURCES src/FITDCSDataProcessor.cxx src/FITDCSDataReader.cxx src/FITDeadChannelMapReader.cxx + src/FITDCSConfigProcessorSpec.cxx + src/FITDCSBaseConfigReader.cxx PUBLIC_LINK_LIBRARIES O2::DataFormatsFIT O2::DetectorsCalibration O2::DetectorsDCS) diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/DcsCcdbInfo.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/DcsCcdbInfo.h new file mode 100644 index 0000000000000..4cde419046d83 --- /dev/null +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/DcsCcdbInfo.h @@ -0,0 +1,74 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef O2_FIT_DCS_VALIDITY_H +#define O2_FIT_DCS_VALIDITY_H + +#include "CCDB/CcdbApi.h" + +namespace o2::fit +{ +class DcsCcdbInfo +{ + public: + DcsCcdbInfo(long validityInDays) : mValidityDays(validityInDays) {} + + long getValidityTimestamp(long startTimestamp) const + { + return startTimestamp + mValidityDays * o2::ccdb::CcdbObjectInfo::DAY; + } + + void setValidityPeriodInDays(long days) + { + mValidityDays = days; + } + + long getValidityPeriodInDays() const + { + return mValidityDays; + } + + void setValidateUpload(bool validate) + { + mValidateUpload = validate; + } + + bool getValidateUpload() const + { + return mValidateUpload; + } + + void setCcdbPath(const std::string path) + { + mCcdbPath = path; + } + + const std::string& getCcdbPath() const + { + return mCcdbPath; + } + + template + o2::ccdb::CcdbObjectInfo createObjectInfo(const DcsConfigType& configObject, long startValidityTimestamp, const std::map& metadata) + { + o2::ccdb::CcdbObjectInfo objectInfo; + o2::calibration::Utils::prepareCCDBobjectInfo(configObject, objectInfo, mCcdbPath, metadata, startValidityTimestamp, getValidityTimestamp(startValidityTimestamp)); + objectInfo.setValidateUpload(mValidateUpload); + return objectInfo; + } + + private: + long mValidityDays; + bool mValidateUpload; + std::string mCcdbPath; +}; +} // namespace o2::fit +#endif \ No newline at end of file diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSBaseConfigReader.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSBaseConfigReader.h index cc07e814da650..decb3ce515c16 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSBaseConfigReader.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSBaseConfigReader.h @@ -12,6 +12,9 @@ #ifndef O2_FIT_DCS_BASE_CONFIG_READER_H #define O2_FIT_DCS_BASE_CONFIG_READER_H +#include +#include +#include #include "DetectorsCalibration/Utils.h" namespace o2::fit @@ -19,28 +22,53 @@ namespace o2::fit class FITDCSBaseConfigReader { public: - template - o2::ccdb::CcdbObjectInfo createObjectInfo(const FeeConfigType& configObject, long startValidityTimestamp, long endValidityTimestamp, const std::map& metadata) + template + void parseJsonArray(const rapidjson::Value& node, const char* childName, T (&array)[Size]) { - o2::ccdb::CcdbObjectInfo objectInfo; - o2::calibration::Utils::prepareCCDBobjectInfo(configObject, objectInfo, mCcdbPath, metadata, startValidityTimestamp, endValidityTimestamp); - objectInfo.setValidateUpload(mValidateUpload); - return objectInfo; - } - - void setCcdbPath(const std::string& path) - { - mCcdbPath = path; - } - const std::string& getCcdbPath() const - { - return mCcdbPath; + if (node.HasMember(childName) == false) { + throw std::runtime_error(std::string("Failed to find node of name ") + childName); + } + const auto& childNode = node[childName]; + if (childNode.IsArray() == false) { + throw std::runtime_error(std::format("Node {} is not an array!", childName)); + } + auto jsonArray = childNode.GetArray(); + if (jsonArray.Size() != Size) { + throw std::runtime_error(std::format("Array {}. Expected array of size {}, parsed array of size {}", childName, Size, jsonArray.Size())); + } + for (int idx = 0; idx < Size; idx++) { + const auto& node = jsonArray[idx]; + if constexpr (std::is_same_v) { + if (!node.IsBool()) { + throw std::runtime_error(std::format("{} is not a bool array", childName)); + } + array[idx] = node.GetBool(); + } else if constexpr (std::is_floating_point_v) { + if (!node.IsNumber()) { + throw std::runtime_error(std::format("{} is not an floating point array", childName)); + } + array[idx] = node.GetFloat(); + } else if constexpr (std::is_integral_v && std::is_unsigned_v) { + if (!node.IsUint()) { + throw std::runtime_error(std::format("{} is not an unsigned integer array", childName)); + } + array[idx] = static_cast(node.GetUint()); + } else if constexpr (std::is_integral_v) { + if (!node.IsInt()) { + throw std::runtime_error(std::format("{} is not an integer array", childName)); + } + array[idx] = static_cast(node.GetInt()); + } else { + static_assert(std::is_same_v, "Unsupported type"); + } + } } void setFilename(const std::string& filename) { mFilename = filename; } + const std::string& getFilename() const { return mFilename; @@ -51,29 +79,15 @@ class FITDCSBaseConfigReader return mFilename == filename; } - void setValidateUpload(bool validate) - { - mValidateUpload = validate; - } - bool getValidateUpload() const - { - return mValidateUpload; - } + bool validateSchema(const rapidjson::Document& docs, std::string& errorMessage); - void setDataDescriptor(o2::header::DataDescription descriptor) - { - mDataDescriptor = descriptor; - } - const o2::header::DataDescription& getDataDescriptor() const - { - return mDataDescriptor; - } + protected: + void loadSchema(const std::string& schema); + rapidjson::Document parseJsonBuffer(gsl::span buffer, bool throwOnInvalidSchema = true); private: - std::string mCcdbPath; - o2::header::DataDescription mDataDescriptor; std::string mFilename; - bool mValidateUpload; + std::unique_ptr mSchema; }; } // namespace o2::fit #endif \ No newline at end of file diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h index d98c9166e6922..3031076fc3ec1 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h @@ -21,6 +21,9 @@ #include "DetectorsCalibration/Utils.h" #include "FITDCSMonitoring/FITDeadChannelMapReader.h" #include "FITDCSMonitoring/FITFEEConfigurationReader.h" +#include "FITDCSMonitoring/FITHvConfigurationReader.h" +#include "FITDCSMonitoring/DcsCcdbInfo.h" + #include "Framework/ConfigParamRegistry.h" #include "Framework/Task.h" #include "Framework/WorkflowSpec.h" @@ -39,68 +42,33 @@ namespace fit class FITDCSConfigProcessor : public o2::framework::Task { public: - FITDCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM) + FITDCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM, const o2::header::DataDescription& dataDescriptionFeeConfig, const o2::header::DataDescription& dataDescriptionHvConfig) : mDetectorName(detectorName), - mDataDescriptionDChM(dataDescriptionDChM) {} // TODO AM: how to pass dd + mDataDescriptionDChM(dataDescriptionDChM), + mDataDescriptionFeeConfig(dataDescriptionFeeConfig), + mDataDescriptionHvConfig(dataDescriptionHvConfig) {} // TODO AM: how to pass dd protected: /// Initializes the DCS config reader. /// Can be overriden in case another reader (subclass of o2::fit::FITDeadChannelMapReader) is needed. - virtual void initDeadChannelMapReader() - { - mDeadChannelMapReader = std::make_unique(FITDeadChannelMapReader()); - } + virtual void initDeadChannelMapReader(); - long getValidityTime(o2::framework::ProcessingContext& pc) - { - long dataTime = (long)(pc.services().get().creation); - if (dataTime == 0xffffffffffffffff) { // means it is not set - dataTime = std::chrono::duration_cast(std::chrono::high_resolution_clock::now().time_since_epoch()).count(); // in ms - } - return dataTime; - } + long getValidityTime(o2::framework::ProcessingContext& pc); - void setupDeadChannelMapReader(o2::framework::InitContext& ic) - { - mDeadChannelMapReader->setFileNameDChM(ic.options().get("filename-dchm")); - mDeadChannelMapReader->setValidDaysDChM(ic.options().get("valid-days-dchm")); - mDeadChannelMapReader->setCcdbPathDChM(mDetectorName + "/Calib/DeadChannelMap"); - bool verbose = ic.options().get("use-verbose-mode"); - mDeadChannelMapReader->setVerboseMode(verbose); - bool validateUpload = !ic.options().get("no-validate"); - mDeadChannelMapReader->setValidateUploadMode(validateUpload); - - LOG(info) << "Verbose mode: " << verbose; - LOG(info) << "Validate upload: " << validateUpload; - LOG(info) << "Expected dead channel map file name: " << mDeadChannelMapReader->getFileNameDChM(); - LOG(info) << "Dead channel maps will be valid for " << mDeadChannelMapReader->getValidDaysDChM() << " days"; - } + void setupDeadChannelMapReader(o2::framework::InitContext& ic); template void setupFeeConfigurationReader(o2::framework::InitContext& ic, FITFEEConfigurationReader& feeConfig) { feeConfig.setFilename(ic.options().get("filename-fee-config")); - feeConfig.setCcdbPath(mDetectorName + "/Config/FeeConfiguration"); - feeConfig.setValidityPeriodInDays(ic.options().get("valid-days-fee-config")); + mFeeConfigCcdbInfo.setCcdbPath(mDetectorName + "/Config/FeeConfiguration"); + mFeeConfigCcdbInfo.setValidityPeriodInDays(ic.options().get("valid-days-fee-config")); } - void handleDeadChannelMapUpdate(o2::framework::ProcessingContext& pc, long dataTime, gsl::span dataBuffer) - { - processDeadChannelMap(dataTime, dataBuffer); - sendObject(pc.outputs(), mDeadChannelMapReader->getDChM(), mDeadChannelMapReader->getObjectInfoDChM(), mDataDescriptionDChM); - mDeadChannelMapReader->resetStartValidityDChM(); - mDeadChannelMapReader->resetDChM(); - } + void setupHvConfigurationReader(o2::framework::InitContext& ic, FITHvConfigurationReader& hvReader); - /// Processing the dead channel map - void processDeadChannelMap(const long& dataTime, gsl::span dataBuffer) - { - if (!mDeadChannelMapReader->isStartValidityDChMSet()) { - mDeadChannelMapReader->setStartValidityDChM(dataTime); - } - mDeadChannelMapReader->processDChM(dataBuffer); - mDeadChannelMapReader->updateDChMCcdbObjectInfo(); - } + void handleDeadChannelMapUpdate(o2::framework::ProcessingContext& pc, long dataTime, gsl::span dataBuffer); + void processDeadChannelMap(const long& dataTime, gsl::span dataBuffer); template void sendObject(o2::framework::DataAllocator& output, const ConfigObjectType& object, o2::ccdb::CcdbObjectInfo& info, const o2::header::DataDescription& descriptor) @@ -114,9 +82,30 @@ class FITDCSConfigProcessor : public o2::framework::Task std::unique_ptr mDeadChannelMapReader; + const o2::header::DataDescription& getFeeConfigDescription() const + { + return mDataDescriptionFeeConfig; + } + + const o2::header::DataDescription& getHvConfigDescription() const + { + return mDataDescriptionHvConfig; + } + + const o2::header::DataDescription& getDeadChannelMapDescription() const + { + return mDataDescriptionDChM; + } + + protected: + DcsCcdbInfo mFeeConfigCcdbInfo{180u}; + DcsCcdbInfo mHvConfigCcdbInfo{180u}; + private: std::string mDetectorName; ///< Detector name o2::header::DataDescription mDataDescriptionDChM; ///< DataDescription for the dead channel map + o2::header::DataDescription mDataDescriptionFeeConfig; + o2::header::DataDescription mDataDescriptionHvConfig; }; } // namespace fit diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h index 3a2aa389e1eb0..def49faf6b437 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h @@ -9,11 +9,6 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file FITDCSConfigurationDataParser.h -/// \brief DCS configuration reader for FIT -/// -/// \author Andreas Molander , University of Jyvaskyla, Finland - #ifndef O2_FIT_DCS_CONFIGURATION_DATA_READER_H #define O2_FIT_DCS_CONFIGURATION_DATA_READER_H @@ -31,49 +26,15 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader public: FITFEEConfigurationReader() { - rapidjson::Document schemaDocument; - schemaDocument.Parse(configurationSchema.c_str()); - if (schemaDocument.HasParseError()) { - throw std::runtime_error("Cannot parse FIT FEE JSON schema"); - } - mSchema = std::make_unique(schemaDocument); - } - - template - o2::ccdb::CcdbObjectInfo createObjectInfo(const FeeConfigType& configObject, long startValidityTimestamp, const std::map& metadata) - { - return FITDCSBaseConfigReader::createObjectInfo(configObject, startValidityTimestamp, getValidityTimestamp(startValidityTimestamp), metadata); - } - - long getValidityTimestamp(long startTimestamp) - { - return startTimestamp + mValidDays * o2::ccdb::CcdbObjectInfo::DAY; - } - - void setValidityPeriodInDays(long days) - { - mValidDays = days; - } - - long getValidityPeriodInDays() - { - return mValidDays; + loadSchema(configurationSchema); } protected: template ConfigType parseFeeConfiguration(gsl::span buffer) { + rapidjson::Document document = parseJsonBuffer(buffer); ConfigType configuration; - rapidjson::MemoryStream ms(buffer.data(), buffer.size()); - rapidjson::Document document; - document.ParseStream(ms); - - std::string validationErrorMessage; - if (validateSchema(document, validationErrorMessage) == false) { - std::string_view bufferView(buffer.data(), buffer.size()); - throw std::runtime_error("Received document does not match FEE configuration schema! Error message: " + validationErrorMessage); - } parseChannelData(document, "channels", configuration.channels); parseTcmConfig(document, "tcm", configuration.tcm); @@ -83,6 +44,7 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader return configuration; } + template void parseJsonArray(const rapidjson::Value& node, const char* childName, T (&array)[Size]) { @@ -185,27 +147,6 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader } } - bool validateSchema(const rapidjson::Document& docs, std::string& errorMessage) - { - rapidjson::SchemaValidator validator(*mSchema); - if (docs.Accept(validator) == false) { - rapidjson::StringBuffer buffer; - std::ostringstream ss; - validator.GetInvalidSchemaPointer().StringifyUriFragment(buffer); - ss << "Invalid schema: " << buffer.GetString() << '\n'; - ss << "Invalid keyword: " << validator.GetInvalidSchemaKeyword() << '\n'; - - buffer.Clear(); - - validator.GetInvalidDocumentPointer().StringifyUriFragment(buffer); - ss << "Invalid document: " << buffer.GetString() << '\n'; - - errorMessage = ss.str(); - return false; - } - return true; - } - const std::string& getSchemaString() const { return configurationSchema; @@ -213,8 +154,6 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader private: static const std::string configurationSchema; - std::unique_ptr mSchema; - long mValidDays{180u}; }; template diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITHvConfigurationReader.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITHvConfigurationReader.h new file mode 100644 index 0000000000000..bafe05dff90b7 --- /dev/null +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITHvConfigurationReader.h @@ -0,0 +1,77 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef O2_FIT_DCS_HV_CONFIGURATION_DATA_READER_H +#define O2_FIT_DCS_HV_CONFIGURATION_DATA_READER_H + +#include +#include +#include "DataFormatsFIT/Configuration.h" +#include "DetectorsCalibration/Utils.h" +#include "FITDCSMonitoring/FITDCSBaseConfigReader.h" + +namespace o2::fit +{ +class FITHvConfigurationReader : public FITDCSBaseConfigReader +{ + public: + FITHvConfigurationReader() + { + loadSchema(configurationSchema); + } + + template + ConfigType parseHvConfiguration(gsl::span buffer) + { + rapidjson::Document root = parseJsonBuffer(buffer); + ConfigType configuration; + parseHvChannelData(root, "hv_channels", configuration.channels); + return configuration; + } + + template + void parseHvChannelData(rapidjson::Value& root, const char* hvChannelsNode, HvChannelsConfig& config) + { + const auto& hvChannels = root[hvChannelsNode]; + parseJsonArray(hvChannels, "gain", config.gain); + } + + const std::string& getSchemaString() const + { + return configurationSchema; + } + + private: + static const std::string configurationSchema; +}; + +const std::string FITHvConfigurationReader::configurationSchema = R"json( +{ + "type": "object", + "properties": { + "channels": { + "type": "object", + "properties": { + "gain" : { + "type": "array", + "items": {"type": "number"} + } + } + }, + "additionalProperties": false, + "required": ["gain"] + }, + "additionalProperties": false, + "required": ["channels"] +} +)json"; +} // namespace o2::fit +#endif \ No newline at end of file diff --git a/Detectors/FIT/common/dcsmonitoring/src/FITDCSBaseConfigReader.cxx b/Detectors/FIT/common/dcsmonitoring/src/FITDCSBaseConfigReader.cxx new file mode 100644 index 0000000000000..bb66b0a8b65f3 --- /dev/null +++ b/Detectors/FIT/common/dcsmonitoring/src/FITDCSBaseConfigReader.cxx @@ -0,0 +1,50 @@ +#include "FITDCSMonitoring/FITDCSBaseConfigReader.h" + +namespace o2::fit +{ +rapidjson::Document FITDCSBaseConfigReader::parseJsonBuffer(gsl::span buffer, bool throwOnInvalidSchema) +{ + rapidjson::MemoryStream ms(buffer.data(), buffer.size()); + rapidjson::Document document; + document.ParseStream(ms); + + std::string validationErrorMessage; + if ((!throwOnInvalidSchema || validateSchema(document, validationErrorMessage)) == false) { + std::string_view bufferView(buffer.data(), buffer.size()); + throw std::runtime_error("Received document does not match FEE configuration schema! Error message: " + validationErrorMessage); + } + + return document; +} + +void FITDCSBaseConfigReader::loadSchema(const std::string& schema) +{ + rapidjson::Document schemaDocument; + schemaDocument.Parse(schema.c_str()); + if (schemaDocument.HasParseError()) { + throw std::runtime_error("Cannot parse JSON schema"); + } + mSchema = std::make_unique(schemaDocument); +} + +bool FITDCSBaseConfigReader::validateSchema(const rapidjson::Document& docs, std::string& errorMessage) +{ + rapidjson::SchemaValidator validator(*mSchema); + if (docs.Accept(validator) == false) { + rapidjson::StringBuffer buffer; + std::ostringstream ss; + validator.GetInvalidSchemaPointer().StringifyUriFragment(buffer); + ss << "Invalid schema: " << buffer.GetString() << '\n'; + ss << "Invalid keyword: " << validator.GetInvalidSchemaKeyword() << '\n'; + + buffer.Clear(); + + validator.GetInvalidDocumentPointer().StringifyUriFragment(buffer); + ss << "Invalid document: " << buffer.GetString() << '\n'; + + errorMessage = ss.str(); + return false; + } + return true; +} +} // namespace o2::fit \ No newline at end of file diff --git a/Detectors/FIT/common/dcsmonitoring/src/FITDCSConfigProcessorSpec.cxx b/Detectors/FIT/common/dcsmonitoring/src/FITDCSConfigProcessorSpec.cxx new file mode 100644 index 0000000000000..8a7ec7d0eb166 --- /dev/null +++ b/Detectors/FIT/common/dcsmonitoring/src/FITDCSConfigProcessorSpec.cxx @@ -0,0 +1,59 @@ +#include "FITDCSMonitoring/FITDCSConfigProcessorSpec.h" + +namespace o2::fit +{ +void FITDCSConfigProcessor::initDeadChannelMapReader() +{ + mDeadChannelMapReader = std::make_unique(FITDeadChannelMapReader()); +} + +long FITDCSConfigProcessor::getValidityTime(o2::framework::ProcessingContext& pc) +{ + long dataTime = (long)(pc.services().get().creation); + if (dataTime == 0xffffffffffffffff) { // means it is not set + dataTime = std::chrono::duration_cast(std::chrono::high_resolution_clock::now().time_since_epoch()).count(); // in ms + } + return dataTime; +} + +void FITDCSConfigProcessor::setupDeadChannelMapReader(o2::framework::InitContext& ic) +{ + mDeadChannelMapReader->setFileNameDChM(ic.options().get("filename-dchm")); + mDeadChannelMapReader->setValidDaysDChM(ic.options().get("valid-days-dchm")); + mDeadChannelMapReader->setCcdbPathDChM(mDetectorName + "/Calib/DeadChannelMap"); + bool verbose = ic.options().get("use-verbose-mode"); + mDeadChannelMapReader->setVerboseMode(verbose); + bool validateUpload = !ic.options().get("no-validate"); + mDeadChannelMapReader->setValidateUploadMode(validateUpload); + + LOG(info) << "Verbose mode: " << verbose; + LOG(info) << "Validate upload: " << validateUpload; + LOG(info) << "Expected dead channel map file name: " << mDeadChannelMapReader->getFileNameDChM(); + LOG(info) << "Dead channel maps will be valid for " << mDeadChannelMapReader->getValidDaysDChM() << " days"; +} + +void FITDCSConfigProcessor::handleDeadChannelMapUpdate(o2::framework::ProcessingContext& pc, long dataTime, gsl::span dataBuffer) +{ + processDeadChannelMap(dataTime, dataBuffer); + sendObject(pc.outputs(), mDeadChannelMapReader->getDChM(), mDeadChannelMapReader->getObjectInfoDChM(), mDataDescriptionDChM); + mDeadChannelMapReader->resetStartValidityDChM(); + mDeadChannelMapReader->resetDChM(); +} + +/// Processing the dead channel map +void FITDCSConfigProcessor::processDeadChannelMap(const long& dataTime, gsl::span dataBuffer) +{ + if (!mDeadChannelMapReader->isStartValidityDChMSet()) { + mDeadChannelMapReader->setStartValidityDChM(dataTime); + } + mDeadChannelMapReader->processDChM(dataBuffer); + mDeadChannelMapReader->updateDChMCcdbObjectInfo(); +} + +void FITDCSConfigProcessor::setupHvConfigurationReader(o2::framework::InitContext& ic, FITHvConfigurationReader& hvReader) +{ + hvReader.setFilename(ic.options().get("filename-hv-config")); + mHvConfigCcdbInfo.setCcdbPath(mDetectorName + "/Config/HvConfiguration"); + mHvConfigCcdbInfo.setValidityPeriodInDays(ic.options().get("valid-days-hv-config")); +} +} // namespace o2::fit \ No newline at end of file From ccef6c45513efd79a72c077b252f2bbbd857a5bc Mon Sep 17 00:00:00 2001 From: Wiktor Pierozak Date: Tue, 11 Aug 2026 14:43:45 +0200 Subject: [PATCH 18/28] Created unit tests for FITHvConfigurationReader and fixed runtime issues in FT0DataProcessor --- .../include/DataFormatsFIT/Configuration.h | 5 +- .../src/FT0DCSConfigProcessor.cxx | 6 +- .../workflow/FT0DCSConfigProcessorSpec.h | 6 +- .../FITHvConfigurationReader.h | 4 +- Detectors/FIT/common/tests/CMakeLists.txt | 8 +- .../FITFEEConfigurationReaderTest.cxx | 371 ++++++++++-------- .../FITHvConfigurationReaderTest.cxx | 91 +++++ 7 files changed, 323 insertions(+), 168 deletions(-) create mode 100644 Detectors/FIT/common/tests/dcsmonitoring/FITHvConfigurationReaderTest.cxx diff --git a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h index 00b3fdd2485d0..3e4111072210e 100644 --- a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h +++ b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h @@ -131,7 +131,10 @@ struct HvChannelsConfig { { config_helpers::fillDefaultArray(gain); } - + bool operator==(const HvChannelsConfig& other) const + { + return std::equal(std::begin(gain), std::end(gain), std::begin(other.gain)); + } ClassDefNV(HvChannelsConfig, 1); }; } // namespace o2::fit diff --git a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx index 0ddbe96e70248..a88abeabba772 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx +++ b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx @@ -19,11 +19,11 @@ void FT0DCSConfigProcessor::run(o2::framework::ProcessingContext& pc) gsl::span dataBuffer = pc.inputs().get>("inputConfig"); std::string configFileName = pc.inputs().get("inputConfigFileName"); LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); - + LOG(info) << "FEE filename: " << mFeeConfigurationReader.getFilename(); + LOG(info) << "HV filename: " << mHvConfigurationReader.getFilename(); if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { handleDeadChannelMapUpdate(pc, dataTime, dataBuffer); - } - if (mFeeConfigurationReader.matchFilename(configFileName)) { + } else if (mFeeConfigurationReader.matchFilename(configFileName)) { Ft0FeeConfiguration feeConfiguration = mFeeConfigurationReader.parseFeeConfiguration(dataBuffer); o2::ccdb::CcdbObjectInfo objectInfo = mFeeConfigCcdbInfo.createObjectInfo(feeConfiguration, dataTime, {}); sendObject(pc.outputs(), feeConfiguration, objectInfo, getFeeConfigDescription()); diff --git a/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h b/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h index 53eadb47c94c0..2da3ec9aa366b 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h +++ b/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h @@ -53,7 +53,11 @@ DataProcessorSpec getFT0DCSConfigProcessorSpec() {"valid-days-dchm", VariantType::UInt32, 180u, {"Dead channel map validity in days"}}, {"no-validate", VariantType::Bool, false, {"Don't validate the CCDB uploads"}}, {"filename-fee-config", VariantType::String, "ft0-fee-config.json", {"FEE configuration file name"}}, - {"valid-days-fee-config", VariantType::UInt32, 180u, {"FEE configuration validity in days"}}}}; + {"valid-days-fee-config", VariantType::UInt32, 180u, {"FEE configuration validity in days"}}, + {"filename-hv-config", VariantType::String, "ft0-hv-config.json", {"HV configuration file name"}}, + {"valid-days-hv-config", VariantType::UInt32, 180u, {"HV configuration validity in days"}} + } + }; } } // namespace o2::framework diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITHvConfigurationReader.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITHvConfigurationReader.h index bafe05dff90b7..2733981086a15 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITHvConfigurationReader.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITHvConfigurationReader.h @@ -57,7 +57,7 @@ const std::string FITHvConfigurationReader::configurationSchema = R"json( { "type": "object", "properties": { - "channels": { + "hv_channels": { "type": "object", "properties": { "gain" : { @@ -70,7 +70,7 @@ const std::string FITHvConfigurationReader::configurationSchema = R"json( "required": ["gain"] }, "additionalProperties": false, - "required": ["channels"] + "required": ["hv_channels"] } )json"; } // namespace o2::fit diff --git a/Detectors/FIT/common/tests/CMakeLists.txt b/Detectors/FIT/common/tests/CMakeLists.txt index d3272a4a97c6c..937f0e7b18d37 100644 --- a/Detectors/FIT/common/tests/CMakeLists.txt +++ b/Detectors/FIT/common/tests/CMakeLists.txt @@ -13,4 +13,10 @@ o2_add_test(FITFEEConfigurationReader COMPONENT_NAME fit_fee_config_reader LABELS fit PUBLIC_LINK_LIBRARIES O2::DataFormatsFIT O2::FITDCSMonitoring - SOURCES dcsmonitoring/FITFEEConfigurationReaderTest.cxx) \ No newline at end of file + SOURCES dcsmonitoring/FITFEEConfigurationReaderTest.cxx) + +o2_add_test(FITHvConfigurationReader + COMPONENT_NAME fit_hv_config_reader + LABELS fit + PUBLIC_LINK_LIBRARIES O2::DataFormatsFIT O2::FITDCSMonitoring + SOURCES dcsmonitoring/FITHvConfigurationReaderTest.cxx) \ No newline at end of file diff --git a/Detectors/FIT/common/tests/dcsmonitoring/FITFEEConfigurationReaderTest.cxx b/Detectors/FIT/common/tests/dcsmonitoring/FITFEEConfigurationReaderTest.cxx index c8302a5159678..baab2f0a50deb 100644 --- a/Detectors/FIT/common/tests/dcsmonitoring/FITFEEConfigurationReaderTest.cxx +++ b/Detectors/FIT/common/tests/dcsmonitoring/FITFEEConfigurationReaderTest.cxx @@ -15,15 +15,17 @@ #include #include -#include "FITDCSMonitoring/FITFEEConfigurationReader.h" + #include "DataFormatsFIT/Configuration.h" +#include "FITDCSMonitoring/FITFEEConfigurationReader.h" using namespace o2::fit; BOOST_AUTO_TEST_SUITE(o2_fit_dcs_monitoring) + // Dummy structure for trigger data for complete definition of FEE configuration structure struct SimpleTriggers { - int32_t triggerA; + int32_t triggerA; }; // Test configuration structure @@ -36,169 +38,215 @@ struct SimpleConfiguration { o2::fit::PmConfig pmC[2]; }; -class SimpleFITFEEConfigurationReader: public FITFEEConfigurationReader{ -public: - // Dummy method to parse dummy triggers payload - SimpleTriggers parseTriggers(const rapidjson::Value& node, const char* childName, SimpleTriggers& triggers) { - triggers.triggerA = 32; - } - using FITFEEConfigurationReader::parseFeeConfiguration; - using FITFEEConfigurationReader::parseJsonArray; - using FITFEEConfigurationReader::parseChannelData; - using FITFEEConfigurationReader::parseTcmConfig; - using FITFEEConfigurationReader::parsePmConfig; - using FITFEEConfigurationReader::parsePmsArray; - using FITFEEConfigurationReader::validateSchema; -}; +rapidjson::Document createEmptyPayload() +{ + rapidjson::Document doc; + doc.SetObject(); + return doc; +} -BOOST_AUTO_TEST_CASE(shouldParseSinglePmConfig) +rapidjson::Document createDocumentFromString(const char* data) { - const uint8_t orGateValue = 20; - rapidjson::Document doc; - doc.SetObject(); - auto& allocator = doc.GetAllocator(); + rapidjson::Document doc; + doc.Parse(data); + return doc; +} - doc.AddMember("or_gate", orGateValue, allocator); - SimpleFITFEEConfigurationReader reader; +rapidjson::Document createPmConfigNode(uint8_t orGateValue) +{ + auto doc = createEmptyPayload(); + auto& allocator = doc.GetAllocator(); + doc.AddMember("or_gate", orGateValue, allocator); + return doc; +} - PmConfig pmConfig; - reader.parsePmConfig(doc, pmConfig); +void addTcmConfigNode(rapidjson::Document& doc, + const char* nodeName, + float phaseDelayA, + float phaseDelayC) +{ + auto& allocator = doc.GetAllocator(); - BOOST_CHECK(pmConfig.orGate == orGateValue); + rapidjson::Value tcmConfigJson(rapidjson::kObjectType); + tcmConfigJson.AddMember("phase_delay_a", phaseDelayA, allocator); + tcmConfigJson.AddMember("phase_delay_c", phaseDelayC, allocator); + + doc.AddMember(rapidjson::StringRef(nodeName), tcmConfigJson, allocator); } -BOOST_AUTO_TEST_CASE(shouldParseTcmConfig) { - const float phaseDelayAValue = 1.2; - const float phaseDelayCValue = -1.3; +template +void addPmConfigsNode(rapidjson::Document& doc, const char* nodeName, const uint8_t (&orGateValues)[NChannels]) +{ + auto& allocator = doc.GetAllocator(); - rapidjson::Document doc; - doc.SetObject(); - auto& allocator = doc.GetAllocator(); - - rapidjson::Value tcmConfigJson(rapidjson::kObjectType); - tcmConfigJson.AddMember("phase_delay_a", phaseDelayAValue, allocator); - tcmConfigJson.AddMember("phase_delay_c", phaseDelayCValue, allocator); + rapidjson::Value pmJson(rapidjson::kArrayType); - doc.AddMember("tcm_config", tcmConfigJson, allocator); - TcmConfig tcmConfig; + for (size_t idx = 0; idx < NChannels; ++idx) { + rapidjson::Value pm(rapidjson::kObjectType); + pm.AddMember("or_gate", orGateValues[idx], allocator); + pmJson.PushBack(pm, allocator); + } - SimpleFITFEEConfigurationReader reader; - reader.parseTcmConfig(doc, "tcm_config", tcmConfig); + doc.AddMember(rapidjson::StringRef(nodeName), pmJson, allocator); +} + +template +void addArrayMember(rapidjson::Value& node, const char* memberName, const T (&values)[N], rapidjson::Document::AllocatorType& allocator) +{ + rapidjson::Value arrayJson(rapidjson::kArrayType); + + for (size_t idx = 0; idx < N; ++idx) { + arrayJson.PushBack(values[idx], allocator); + } - TcmConfig expectedConfig = {.phaseDelayA = phaseDelayAValue, .phaseDelayC = phaseDelayCValue}; - BOOST_CHECK(tcmConfig == expectedConfig); + node.AddMember(rapidjson::StringRef(memberName), arrayJson, allocator); } -BOOST_AUTO_TEST_CASE(shouldParseArrayOfPmConfigs) { - uint8_t pmAOrGate[2] = {3, 4}; - uint8_t pmCOrGate[2] = {5, 6}; +template +void addChannelsConfigNode(rapidjson::Document& doc, + const char* nodeName, + const float (&timeAligments)[NChannels], + const uint16_t (&cfdThresholds)[NChannels], + const int16_t (&cfdZeros)[NChannels], + const int16_t (&adcZeros)[NChannels], + const uint16_t (&adcDelays)[NChannels], + const bool (&channelMaskData)[NChannels], + const bool (&channelMaskTriggers)[NChannels]) +{ + auto& allocator = doc.GetAllocator(); - rapidjson::Document doc; - doc.SetObject(); - auto& allocator = doc.GetAllocator(); + rapidjson::Value channelsJson(rapidjson::kObjectType); - rapidjson::Value pmAJson(rapidjson::kArrayType); - rapidjson::Value pmCJson(rapidjson::kArrayType); + addArrayMember(channelsJson, "time_aligments", timeAligments, allocator); + addArrayMember(channelsJson, "cfd_thresholds", cfdThresholds, allocator); + addArrayMember(channelsJson, "cfd_zeros", cfdZeros, allocator); + addArrayMember(channelsJson, "adc_zeros", adcZeros, allocator); + addArrayMember(channelsJson, "adc_delays", adcDelays, allocator); + addArrayMember(channelsJson, "channel_mask_data", channelMaskData, allocator); + addArrayMember(channelsJson, "channel_mask_triggers", channelMaskTriggers, allocator); - for(int idx = 0; idx < sizeof(pmAOrGate); idx++) { - rapidjson::Value pm(rapidjson::kObjectType); - pm.AddMember("or_gate", pmAOrGate[idx], allocator); - pmAJson.PushBack(pm, allocator); - } + doc.AddMember(rapidjson::StringRef(nodeName), channelsJson, allocator); +} - for(int idx = 0; idx < sizeof(pmCOrGate); idx++) { - rapidjson::Value pm(rapidjson::kObjectType); - pm.AddMember("or_gate", pmCOrGate[idx], allocator); - pmCJson.PushBack(pm, allocator); - } +class SimpleFITFEEConfigurationReader + : public FITFEEConfigurationReader +{ + public: + // Dummy method to parse dummy triggers payload + SimpleTriggers parseTriggers(const rapidjson::Value&, + const char*, + SimpleTriggers& triggers) + { + triggers.triggerA = 32; + return triggers; + } - doc.AddMember("pm_a", pmAJson, allocator); - doc.AddMember("pm_c", pmCJson, allocator); + using FITFEEConfigurationReader::parseFeeConfiguration; + using FITFEEConfigurationReader::parseJsonArray; + using FITFEEConfigurationReader::parseChannelData; + using FITFEEConfigurationReader::parseTcmConfig; + using FITFEEConfigurationReader::parsePmConfig; + using FITFEEConfigurationReader::parsePmsArray; + using FITFEEConfigurationReader::validateSchema; +}; - PmConfig pmAParsed[2]; - PmConfig pmCParsed[2]; +BOOST_AUTO_TEST_CASE(shouldParseSinglePmConfig) +{ + const uint8_t orGateValue = 20; - SimpleFITFEEConfigurationReader reader; - reader.parsePmsArray(doc, "pm_a", pmAParsed); - reader.parsePmsArray(doc, "pm_c", pmCParsed); + rapidjson::Document doc = createPmConfigNode(orGateValue); - for(int idx= 0; idx < sizeof(pmAParsed); idx++) { - BOOST_CHECK(pmAParsed[idx].orGate == pmAOrGate[idx]); - } + PmConfig pmConfig; + SimpleFITFEEConfigurationReader reader; + reader.parsePmConfig(doc, pmConfig); - for(int idx= 0; idx < sizeof(pmAParsed); idx++) { - BOOST_CHECK(pmCParsed[idx].orGate == pmCOrGate[idx]); - } + BOOST_CHECK_EQUAL(pmConfig.orGate, orGateValue); } -BOOST_AUTO_TEST_CASE(shouldThrowOnInconsistentPmsArraySize) { - uint8_t pmAOrGate[2] = {0}; - - rapidjson::Document doc; - doc.SetObject(); - auto& allocator = doc.GetAllocator(); +BOOST_AUTO_TEST_CASE(shouldParseTcmConfig) +{ + const float phaseDelayAValue = 1.2f; + const float phaseDelayCValue = -1.3f; - rapidjson::Value pmAJson(rapidjson::kArrayType); + rapidjson::Document doc = createEmptyPayload(); + addTcmConfigNode(doc, "tcm_config", phaseDelayAValue, phaseDelayCValue); - for(int idx = 0; idx < sizeof(pmAOrGate); idx++) { - rapidjson::Value pm(rapidjson::kObjectType); - pm.AddMember("or_gate", pmAOrGate[0], allocator); - pmAJson.PushBack(pm, allocator); - } + TcmConfig tcmConfig; - doc.AddMember("pm_a", pmAJson, allocator); + SimpleFITFEEConfigurationReader reader; + reader.parseTcmConfig(doc, "tcm_config", tcmConfig); - PmConfig pmAParsed[3]; + TcmConfig expectedConfig = { + .phaseDelayA = phaseDelayAValue, + .phaseDelayC = phaseDelayCValue + }; - SimpleFITFEEConfigurationReader reader; - BOOST_CHECK_THROW(reader.parsePmsArray(doc, "pm_a", pmAParsed), std::runtime_error); + BOOST_CHECK(tcmConfig == expectedConfig); } -BOOST_AUTO_TEST_CASE(shouldParseChannelsConfig) +BOOST_AUTO_TEST_CASE(shouldParseArrayOfPmConfigs) { - constexpr size_t NTestChannels = 4; + const uint8_t pmAOrGate[] = {3, 4}; + const uint8_t pmCOrGate[] = {5, 6}; - float timeAligments[NTestChannels] = {1.1f, 2.2f, 3.3f, 4.4f}; - uint16_t cfdThresholds[NTestChannels] = {10, 20, 30, 40}; - int16_t cfdZeros[NTestChannels] = {-1, -2, -3, -4}; - int16_t adcZeros[NTestChannels] = {100, 200, 300, 400}; - uint16_t adcDelays[NTestChannels] = {5, 6, 7, 8}; - bool channelMaskData[NTestChannels] = {true, false, true, false}; - bool channelMaskTriggers[NTestChannels] = {false, true, false, true}; + rapidjson::Document doc = createEmptyPayload(); + addPmConfigsNode(doc, "pm_a", pmAOrGate); + addPmConfigsNode(doc, "pm_c", pmCOrGate); - rapidjson::Document doc; - doc.SetObject(); - auto& allocator = doc.GetAllocator(); + PmConfig pmAParsed[2]; + PmConfig pmCParsed[2]; - rapidjson::Value channels(rapidjson::kObjectType); + SimpleFITFEEConfigurationReader reader; + reader.parsePmsArray(doc, "pm_a", pmAParsed); + reader.parsePmsArray(doc, "pm_c", pmCParsed); - rapidjson::Value timeAligmentsJson(rapidjson::kArrayType); - rapidjson::Value cfdThresholdsJson(rapidjson::kArrayType); - rapidjson::Value cfdZerosJson(rapidjson::kArrayType); - rapidjson::Value adcZerosJson(rapidjson::kArrayType); - rapidjson::Value adcDelaysJson(rapidjson::kArrayType); - rapidjson::Value channelMaskDataJson(rapidjson::kArrayType); - rapidjson::Value channelMaskTriggersJson(rapidjson::kArrayType); + for (size_t idx = 0; idx < std::size(pmAParsed); ++idx) { + BOOST_CHECK_EQUAL(pmAParsed[idx].orGate, pmAOrGate[idx]); + } - for (size_t idx = 0; idx < NTestChannels; ++idx) { - timeAligmentsJson.PushBack(timeAligments[idx], allocator); - cfdThresholdsJson.PushBack(cfdThresholds[idx], allocator); - cfdZerosJson.PushBack(cfdZeros[idx], allocator); - adcZerosJson.PushBack(adcZeros[idx], allocator); - adcDelaysJson.PushBack(adcDelays[idx], allocator); - channelMaskDataJson.PushBack(channelMaskData[idx], allocator); - channelMaskTriggersJson.PushBack(channelMaskTriggers[idx], allocator); + for (size_t idx = 0; idx < std::size(pmCParsed); ++idx) { + BOOST_CHECK_EQUAL(pmCParsed[idx].orGate, pmCOrGate[idx]); } +} - channels.AddMember("time_aligments", timeAligmentsJson, allocator); - channels.AddMember("cfd_thresholds", cfdThresholdsJson, allocator); - channels.AddMember("cfd_zeros", cfdZerosJson, allocator); - channels.AddMember("adc_zeros", adcZerosJson, allocator); - channels.AddMember("adc_delays", adcDelaysJson, allocator); - channels.AddMember("channel_mask_data", channelMaskDataJson, allocator); - channels.AddMember("channel_mask_triggers", channelMaskTriggersJson, allocator); +BOOST_AUTO_TEST_CASE(shouldThrowOnInconsistentPmsArraySize) +{ + const uint8_t pmAOrGate[] = {0, 0}; + + rapidjson::Document doc = createEmptyPayload(); + addPmConfigsNode(doc, "pm_a", pmAOrGate); - doc.AddMember("channels", channels, allocator); + PmConfig pmAParsed[3]; + + SimpleFITFEEConfigurationReader reader; + + BOOST_CHECK_THROW(reader.parsePmsArray(doc, "pm_a", pmAParsed), std::runtime_error); +} + +BOOST_AUTO_TEST_CASE(shouldParseChannelsConfig) +{ + constexpr size_t NTestChannels = 4; + + const float timeAligments[NTestChannels] = {1.1f, 2.2f, 3.3f, 4.4f}; + const uint16_t cfdThresholds[NTestChannels] = {10, 20, 30, 40}; + const int16_t cfdZeros[NTestChannels] = {-1, -2, -3, -4}; + const int16_t adcZeros[NTestChannels] = { 100, 200, 300, 400}; + const uint16_t adcDelays[NTestChannels] = {5, 6, 7, 8}; + const bool channelMaskData[NTestChannels] = {true, false, true, false}; + const bool channelMaskTriggers[NTestChannels] = {false, true, false, true}; + + rapidjson::Document doc = createEmptyPayload(); + + addChannelsConfigNode( + doc, + "channels", + timeAligments, + cfdThresholds, + cfdZeros, + adcZeros, + adcDelays, + channelMaskData, + channelMaskTriggers); ChannelsConfig parsed{}; @@ -212,44 +260,47 @@ BOOST_AUTO_TEST_CASE(shouldParseChannelsConfig) BOOST_CHECK_EQUAL(parsed.adcZeros[idx], adcZeros[idx]); BOOST_CHECK_EQUAL(parsed.adcDelays[idx], adcDelays[idx]); BOOST_CHECK_EQUAL(parsed.channelMaskData[idx], channelMaskData[idx]); - BOOST_CHECK_EQUAL(parsed.channelMaskTriggers[idx], - channelMaskTriggers[idx]); + BOOST_CHECK_EQUAL(parsed.channelMaskTriggers[idx], channelMaskTriggers[idx]); } } -BOOST_AUTO_TEST_CASE(shouldAcceptValidFeeConfigurationPayload) { - rapidjson::Document doc; - doc.Parse(R"json( - { - "channels" : { - "time_aligments": [1,2,3,4], - "cfd_thresholds": [10,20,30,40], - "cfd_zeros": [11,22,33,44], - "adc_zeros": [21,22,23,24], - "adc_delays": [31,32,33,34], - "channel_mask_data": [true, false, true, false], - "channel_mask_triggers": [true, true, false, false] - }, - "pm_a": [ - {"or_gate": 1.21}, - {"or_gate": 1.22} - ], - "pm_c": [ - {"or_gate": 0.1}, - {"or_gate": 0.2} - ], - "tcm": { - "phase_delay_a": 3.3, - "phase_delay_c": 4.4 - }, - "triggers": { - "trigger_a": 123 - } +BOOST_AUTO_TEST_CASE(shouldAcceptValidFeeConfigurationPayload) +{ + const char* jsonPayload = R"json( + { + "channels": { + "time_aligments": [1, 2, 3, 4], + "cfd_thresholds": [10, 20, 30, 40], + "cfd_zeros": [11, 22, 33, 44], + "adc_zeros": [21, 22, 23, 24], + "adc_delays": [31, 32, 33, 34], + "channel_mask_data": [true, false, true, false], + "channel_mask_triggers": [true, true, false, false] + }, + "pm_a": [ + {"or_gate": 1.21}, + {"or_gate": 1.22} + ], + "pm_c": [ + {"or_gate": 0.1}, + {"or_gate": 0.2} + ], + "tcm": { + "phase_delay_a": 3.3, + "phase_delay_c": 4.4 + }, + "triggers": { + "trigger_a": 123 } - )json"); + } + )json"; - SimpleFITFEEConfigurationReader reader; - std::string errorMessage; - BOOST_CHECK_MESSAGE(reader.validateSchema(doc, errorMessage), errorMessage); + rapidjson::Document doc = createDocumentFromString(jsonPayload); + + SimpleFITFEEConfigurationReader reader; + std::string errorMessage; + + BOOST_CHECK_MESSAGE(reader.validateSchema(doc, errorMessage), errorMessage); } -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file + +BOOST_AUTO_TEST_SUITE_END() diff --git a/Detectors/FIT/common/tests/dcsmonitoring/FITHvConfigurationReaderTest.cxx b/Detectors/FIT/common/tests/dcsmonitoring/FITHvConfigurationReaderTest.cxx new file mode 100644 index 0000000000000..d88480d4d5801 --- /dev/null +++ b/Detectors/FIT/common/tests/dcsmonitoring/FITHvConfigurationReaderTest.cxx @@ -0,0 +1,91 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#define BOOST_TEST_MODULE Test FITDCSMonitoring FITHvConfigurationReader +#define BOOST_TEST_MAIN +#define BOOST_TEST_DYN_LINK + +#include +#include +#include "FITDCSMonitoring/FITHvConfigurationReader.h" +#include "DataFormatsFIT/Configuration.h" + +using namespace o2::fit; + +BOOST_AUTO_TEST_SUITE(o2_fit_dcs_monitoring) + +rapidjson::Document createEmptyPayload() { + rapidjson::Document doc; + doc.SetObject(); + return doc; +} + +rapidjson::Document createDocumentFromString(const char* data) { + rapidjson::Document doc; + doc.Parse(data); + return doc; +} + +template +void addToPayloadHvChannels(rapidjson::Document& doc, float (&gainValues)[NChannels]) { + auto& allocator = doc.GetAllocator(); + + rapidjson::Value gainJson(rapidjson::kArrayType); + for(int idx = 0; idx < NChannels; idx++) { + gainJson.PushBack(gainValues[idx], allocator); + } + rapidjson::Value hvChannelsJson(rapidjson::kObjectType); + hvChannelsJson.AddMember("gain", gainJson, allocator); + doc.AddMember("hv_channels", hvChannelsJson, allocator); +} + +template +HvChannelsConfig createExpectedConfig(float (&gainValues)[NChannels]) { + HvChannelsConfig expectedConfig; + std::memcpy(std::begin(expectedConfig.gain), gainValues, sizeof(float) * NChannels); + return expectedConfig; +} + +BOOST_AUTO_TEST_CASE(shouldParseHvChannels) +{ + constexpr size_t NChannels = 5; + float gainValues[NChannels] = {1.0, 2.1, 3.2, 4.3, 5.4}; + + rapidjson::Document doc = createEmptyPayload(); + addToPayloadHvChannels(doc, gainValues); + + HvChannelsConfig channelsConfig; + FITHvConfigurationReader reader; + reader.parseHvChannelData(doc, "hv_channels", channelsConfig); + + HvChannelsConfig expectedConfig = createExpectedConfig(gainValues); + + BOOST_CHECK(expectedConfig == channelsConfig); +} + +BOOST_AUTO_TEST_CASE(shouldAcceptValidJsonPayload) +{ + const char* jsonPayload = R"json( + { + "hv_channels" : { + "gain": [1,2,3,4], + } + } + )json"; + + rapidjson::Document doc = createDocumentFromString(jsonPayload); + + FITHvConfigurationReader reader; + std::string errorMessage; + BOOST_CHECK_MESSAGE(reader.validateSchema(doc, errorMessage), errorMessage); +} + +BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file From 201810c6c8af472d6dea6ceae1ebed1ea733ee18 Mon Sep 17 00:00:00 2001 From: Wiktor Pierozak Date: Tue, 11 Aug 2026 17:55:42 +0200 Subject: [PATCH 19/28] Included configuration parsing in FV0 config processor; Changed number of channels in FT0 configuration to 208 --- .../include/DataFormatsFT0/FeeConfiguration.h | 2 +- .../include/DataFormatsFT0/HvConfiguration.h | 2 +- .../FIT/FT0/src/DataFormatsFT0LinkDef.h | 4 +- DataFormats/Detectors/FIT/FV0/CMakeLists.txt | 4 +- .../include/DataFormatsFV0/FeeConfiguration.h | 34 ++-- .../include/DataFormatsFV0/HvConfiguration.h | 27 +++ .../FIT/FV0/src/DataFormatsFV0LinkDef.h | 3 + .../include/DataFormatsFIT/Configuration.h | 3 +- .../FT0FEEConfigurationReader.h | 5 - .../FIT/FV0/dcsmonitoring/CMakeLists.txt | 4 +- .../FV0DCSMonitoring/FV0DCSConfigProcessor.h | 10 +- .../FV0FEEConfigurationReader.h | 34 ++++ .../src/FV0DCSConfigProcessor.cxx | 39 +++-- .../src/FV0FEEConfigurationReader.cxx | 23 +++ .../workflow/FV0DCSConfigProcessorSpec.h | 16 +- .../FITFEEConfigurationReader.h | 36 ++-- .../FITFEEConfigurationReaderTest.cxx | 158 +++++++++++++++++- 17 files changed, 334 insertions(+), 70 deletions(-) create mode 100644 DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/HvConfiguration.h create mode 100644 Detectors/FIT/FV0/dcsmonitoring/include/FV0DCSMonitoring/FV0FEEConfigurationReader.h create mode 100644 Detectors/FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx diff --git a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h index be238a6c4b73a..e03c060c5772a 100644 --- a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h +++ b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h @@ -30,7 +30,7 @@ struct TriggersConfig { }; struct Ft0FeeConfiguration { - static constexpr int NChannels = 212; + static constexpr int NChannels = 208; TriggersConfig triggers; o2::fit::ChannelsConfig channels; o2::fit::TcmConfig tcm; diff --git a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/HvConfiguration.h b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/HvConfiguration.h index 934e8cff32785..55075a185056f 100644 --- a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/HvConfiguration.h +++ b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/HvConfiguration.h @@ -19,7 +19,7 @@ namespace o2::ft0 { struct Ft0HvConfiguration { - static constexpr int NChannels = 212; + static constexpr int NChannels = 208; o2::fit::HvChannelsConfig channels; ClassDefNV(Ft0HvConfiguration, 1); }; diff --git a/DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h b/DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h index f6019a360ad26..b207d3c9d6003 100644 --- a/DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h +++ b/DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h @@ -59,7 +59,7 @@ #pragma link C++ class o2::ft0::EventsPerBc + ; #pragma link C++ struct o2::ft0::Ft0FeeConfiguration + ; #pragma link C++ struct o2::ft0::TriggersConfig + ; -#pragma link C++ struct o2::fit::ChannelsConfig < 212> + ; +#pragma link C++ struct o2::fit::ChannelsConfig < 208> + ; #pragma link C++ struct o2::ft0::Ft0HvConfiguration + ; -#pragma link C++ struct o2::fit::HvChannelsConfig < 212> + ; +#pragma link C++ struct o2::fit::HvChannelsConfig < 208> + ; #endif diff --git a/DataFormats/Detectors/FIT/FV0/CMakeLists.txt b/DataFormats/Detectors/FIT/FV0/CMakeLists.txt index 35bc653a8234e..cf1df963c6791 100644 --- a/DataFormats/Detectors/FIT/FV0/CMakeLists.txt +++ b/DataFormats/Detectors/FIT/FV0/CMakeLists.txt @@ -35,4 +35,6 @@ o2_target_root_dictionary(DataFormatsFV0 include/DataFormatsFV0/RecPoints.h include/DataFormatsFV0/RawEventData.h include/DataFormatsFV0/LookUpTable.h - include/DataFormatsFV0/CTF.h) + include/DataFormatsFV0/CTF.h + include/DataFormatsFV0/FeeConfiguration.h + include/DataFormatsFV0/HvConfiguration.h) diff --git a/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/FeeConfiguration.h b/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/FeeConfiguration.h index 834ec69ad10be..aca1bdbf75255 100644 --- a/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/FeeConfiguration.h +++ b/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/FeeConfiguration.h @@ -12,27 +12,27 @@ #ifndef O2_FV0_FEE_CONFIGURATION #define O2_FV0_FEE_CONFIGURATION -#include "CommonUtils/ConfigurableParamHelper.h" #include "DataFormatsFIT/Configuration.h" -namespace o2::fv0 { -struct TriggersConfig +namespace o2::fv0 { - float vertexTimeLowThreshold{o2::fit::config_helpers::DefaultValue}; - float vertexTimeHighThreshold{o2::fit::config_helpers::DefaultValue}; - uint16_t nChannels{o2::fit::config_helpers::DefaultValue}; - uint16_t innerRings{o2::fit::config_helpers::DefaultValue}; - uint16_t charge{o2::fit::config_helpers::DefaultValue}; - uint16_t outerRings{o2::fit::config_helpers::DefaultValue}; +struct TriggersConfig { + uint16_t nChannels{o2::fit::config_helpers::DefaultValue}; + uint16_t innerRings{o2::fit::config_helpers::DefaultValue}; + uint16_t charge{o2::fit::config_helpers::DefaultValue}; + uint16_t outerRings{o2::fit::config_helpers::DefaultValue}; + + ClassDefNV(TriggersConfig, 1); }; -struct Fv0FeeConfiguration : o2::conf::ConfigurableParamHelper { - static constexpr int NChannels = 48; - TriggersConfig triggers; - o2::fit::ChannelsConfig channels; - o2::fit::TcmConfig tcm; - o2::fit::PmConfig pmA[10]; - O2ParamDef(Fv0FeeConfiguration, "Fv0FeeConfiguration"); +struct Fv0FeeConfiguration { + static constexpr int NChannels = 48; + TriggersConfig triggers; + o2::fit::ChannelsConfig channels; + o2::fit::TcmConfig tcm; + o2::fit::PmConfig pmA[10]; + + ClassDefNV(Fv0FeeConfiguration, 1); }; -} +} // namespace o2::fv0 #endif \ No newline at end of file diff --git a/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/HvConfiguration.h b/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/HvConfiguration.h new file mode 100644 index 0000000000000..c4b809f7eaa8b --- /dev/null +++ b/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/HvConfiguration.h @@ -0,0 +1,27 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef O2_FV0_HV_CONFIGURATION +#define O2_FV0_HV_CONFIGURATION + +#include "CommonUtils/ConfigurableParamHelper.h" +#include "DataFormatsFIT/Configuration.h" +#include + +namespace o2::fv0 +{ +struct Fv0HvConfiguration { + static constexpr int NChannels = 48; + o2::fit::HvChannelsConfig channels; + ClassDefNV(Fv0HvConfiguration, 1); +}; +} // namespace o2::fv0 +#endif \ No newline at end of file diff --git a/DataFormats/Detectors/FIT/FV0/src/DataFormatsFV0LinkDef.h b/DataFormats/Detectors/FIT/FV0/src/DataFormatsFV0LinkDef.h index ab23b4aa727bc..36ef1a80a6e97 100644 --- a/DataFormats/Detectors/FIT/FV0/src/DataFormatsFV0LinkDef.h +++ b/DataFormats/Detectors/FIT/FV0/src/DataFormatsFV0LinkDef.h @@ -40,4 +40,7 @@ #pragma link C++ class o2::fv0::FV0CalibrationInfoObject + ; #pragma link C++ class o2::fv0::FV0ChannelTimeCalibrationObject + ; +#pragma link C++ struct o2::fv0::Fv0FeeConfiguration + ; +#pragma link C++ struct o2::fit::ChannelsConfig < 48> + ; +#pragma link C++ struct o2::fv0::Fv0HvConfiguration + ; #endif diff --git a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h index 3e4111072210e..73ac3d734492b 100644 --- a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h +++ b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h @@ -62,7 +62,8 @@ struct TcmConfig { struct PmConfig { uint8_t orGate{config_helpers::DefaultValue}; - // charge thershold + uint16_t trgChargeHighLevel{config_helpers::DefaultValue}; + uint16_t trgChargeLowLevel{config_helpers::DefaultValue}; bool operator==(const PmConfig&) const = default; ClassDefNV(PmConfig, 1); }; diff --git a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0FEEConfigurationReader.h b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0FEEConfigurationReader.h index 9469f9ef63abb..e8955c616e5b3 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0FEEConfigurationReader.h +++ b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0FEEConfigurationReader.h @@ -9,11 +9,6 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file FT0DCSConfigReader.h -/// \brief DCS configuration reader for FT0 -/// -/// \author Andreas Molander , University of Jyvaskyla, Finland - #ifndef O2_FT0_DCSCONFIGREADER_H #define O2_FT0_DCSCONFIGREADER_H diff --git a/Detectors/FIT/FV0/dcsmonitoring/CMakeLists.txt b/Detectors/FIT/FV0/dcsmonitoring/CMakeLists.txt index f90431f1972a8..a036cdb4296a1 100644 --- a/Detectors/FIT/FV0/dcsmonitoring/CMakeLists.txt +++ b/Detectors/FIT/FV0/dcsmonitoring/CMakeLists.txt @@ -10,8 +10,8 @@ # or submit itself to any jurisdiction. o2_add_library(FV0DCSMonitoring - SOURCES src/FV0DCSDataProcessor.cxx src/FV0DCSConfigProcessor.cxx - PUBLIC_LINK_LIBRARIES O2::FITDCSMonitoring) + SOURCES src/FV0DCSDataProcessor.cxx src/FV0DCSConfigProcessor.cxx src/FV0FEEConfigurationReader.cxx + PUBLIC_LINK_LIBRARIES O2::FITDCSMonitoring O2::DataFormatsFV0) o2_add_executable(dcs-sim-workflow COMPONENT_NAME fv0 diff --git a/Detectors/FIT/FV0/dcsmonitoring/include/FV0DCSMonitoring/FV0DCSConfigProcessor.h b/Detectors/FIT/FV0/dcsmonitoring/include/FV0DCSMonitoring/FV0DCSConfigProcessor.h index fd3519a6f7187..0f0f25e562f7f 100644 --- a/Detectors/FIT/FV0/dcsmonitoring/include/FV0DCSMonitoring/FV0DCSConfigProcessor.h +++ b/Detectors/FIT/FV0/dcsmonitoring/include/FV0DCSMonitoring/FV0DCSConfigProcessor.h @@ -14,18 +14,24 @@ #ifndef O2_FV0_DCS_CONFIG_PROCESSOR_H #define O2_FV0_DCS_CONFIG_PROCESSOR_H #include "FITDCSMonitoring/FITDCSConfigProcessorSpec.h" +#include "FV0DCSMonitoring/FV0FEEConfigurationReader.h" +#include "FITDCSMonitoring/FITHvConfigurationReader.h" namespace o2::fv0 { class FV0DCSConfigProcessor : public o2::fit::FITDCSConfigProcessor { public: - FV0DCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM) - : o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM, {}, {}) {} + FV0DCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM, const o2::header::DataDescription& dataDescriptionFeeConfig, const o2::header::DataDescription& dataDescriptionHvConfig) + : o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM, dataDescriptionFeeConfig, dataDescriptionHvConfig) {} void init(o2::framework::InitContext& ic) final; void run(o2::framework::ProcessingContext& pc) final; void endOfStream(o2::framework::EndOfStreamContext& ec) final; + + private: + FV0FEEConfigurationReader mFeeConfigurationReader; + o2::fit::FITHvConfigurationReader mHvConfigurationReader; }; } // namespace o2::fv0 #endif \ No newline at end of file diff --git a/Detectors/FIT/FV0/dcsmonitoring/include/FV0DCSMonitoring/FV0FEEConfigurationReader.h b/Detectors/FIT/FV0/dcsmonitoring/include/FV0DCSMonitoring/FV0FEEConfigurationReader.h new file mode 100644 index 0000000000000..8f0e110741dc9 --- /dev/null +++ b/Detectors/FIT/FV0/dcsmonitoring/include/FV0DCSMonitoring/FV0FEEConfigurationReader.h @@ -0,0 +1,34 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file FT0DCSConfigReader.h +/// \brief DCS configuration reader for FT0 +/// +/// \author Andreas Molander , University of Jyvaskyla, Finland + +#ifndef O2_FV0_DCSCONFIGREADER_H +#define O2_FV0_DCSCONFIGREADER_H + +#include "FITDCSMonitoring/FITFEEConfigurationReader.h" +#include "DataFormatsFV0/FeeConfiguration.h" + +namespace o2::fv0 +{ +class FV0FEEConfigurationReader : public o2::fit::FITFEEConfigurationReader +{ + public: + Fv0FeeConfiguration parseFeeConfiguration(gsl::span configBuf); + void parseTriggers(const rapidjson::Value& root, const char* triggersNodeName, TriggersConfig& config); +}; + +} // namespace o2::fv0 + +#endif // O2_FV0_DCSCONFIGREADER_H \ No newline at end of file diff --git a/Detectors/FIT/FV0/dcsmonitoring/src/FV0DCSConfigProcessor.cxx b/Detectors/FIT/FV0/dcsmonitoring/src/FV0DCSConfigProcessor.cxx index 404ffdd09369a..9bf5f979a1669 100644 --- a/Detectors/FIT/FV0/dcsmonitoring/src/FV0DCSConfigProcessor.cxx +++ b/Detectors/FIT/FV0/dcsmonitoring/src/FV0DCSConfigProcessor.cxx @@ -1,28 +1,41 @@ #include "FV0DCSMonitoring/FV0DCSConfigProcessor.h" +#include "DataFormatsFV0/HvConfiguration.h" +#include "DataFormatsFV0/FeeConfiguration.h" -namespace o2::fv0 { +namespace o2::fv0 +{ void FV0DCSConfigProcessor::init(o2::framework::InitContext& ic) { - initDeadChannelMapReader(); - setupDeadChannelMapReader(ic); + initDeadChannelMapReader(); + setupDeadChannelMapReader(ic); + setupFeeConfigurationReader(ic, mFeeConfigurationReader); + setupHvConfigurationReader(ic, mHvConfigurationReader); } void FV0DCSConfigProcessor::run(o2::framework::ProcessingContext& pc) { - long dataTime = getValidityTime(pc); + long dataTime = getValidityTime(pc); - gsl::span dataBuffer = pc.inputs().get>("inputConfig"); - std::string configFileName = pc.inputs().get("inputConfigFileName"); - LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); + gsl::span dataBuffer = pc.inputs().get>("inputConfig"); + std::string configFileName = pc.inputs().get("inputConfigFileName"); + LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); - if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { - handleDeadChannelMapUpdate(pc,dataTime, dataBuffer); - } else { - LOG(error) << "Unknown input file: " << configFileName; - } + if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { + handleDeadChannelMapUpdate(pc, dataTime, dataBuffer); + } else if (mFeeConfigurationReader.matchFilename(configFileName)) { + Fv0FeeConfiguration feeConfiguration = mFeeConfigurationReader.parseFeeConfiguration(dataBuffer); + o2::ccdb::CcdbObjectInfo objectInfo = mFeeConfigCcdbInfo.createObjectInfo(feeConfiguration, dataTime, {}); + sendObject(pc.outputs(), feeConfiguration, objectInfo, getFeeConfigDescription()); + } else if (mHvConfigurationReader.matchFilename(configFileName)) { + Fv0HvConfiguration hvConfig = mHvConfigurationReader.parseHvConfiguration(dataBuffer); + o2::ccdb::CcdbObjectInfo objectInfo = mHvConfigCcdbInfo.createObjectInfo(hvConfig, dataTime, {}); + sendObject(pc.outputs(), hvConfig, objectInfo, getHvConfigDescription()); + } else { + LOG(error) << "Unknown input file: " << configFileName; + } } void FV0DCSConfigProcessor::endOfStream(o2::framework::EndOfStreamContext& ec) { } -} \ No newline at end of file +} // namespace o2::fv0 \ No newline at end of file diff --git a/Detectors/FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx b/Detectors/FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx new file mode 100644 index 0000000000000..947fbd75f57d3 --- /dev/null +++ b/Detectors/FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx @@ -0,0 +1,23 @@ +#include "FV0DCSMonitoring/FV0FEEConfigurationReader.h" + +namespace o2::fv0 +{ +Fv0FeeConfiguration FV0FEEConfigurationReader::parseFeeConfiguration(gsl::span configBuf) +{ + return FITFEEConfigurationReader::parseFeeConfiguration(configBuf); +} + +void FV0FEEConfigurationReader::parseTriggers(const rapidjson::Value& root, const char* triggersNodeName, TriggersConfig& config) +{ + const auto& triggersNode = root["triggers"]; + const auto& nChannelsLevelNode = triggersNode["n_channels_level"]; + const auto& innerRingsLevelNode = triggersNode["inner_rings_level"]; + const auto& chargeLevelNode = triggersNode["charge_level"]; + const auto& outerRingsLevelNode = triggersNode["outer_rings_level"]; + + config.innerRings = innerRingsLevelNode.GetInt(); + config.nChannels = nChannelsLevelNode.GetInt(); + config.charge = chargeLevelNode.GetInt(); + config.outerRings = chargeLevelNode.GetInt(); +} +} // namespace o2::fv0 \ No newline at end of file diff --git a/Detectors/FIT/FV0/dcsmonitoring/workflow/FV0DCSConfigProcessorSpec.h b/Detectors/FIT/FV0/dcsmonitoring/workflow/FV0DCSConfigProcessorSpec.h index 6343c1dd9d4f1..133987800cf36 100644 --- a/Detectors/FIT/FV0/dcsmonitoring/workflow/FV0DCSConfigProcessorSpec.h +++ b/Detectors/FIT/FV0/dcsmonitoring/workflow/FV0DCSConfigProcessorSpec.h @@ -37,16 +37,28 @@ DataProcessorSpec getFV0DCSConfigProcessorSpec() outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBPayload, ddDChM}, Lifetime::Sporadic); outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBWrapper, ddDChM}, Lifetime::Sporadic); + o2::header::DataDescription ddFeeConfig = "FV0_FEE_CONFIG"; + outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBPayload, ddFeeConfig}, Lifetime::Sporadic); + outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBWrapper, ddFeeConfig}, Lifetime::Sporadic); + + o2::header::DataDescription ddHvConfig = "FV0_HV_CONFIG"; + outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBPayload, ddHvConfig}, Lifetime::Sporadic); + outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBWrapper, ddHvConfig}, Lifetime::Sporadic); + return DataProcessorSpec{ "fv0-dcs-config-processor", Inputs{{"inputConfig", o2::header::gDataOriginFV0, "DCS_CONFIG_FILE", Lifetime::Sporadic}, {"inputConfigFileName", o2::header::gDataOriginFV0, "DCS_CONFIG_NAME", Lifetime::Sporadic}}, outputs, - AlgorithmSpec{adaptFromTask("FV0", ddDChM)}, + AlgorithmSpec{adaptFromTask("FV0", ddDChM, ddFeeConfig, ddHvConfig)}, Options{{"use-verbose-mode", VariantType::Bool, false, {"Use verbose mode"}}, {"filename-dchm", VariantType::String, "FV0-deadchannels.txt", {"Dead channel map file name"}}, {"valid-days-dchm", VariantType::UInt32, 180u, {"Dead channel map validity in days"}}, - {"no-validate", VariantType::Bool, false, {"Don't validate the CCDB uploads"}}}}; + {"no-validate", VariantType::Bool, false, {"Don't validate the CCDB uploads"}}, + {"filename-fee-config", VariantType::String, "ft0-fee-config.json", {"FEE configuration file name"}}, + {"valid-days-fee-config", VariantType::UInt32, 180u, {"FEE configuration validity in days"}}, + {"filename-hv-config", VariantType::String, "ft0-hv-config.json", {"HV configuration file name"}}, + {"valid-days-hv-config", VariantType::UInt32, 180u, {"HV configuration validity in days"}}}}; } } // namespace framework diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h index def49faf6b437..318b3c342322b 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h @@ -38,8 +38,12 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader parseChannelData(document, "channels", configuration.channels); parseTcmConfig(document, "tcm", configuration.tcm); - parsePmsArray(document, "pm_a", configuration.pmA); - parsePmsArray(document, "pm_c", configuration.pmC); + if constexpr (requires { configuration.pmA; }) { + parsePmsArray(document, "pm_a", configuration.pmA); + } + if constexpr (requires { configuration.pmC; }) { + parsePmsArray(document, "pm_c", configuration.pmC); + } static_cast(this)->parseTriggers(document, "triggers", configuration.triggers); return configuration; @@ -102,13 +106,7 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader void parseTcmConfig(const rapidjson::Value& root, const char* tcmNodeName, TcmConfig& tcmConfig) { - if (!root.HasMember(tcmNodeName)) { - std::runtime_error(std::format("Cannot find {}", tcmNodeName)); - } const auto& tcmNode = root[tcmNodeName]; - if (!tcmNode.HasMember("phase_delay_a") || !tcmNode.HasMember("phase_delay_c")) { - throw std::runtime_error("Invalid TCM configuration node!"); - } const auto& phaseDelayANode = tcmNode["phase_delay_a"]; const auto& phaseDelayCNode = tcmNode["phase_delay_c"]; tcmConfig.phaseDelayA = phaseDelayANode.GetDouble(); @@ -117,9 +115,6 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader void parsePmConfig(const rapidjson::Value& pmNode, PmConfig& pmConfig) { - if (!pmNode.HasMember("or_gate")) { - throw std::runtime_error("Invalid PM configuration node"); - } const auto& orGateNode = pmNode["or_gate"]; pmConfig.orGate = orGateNode.GetUint(); } @@ -131,17 +126,14 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader throw std::runtime_error(std::format("Failed to find {} node", pmArrayNodeName)); } const auto& pmArrayNode = root[pmArrayNodeName]; - if (pmArrayNode.IsArray() == false) { - std::runtime_error(std::format("{} node is not an array!", pmArrayNodeName)); - } const auto& pmArray = pmArrayNode.GetArray(); if (pmArray.Size() != Size) { throw std::runtime_error(std::format("Received data for {} PMs, but expected {}", pmArray.Size(), Size)); } for (int idx = 0; idx < pmArray.Size(); idx++) { const auto& pm = pmArray[idx]; - if (pm.IsObject() == false) { - throw std::runtime_error("Encountered non-object element in PM array"); + if (pm.IsNull()) { + continue; } parsePmConfig(pm, pmConfig[idx]); } @@ -185,18 +177,22 @@ const std::string FITFEEConfigurationReader::configurat "pm_a":{ "type": "array", "items": { - "type": "object", + "type": ["object", "null"], "properties": { - "or_gate": {"type": "number"} + "or_gate": {"type": "number"}, + "trg_charge_low_level": {"type": "number"}, + "trg_charge_high_level": {"type": "number"} } } }, "pm_c": { "type": "array", "items": { - "type": "object", + "type": ["object", "null"], "properties": { - "or_gate": {"type": "number"} + "or_gate": {"type": "number"}, + "trg_charge_low_level": {"type": "number"}, + "trg_charge_high_level": {"type": "number"} } } }, diff --git a/Detectors/FIT/common/tests/dcsmonitoring/FITFEEConfigurationReaderTest.cxx b/Detectors/FIT/common/tests/dcsmonitoring/FITFEEConfigurationReaderTest.cxx index baab2f0a50deb..63161e72a19d5 100644 --- a/Detectors/FIT/common/tests/dcsmonitoring/FITFEEConfigurationReaderTest.cxx +++ b/Detectors/FIT/common/tests/dcsmonitoring/FITFEEConfigurationReaderTest.cxx @@ -178,8 +178,7 @@ BOOST_AUTO_TEST_CASE(shouldParseTcmConfig) TcmConfig expectedConfig = { .phaseDelayA = phaseDelayAValue, - .phaseDelayC = phaseDelayCValue - }; + .phaseDelayC = phaseDelayCValue}; BOOST_CHECK(tcmConfig == expectedConfig); } @@ -230,7 +229,7 @@ BOOST_AUTO_TEST_CASE(shouldParseChannelsConfig) const float timeAligments[NTestChannels] = {1.1f, 2.2f, 3.3f, 4.4f}; const uint16_t cfdThresholds[NTestChannels] = {10, 20, 30, 40}; const int16_t cfdZeros[NTestChannels] = {-1, -2, -3, -4}; - const int16_t adcZeros[NTestChannels] = { 100, 200, 300, 400}; + const int16_t adcZeros[NTestChannels] = {100, 200, 300, 400}; const uint16_t adcDelays[NTestChannels] = {5, 6, 7, 8}; const bool channelMaskData[NTestChannels] = {true, false, true, false}; const bool channelMaskTriggers[NTestChannels] = {false, true, false, true}; @@ -303,4 +302,157 @@ BOOST_AUTO_TEST_CASE(shouldAcceptValidFeeConfigurationPayload) BOOST_CHECK_MESSAGE(reader.validateSchema(doc, errorMessage), errorMessage); } +BOOST_AUTO_TEST_CASE(shouldAcceptValidFeeConfigurationPayloadWithNullPmData) +{ + const char* jsonPayload = R"json( + { + "channels": { + "time_aligments": [1, 2, 3, 4], + "cfd_thresholds": [10, 20, 30, 40], + "cfd_zeros": [11, 22, 33, 44], + "adc_zeros": [21, 22, 23, 24], + "adc_delays": [31, 32, 33, 34], + "channel_mask_data": [true, false, true, false], + "channel_mask_triggers": [true, true, false, false] + }, + "pm_a": [ + {"or_gate": 1.21}, + null, + {"or_gate": 1.22} + ], + "pm_c": [ + null, + {"or_gate": 0.1}, + {"or_gate": 0.2}, + null, + null + ], + "tcm": { + "phase_delay_a": 3.3, + "phase_delay_c": 4.4 + }, + "triggers": { + "trigger_a": 123 + } + } + )json"; + + rapidjson::Document doc = createDocumentFromString(jsonPayload); + + SimpleFITFEEConfigurationReader reader; + std::string errorMessage; + + BOOST_CHECK_MESSAGE(reader.validateSchema(doc, errorMessage), errorMessage); +} + +BOOST_AUTO_TEST_CASE(shouldDetectInvalidPayload) +{ + SimpleFITFEEConfigurationReader reader; + std::string errorMessage; + + const char* missingChannelData = R"json( + { + "channels": { + "time_aligments": [1, 2, 3, 4], + "cfd_thresholds": [10, 20, 40], + "cfd_zeros": [11, 22, 33, 44], + "adc_zeros": [21, 22, 23], + "adc_delays": [31, 32, 33, 34], + "channel_mask_data": [true, false, true, false], + "channel_mask_triggers": [true, true, false, false] + }, + "pm_a": [ + {"or_gate": 1.21}, + null, + {"or_gate": 1.22} + ], + "pm_c": [ + null, + {"or_gate": 0.1}, + {"or_gate": 0.2}, + null, + null + ], + "tcm": { + "phase_delay_a": 3.3, + "phase_delay_c": 4.4 + }, + "triggers": { + "trigger_a": 123 + } + } + )json"; + + rapidjson::Document doc = createDocumentFromString(missingChannelData); + BOOST_CHECK(reader.validateSchema(doc, errorMessage) == false); + + const char* invalidPmConfig = R"json( + { + "channels": { + "time_aligments": [1, 2, 3, 5, 4], + "cfd_thresholds": [10, 20, 30, 40], + "cfd_zeros": [11, 22, 33, 44], + "adc_zeros": [21, 22, 23, 24], + "adc_delays": [31, 32, 33, 34], + "channel_mask_data": [true, false, true, false], + "channel_mask_triggers": [true, true, false, false] + }, + "pm_a": [ + {"or_gate": 1.21}, + null, + {"o_gate": 1.22} + ], + "pm_c": [ + {"gate": 0.2}, + ], + "tcm": { + "phase_delay_a": 3.3, + "phase_delay_c": 4.4 + }, + "triggers": { + "trigger_a": 123 + } + } + )json"; + + doc = createDocumentFromString(missingChannelData); + BOOST_CHECK(reader.validateSchema(doc, errorMessage) == false); + + const char* invalidTcmConfig = R"json( + { + "channels": { + "time_aligments": [1, 2, 3, 4], + "cfd_thresholds": [10, 20, 30, 40], + "cfd_zeros": [11, 22, 33, 44], + "adc_zeros": [21, 22, 23, 24], + "adc_delays": [31, 32, 33, 34], + "channel_mask_data": [true, false, true, false], + "channel_mask_triggers": [true, true, false, false] + }, + "pm_a": [ + {"or_gate": 1.21}, + null, + {"or_gate": 1.22} + ], + "pm_c": [ + null, + {"or_gate": 0.1}, + {"or_gate": 0.2}, + null, + null + ], + "tcm": { + "phase_a": 3.3, + "phase_delay_c": 4.4 + }, + "triggers": { + "trigger_a": 123 + } + } + )json"; + + doc = createDocumentFromString(missingChannelData); + BOOST_CHECK(reader.validateSchema(doc, errorMessage) == false); +} + BOOST_AUTO_TEST_SUITE_END() From 02737d6e360632e73322252b36af10bc5632fa37 Mon Sep 17 00:00:00 2001 From: Wiktor Pierozak Date: Tue, 11 Aug 2026 18:27:11 +0200 Subject: [PATCH 20/28] Created configuration data types for FDD --- DataFormats/Detectors/FIT/FDD/CMakeLists.txt | 4 +- .../include/DataFormatsFDD/FeeConfiguration.h | 38 ++++++++++--------- .../include/DataFormatsFDD/HvConfiguration.h | 26 +++++++++++++ .../FIT/FDD/src/DataFormatsFDDLinkDef.h | 5 +++ .../include/DataFormatsFV0/HvConfiguration.h | 1 - .../FIT/FV0/src/DataFormatsFV0LinkDef.h | 1 + 6 files changed, 55 insertions(+), 20 deletions(-) create mode 100644 DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/HvConfiguration.h diff --git a/DataFormats/Detectors/FIT/FDD/CMakeLists.txt b/DataFormats/Detectors/FIT/FDD/CMakeLists.txt index 140ba1165bff8..8e8f3f0588a0c 100644 --- a/DataFormats/Detectors/FIT/FDD/CMakeLists.txt +++ b/DataFormats/Detectors/FIT/FDD/CMakeLists.txt @@ -29,5 +29,7 @@ o2_target_root_dictionary(DataFormatsFDD include/DataFormatsFDD/RecPoint.h include/DataFormatsFDD/RawEventData.h include/DataFormatsFDD/LookUpTable.h - include/DataFormatsFDD/CTF.h) + include/DataFormatsFDD/CTF.h + include/DataFormatsFDD/FeeConfiguration.h + include/DataFormatsFDD/HvConfiguration.h) diff --git a/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h b/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h index a69a702de730f..959df0933662c 100644 --- a/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h +++ b/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h @@ -12,28 +12,30 @@ #ifndef O2_FDD_FEE_CONFIGURATION #define O2_FDD_FEE_CONFIGURATION -#include "CommonUtils/ConfigurableParamHelper.h" #include "DataFormatsFIT/Configuration.h" -namespace o2::fdd { -struct TriggersConfig +namespace o2::fdd { - float vertexTimeLowThreshold{o2::fit::config_helpers::DefaultValue}; - float vertexTimeHighThreshold{o2::fit::config_helpers::DefaultValue}; - uint16_t semicentralA{o2::fit::config_helpers::DefaultValue}; - uint16_t semicentralC{o2::fit::config_helpers::DefaultValue}; - uint16_t centralA{o2::fit::config_helpers::DefaultValue}; - uint16_t centralC{o2::fit::config_helpers::DefaultValue}; +struct TriggersConfig { + float vertexTimeLowThreshold{o2::fit::config_helpers::DefaultValue}; + float vertexTimeHighThreshold{o2::fit::config_helpers::DefaultValue}; + uint16_t semicentralA{o2::fit::config_helpers::DefaultValue}; + uint16_t semicentralC{o2::fit::config_helpers::DefaultValue}; + uint16_t centralA{o2::fit::config_helpers::DefaultValue}; + uint16_t centralC{o2::fit::config_helpers::DefaultValue}; + + ClassDefNV(TriggersConfig, 1); }; -struct FddFeeConfiguration : o2::conf::ConfigurableParamHelper { - static constexpr int NChannels = 16; - TriggersConfig triggers; - o2::fit::ChannelsConfig channels; - o2::fit::TcmConfig tcm; - o2::fit::PmConfig pmA[10]; - o2::fit::PmConfig pmC[10]; - O2ParamDef(FddFeeConfiguration, "FddFeeConfiguration"); +struct FddFeeConfiguration { + static constexpr int NChannels = 16; + TriggersConfig triggers; + o2::fit::ChannelsConfig channels; + o2::fit::TcmConfig tcm; + o2::fit::PmConfig pmA[10]; + o2::fit::PmConfig pmC[10]; + + ClassDefNV(FddFeeConfiguration, 1); }; -} +} // namespace o2::fdd #endif \ No newline at end of file diff --git a/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/HvConfiguration.h b/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/HvConfiguration.h new file mode 100644 index 0000000000000..abaaa4a355b64 --- /dev/null +++ b/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/HvConfiguration.h @@ -0,0 +1,26 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef O2_FDD_HV_CONFIGURATION +#define O2_FDD_HV_CONFIGURATION + +#include "DataFormatsFIT/Configuration.h" +#include + +namespace o2::fdd +{ +struct FddHvConfiguration { + static constexpr int NChannels = 16; + o2::fit::HvChannelsConfig channels; + ClassDefNV(FddHvConfiguration, 1); +}; +} // namespace o2::fdd +#endif \ No newline at end of file diff --git a/DataFormats/Detectors/FIT/FDD/src/DataFormatsFDDLinkDef.h b/DataFormats/Detectors/FIT/FDD/src/DataFormatsFDDLinkDef.h index daf1fb4027dc9..14d670882eacb 100644 --- a/DataFormats/Detectors/FIT/FDD/src/DataFormatsFDDLinkDef.h +++ b/DataFormats/Detectors/FIT/FDD/src/DataFormatsFDDLinkDef.h @@ -37,4 +37,9 @@ #pragma link C++ class o2::fdd::CTF + ; #pragma link C++ class o2::ctf::EncodedBlocks < o2::fdd::CTFHeader, 8, uint32_t> + ; +#pragma link C++ struct o2::fdd::FddFeeConfiguration + ; +#pragma link C++ struct o2::fit::ChannelsConfig < 16> + ; +#pragma link C++ struct o2::fdd::TriggersConfig + ; +#pragma link C++ struct o2::fdd::FddHvConfiguration + ; +#pragma link C++ struct o2::fit::HvChannelsConfig < 16> + ; #endif diff --git a/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/HvConfiguration.h b/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/HvConfiguration.h index c4b809f7eaa8b..207c83ba20d55 100644 --- a/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/HvConfiguration.h +++ b/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/HvConfiguration.h @@ -12,7 +12,6 @@ #ifndef O2_FV0_HV_CONFIGURATION #define O2_FV0_HV_CONFIGURATION -#include "CommonUtils/ConfigurableParamHelper.h" #include "DataFormatsFIT/Configuration.h" #include diff --git a/DataFormats/Detectors/FIT/FV0/src/DataFormatsFV0LinkDef.h b/DataFormats/Detectors/FIT/FV0/src/DataFormatsFV0LinkDef.h index 36ef1a80a6e97..10962ebe67383 100644 --- a/DataFormats/Detectors/FIT/FV0/src/DataFormatsFV0LinkDef.h +++ b/DataFormats/Detectors/FIT/FV0/src/DataFormatsFV0LinkDef.h @@ -43,4 +43,5 @@ #pragma link C++ struct o2::fv0::Fv0FeeConfiguration + ; #pragma link C++ struct o2::fit::ChannelsConfig < 48> + ; #pragma link C++ struct o2::fv0::Fv0HvConfiguration + ; +#pragma link C++ struct o2::fit::HvChannelsConfig < 48> + ; #endif From 355d9697dad4ffb37d7ed2a19d7bbc5b83c91e59 Mon Sep 17 00:00:00 2001 From: Wiktor Pierozak Date: Wed, 12 Aug 2026 10:56:22 +0200 Subject: [PATCH 21/28] Updated FDD config processor to include configuration parsing; fixed static memory corruption issue in HV schema; fixed schema issues in both FEE and HV --- .../include/DataFormatsFIT/Configuration.h | 45 ++--- .../FIT/FDD/dcsmonitoring/CMakeLists.txt | 4 +- .../FDDDCSMonitoring/FDDDCSConfigProcessor.h | 10 +- .../FDDFEEConfigurationReader.h | 29 +++ .../src/FDDDCSConfigProcessor.cxx | 38 ++-- .../src/FDDFEEConfigurationReader.cxx | 29 +++ .../workflow/FDDDCSConfigProcessorSpec.h | 16 +- .../FITDCSMonitoring/FITDCSBaseConfigReader.h | 3 +- .../FITFEEConfigurationReader.h | 43 +++-- .../FITHvConfigurationReader.h | 26 +-- .../src/FITDCSBaseConfigReader.cxx | 4 +- .../FITFEEConfigurationReaderTest.cxx | 181 ++++++++++++++---- .../FITHvConfigurationReaderTest.cxx | 84 ++++---- 13 files changed, 363 insertions(+), 149 deletions(-) create mode 100644 Detectors/FIT/FDD/dcsmonitoring/include/FDDDCSMonitoring/FDDFEEConfigurationReader.h create mode 100644 Detectors/FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx diff --git a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h index 73ac3d734492b..2b80b2e8500fa 100644 --- a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h +++ b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h @@ -70,13 +70,15 @@ struct PmConfig { template struct ChannelsConfig { - float timeAligments[NChannels]{}; - uint16_t cfdThresholds[NChannels]{}; - int16_t cfdZeros[NChannels]{}; - int16_t adcZeros[NChannels]{}; - uint16_t adcDelays[NChannels]{}; - bool channelMaskData[NChannels]{}; - bool channelMaskTriggers[NChannels]{}; + int16_t timeAligments[NChannels]; + uint16_t cfdThresholds[NChannels]; + int16_t cfdZeros[NChannels]; + int16_t adcZeros[NChannels]; + uint16_t adcDelays[NChannels]; + uint16_t rangeCorrectionAdc0[NChannels]; + uint16_t rangeCorrectionAdc1[NChannels]; + bool channelMaskData[NChannels]; + bool channelMaskTriggers[NChannels]; constexpr ChannelsConfig() { @@ -85,6 +87,8 @@ struct ChannelsConfig { config_helpers::fillDefaultArray(cfdZeros); config_helpers::fillDefaultArray(adcZeros); config_helpers::fillDefaultArray(adcDelays); + config_helpers::fillDefaultArray(rangeCorrectionAdc0); + config_helpers::fillDefaultArray(rangeCorrectionAdc1); config_helpers::fillDefaultArray(channelMaskData); config_helpers::fillDefaultArray(channelMaskTriggers); } @@ -95,30 +99,27 @@ struct ChannelsConfig { return value == static_cast(config_helpers::DefaultValue); } - gsl::span getTimeAligments() const { return timeAligments; } + gsl::span getTimeAligments() const { return timeAligments; } gsl::span getCfdThresholds() const { return cfdThresholds; } gsl::span getCfdZeros() const { return cfdZeros; } gsl::span getAdcZeros() const { return adcZeros; } gsl::span getAdcDelays() const { return adcDelays; } + gsl::span getRangeCorrectionAdc0() const { return rangeCorrectionAdc0; } + gsl::span getRangeCorrectionAdc1() const { return rangeCorrectionAdc1; } gsl::span getChannelMaskTriggers() const { return channelMaskTriggers; } gsl::span getChannelMaskData() const { return channelMaskData; } bool operator==(const ChannelsConfig& other) const { - return std::equal(std::begin(timeAligments), std::end(timeAligments), - std::begin(other.timeAligments)) && - std::equal(std::begin(cfdThresholds), std::end(cfdThresholds), - std::begin(other.cfdThresholds)) && - std::equal(std::begin(cfdZeros), std::end(cfdZeros), - std::begin(other.cfdZeros)) && - std::equal(std::begin(adcZeros), std::end(adcZeros), - std::begin(other.adcZeros)) && - std::equal(std::begin(adcDelays), std::end(adcDelays), - std::begin(other.adcDelays)) && - std::equal(std::begin(channelMaskData), std::end(channelMaskData), - std::begin(other.channelMaskData)) && - std::equal(std::begin(channelMaskTriggers), std::end(channelMaskTriggers), - std::begin(other.channelMaskTriggers)); + return std::equal(std::begin(timeAligments), std::end(timeAligments), std::begin(other.timeAligments)) && + std::equal(std::begin(cfdThresholds), std::end(cfdThresholds), std::begin(other.cfdThresholds)) && + std::equal(std::begin(cfdZeros), std::end(cfdZeros), std::begin(other.cfdZeros)) && + std::equal(std::begin(adcZeros), std::end(adcZeros), std::begin(other.adcZeros)) && + std::equal(std::begin(adcDelays), std::end(adcDelays), std::begin(other.adcDelays)) && + std::equal(std::begin(rangeCorrectionAdc0), std::end(rangeCorrectionAdc0), std::begin(other.rangeCorrectionAdc0)) && + std::equal(std::begin(rangeCorrectionAdc1), std::end(rangeCorrectionAdc1), std::begin(other.rangeCorrectionAdc1)) && + std::equal(std::begin(channelMaskData), std::end(channelMaskData), std::begin(other.channelMaskData)) && + std::equal(std::begin(channelMaskTriggers), std::end(channelMaskTriggers), std::begin(other.channelMaskTriggers)); } ClassDefNV(ChannelsConfig, 1); diff --git a/Detectors/FIT/FDD/dcsmonitoring/CMakeLists.txt b/Detectors/FIT/FDD/dcsmonitoring/CMakeLists.txt index 11ce378ab3a54..7b6566f8fbb97 100644 --- a/Detectors/FIT/FDD/dcsmonitoring/CMakeLists.txt +++ b/Detectors/FIT/FDD/dcsmonitoring/CMakeLists.txt @@ -10,8 +10,8 @@ # or submit itself to any jurisdiction. o2_add_library(FDDDCSMonitoring - SOURCES src/FDDDCSDataProcessor.cxx src/FDDDCSConfigProcessor.cxx - PUBLIC_LINK_LIBRARIES O2::FITDCSMonitoring) + SOURCES src/FDDDCSDataProcessor.cxx src/FDDDCSConfigProcessor.cxx src/FDDFEEConfigurationReader.cxx + PUBLIC_LINK_LIBRARIES O2::FITDCSMonitoring O2::DataFormatsFDD) o2_add_executable(dcs-sim-workflow COMPONENT_NAME fdd diff --git a/Detectors/FIT/FDD/dcsmonitoring/include/FDDDCSMonitoring/FDDDCSConfigProcessor.h b/Detectors/FIT/FDD/dcsmonitoring/include/FDDDCSMonitoring/FDDDCSConfigProcessor.h index 20c332f302e67..82885a42f80e7 100644 --- a/Detectors/FIT/FDD/dcsmonitoring/include/FDDDCSMonitoring/FDDDCSConfigProcessor.h +++ b/Detectors/FIT/FDD/dcsmonitoring/include/FDDDCSMonitoring/FDDDCSConfigProcessor.h @@ -15,18 +15,24 @@ #define O2_FDD_DCS_CONFIG_PROCESSOR_H #include "FITDCSMonitoring/FITDCSConfigProcessorSpec.h" +#include "FDDDCSMonitoring/FDDFEEConfigurationReader.h" +#include "FITDCSMonitoring/FITHvConfigurationReader.h" namespace o2::fdd { class FDDDCSConfigProcessor : public o2::fit::FITDCSConfigProcessor { public: - FDDDCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM) - : o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM, {}, {}) {} + FDDDCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM, const o2::header::DataDescription& dataDescriptionFeeConfig, const o2::header::DataDescription& dataDescriptionHvConfig) + : o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM, dataDescriptionFeeConfig, dataDescriptionHvConfig) {} void init(o2::framework::InitContext& ic) final; void run(o2::framework::ProcessingContext& pc) final; void endOfStream(o2::framework::EndOfStreamContext& ec) final; + + private: + FDDFEEConfigurationReader mFeeConfigurationReader; + o2::fit::FITHvConfigurationReader mHvConfigurationReader; }; } // namespace o2::fdd #endif \ No newline at end of file diff --git a/Detectors/FIT/FDD/dcsmonitoring/include/FDDDCSMonitoring/FDDFEEConfigurationReader.h b/Detectors/FIT/FDD/dcsmonitoring/include/FDDDCSMonitoring/FDDFEEConfigurationReader.h new file mode 100644 index 0000000000000..a604afb391513 --- /dev/null +++ b/Detectors/FIT/FDD/dcsmonitoring/include/FDDDCSMonitoring/FDDFEEConfigurationReader.h @@ -0,0 +1,29 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef O2_FDD_DCSCONFIGREADER_H +#define O2_FDD_DCSCONFIGREADER_H + +#include "FITDCSMonitoring/FITFEEConfigurationReader.h" +#include "DataFormatsFDD/FeeConfiguration.h" + +namespace o2::fdd +{ +class FDDFEEConfigurationReader : public o2::fit::FITFEEConfigurationReader +{ + public: + FddFeeConfiguration parseFeeConfiguration(gsl::span configBuf); + void parseTriggers(const rapidjson::Value& root, const char* triggersNodeName, TriggersConfig& config); +}; + +} // namespace o2::fdd + +#endif // O2_FV0_DCSCONFIGREADER_H \ No newline at end of file diff --git a/Detectors/FIT/FDD/dcsmonitoring/src/FDDDCSConfigProcessor.cxx b/Detectors/FIT/FDD/dcsmonitoring/src/FDDDCSConfigProcessor.cxx index e4533f308119e..bf063bbbc0dfa 100644 --- a/Detectors/FIT/FDD/dcsmonitoring/src/FDDDCSConfigProcessor.cxx +++ b/Detectors/FIT/FDD/dcsmonitoring/src/FDDDCSConfigProcessor.cxx @@ -1,28 +1,40 @@ #include "FDDDCSMonitoring/FDDDCSConfigProcessor.h" +#include "DataFormatsFDD/HvConfiguration.h" -namespace o2::fdd { +namespace o2::fdd +{ void FDDDCSConfigProcessor::init(o2::framework::InitContext& ic) { - initDeadChannelMapReader(); - setupDeadChannelMapReader(ic); + initDeadChannelMapReader(); + setupDeadChannelMapReader(ic); + setupFeeConfigurationReader(ic, mFeeConfigurationReader); + setupHvConfigurationReader(ic, mHvConfigurationReader); } void FDDDCSConfigProcessor::run(o2::framework::ProcessingContext& pc) { - long dataTime = getValidityTime(pc); + long dataTime = getValidityTime(pc); - gsl::span dataBuffer = pc.inputs().get>("inputConfig"); - std::string configFileName = pc.inputs().get("inputConfigFileName"); - LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); + gsl::span dataBuffer = pc.inputs().get>("inputConfig"); + std::string configFileName = pc.inputs().get("inputConfigFileName"); + LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); - if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { - handleDeadChannelMapUpdate(pc,dataTime, dataBuffer); - } else { - LOG(error) << "Unknown input file: " << configFileName; - } + if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { + handleDeadChannelMapUpdate(pc, dataTime, dataBuffer); + } else if (mFeeConfigurationReader.matchFilename(configFileName)) { + FddFeeConfiguration feeConfiguration = mFeeConfigurationReader.parseFeeConfiguration(dataBuffer); + o2::ccdb::CcdbObjectInfo objectInfo = mFeeConfigCcdbInfo.createObjectInfo(feeConfiguration, dataTime, {}); + sendObject(pc.outputs(), feeConfiguration, objectInfo, getFeeConfigDescription()); + } else if (mHvConfigurationReader.matchFilename(configFileName)) { + FddHvConfiguration hvConfig = mHvConfigurationReader.parseHvConfiguration(dataBuffer); + o2::ccdb::CcdbObjectInfo objectInfo = mHvConfigCcdbInfo.createObjectInfo(hvConfig, dataTime, {}); + sendObject(pc.outputs(), hvConfig, objectInfo, getHvConfigDescription()); + } else { + LOG(error) << "Unknown input file: " << configFileName; + } } void FDDDCSConfigProcessor::endOfStream(o2::framework::EndOfStreamContext& ec) { } -} \ No newline at end of file +} // namespace o2::fdd \ No newline at end of file diff --git a/Detectors/FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx b/Detectors/FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx new file mode 100644 index 0000000000000..cd4f6badfc592 --- /dev/null +++ b/Detectors/FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx @@ -0,0 +1,29 @@ +#include "FDDDCSMonitoring/FDDFEEConfigurationReader.h" +#include +#include + +namespace o2::fdd +{ +FddFeeConfiguration FDDFEEConfigurationReader::parseFeeConfiguration(gsl::span buffer) +{ + return FITFEEConfigurationReader::parseFeeConfiguration(buffer); +} + +void FDDFEEConfigurationReader::parseTriggers(const rapidjson::Value& root, const char* triggersNodeName, TriggersConfig& config) +{ + const auto& triggersNode = root["triggers"]; + const auto& vertexTimeLowThresholdNode = triggersNode["vertex_time_low_threshold"]; + const auto& vertexTimeHighThresholdNode = triggersNode["vertex_time_high_threshold"]; + const auto& semicentralANode = triggersNode["semi_central_a"]; + const auto& semicentralCNode = triggersNode["semi_central_c"]; + const auto& centralANode = triggersNode["central_a"]; + const auto& centralCNode = triggersNode["central_c"]; + + config.vertexTimeLowThreshold = vertexTimeLowThresholdNode.GetInt(); + config.vertexTimeHighThreshold = vertexTimeHighThresholdNode.GetInt(); + config.semicentralA = semicentralANode.GetUint(); + config.semicentralC = semicentralCNode.GetUint(); + config.centralA = centralANode.GetUint(); + config.centralC = centralCNode.GetUint(); +} +} // namespace o2::fdd \ No newline at end of file diff --git a/Detectors/FIT/FDD/dcsmonitoring/workflow/FDDDCSConfigProcessorSpec.h b/Detectors/FIT/FDD/dcsmonitoring/workflow/FDDDCSConfigProcessorSpec.h index 867035d39d765..76ebb6eeffcfc 100644 --- a/Detectors/FIT/FDD/dcsmonitoring/workflow/FDDDCSConfigProcessorSpec.h +++ b/Detectors/FIT/FDD/dcsmonitoring/workflow/FDDDCSConfigProcessorSpec.h @@ -37,16 +37,28 @@ DataProcessorSpec getFDDDCSConfigProcessorSpec() outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBPayload, ddDChM}, Lifetime::Sporadic); outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBWrapper, ddDChM}, Lifetime::Sporadic); + o2::header::DataDescription ddFeeConfig = "FDD_FEE_CONFIG"; + outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBPayload, ddFeeConfig}, Lifetime::Sporadic); + outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBWrapper, ddFeeConfig}, Lifetime::Sporadic); + + o2::header::DataDescription ddHvConfig = "FDD_HV_CONFIG"; + outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBPayload, ddHvConfig}, Lifetime::Sporadic); + outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBWrapper, ddHvConfig}, Lifetime::Sporadic); + return DataProcessorSpec{ "fdd-dcs-config-processor", Inputs{{"inputConfig", o2::header::gDataOriginFDD, "DCS_CONFIG_FILE", Lifetime::Sporadic}, {"inputConfigFileName", o2::header::gDataOriginFDD, "DCS_CONFIG_NAME", Lifetime::Sporadic}}, outputs, - AlgorithmSpec{adaptFromTask("FDD", ddDChM)}, + AlgorithmSpec{adaptFromTask("FDD", ddDChM, ddFeeConfig, ddHvConfig)}, Options{{"use-verbose-mode", VariantType::Bool, false, {"Use verbose mode"}}, {"filename-dchm", VariantType::String, "FDD-deadchannels.txt", {"Dead channel map file name"}}, {"valid-days-dchm", VariantType::UInt32, 180u, {"Dead channel map validity in days"}}, - {"no-validate", VariantType::Bool, false, {"Don't validate the CCDB uploads"}}}}; + {"no-validate", VariantType::Bool, false, {"Don't validate the CCDB uploads"}}, + {"filename-fee-config", VariantType::String, "ft0-fee-config.json", {"FEE configuration file name"}}, + {"valid-days-fee-config", VariantType::UInt32, 180u, {"FEE configuration validity in days"}}, + {"filename-hv-config", VariantType::String, "ft0-hv-config.json", {"HV configuration file name"}}, + {"valid-days-hv-config", VariantType::UInt32, 180u, {"HV configuration validity in days"}}}}; } } // namespace framework diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSBaseConfigReader.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSBaseConfigReader.h index decb3ce515c16..045a1eb4ee6b6 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSBaseConfigReader.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSBaseConfigReader.h @@ -22,6 +22,7 @@ namespace o2::fit class FITDCSBaseConfigReader { public: + virtual ~FITDCSBaseConfigReader() = default; template void parseJsonArray(const rapidjson::Value& node, const char* childName, T (&array)[Size]) { @@ -82,7 +83,7 @@ class FITDCSBaseConfigReader bool validateSchema(const rapidjson::Document& docs, std::string& errorMessage); protected: - void loadSchema(const std::string& schema); + void loadSchema(std::string_view schema); rapidjson::Document parseJsonBuffer(gsl::span buffer, bool throwOnInvalidSchema = true); private: diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h index 318b3c342322b..decce9d7e0cf7 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h @@ -29,6 +29,8 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader loadSchema(configurationSchema); } + virtual ~FITFEEConfigurationReader() = default; + protected: template ConfigType parseFeeConfiguration(gsl::span buffer) @@ -95,11 +97,13 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader void parseChannelData(const rapidjson::Value& root, const char* channelsNodeName, ChannelsConfig& channelsConfiguration) { const auto& channelsNode = root[channelsNodeName]; - parseJsonArray(channelsNode, "time_aligments", channelsConfiguration.timeAligments); + parseJsonArray(channelsNode, "time_alignments", channelsConfiguration.timeAligments); parseJsonArray(channelsNode, "cfd_thresholds", channelsConfiguration.cfdThresholds); parseJsonArray(channelsNode, "cfd_zeros", channelsConfiguration.cfdZeros); parseJsonArray(channelsNode, "adc_zeros", channelsConfiguration.adcZeros); parseJsonArray(channelsNode, "adc_delays", channelsConfiguration.adcDelays); + parseJsonArray(channelsNode, "range_correction_adc0", channelsConfiguration.rangeCorrectionAdc0); + parseJsonArray(channelsNode, "range_correction_adc1", channelsConfiguration.rangeCorrectionAdc1); parseJsonArray(channelsNode, "channel_mask_data", channelsConfiguration.channelMaskData); parseJsonArray(channelsNode, "channel_mask_triggers", channelsConfiguration.channelMaskTriggers); } @@ -116,7 +120,11 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader void parsePmConfig(const rapidjson::Value& pmNode, PmConfig& pmConfig) { const auto& orGateNode = pmNode["or_gate"]; + const auto& trgChargeHighLevelNode = pmNode["trg_charge_high_level"]; + const auto& trgChargeLowLevelNode = pmNode["trg_charge_low_level"]; pmConfig.orGate = orGateNode.GetUint(); + pmConfig.trgChargeHighLevel = trgChargeHighLevelNode.GetUint(); + pmConfig.trgChargeLowLevel = trgChargeLowLevelNode.GetUint(); } template @@ -139,40 +147,44 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader } } - const std::string& getSchemaString() const + std::string_view getSchemaString() const { return configurationSchema; } private: - static const std::string configurationSchema; -}; - -template -const std::string FITFEEConfigurationReader::configurationSchema = R"SCH( + inline static constexpr std::string_view configurationSchema = R"SCH( { "type": "object", "properties": { "channels": { "type": "object", "properties": { - "time_aligments": {"type": "array", "items": {"type": "integer"}}, + "time_alignments": {"type": "array", "items": {"type": "integer"}}, "cfd_thresholds": {"type": "array", "items": {"type": "integer"}}, "cfd_zeros": {"type": "array", "items": {"type": "integer"}}, "adc_zeros": {"type": "array", "items": {"type": "integer"}}, "adc_delays": {"type": "array", "items": {"type": "integer"}}, + "range_correction_adc0": {"type": "array", "items": {"type": "integer"}}, + "range_correction_adc1": {"type": "array", "items": {"type": "integer"}}, "channel_mask_data": {"type": "array", "items": {"type": "boolean"}}, "channel_mask_triggers": {"type": "array", "items": {"type": "boolean"}} }, - "required": ["time_aligments", "cfd_thresholds", "cfd_zeros", - "adc_zeros", "adc_delays", "channel_mask_data", "channel_mask_triggers"] + "additionalProperties": false, + "required": [ + "time_alignments", "cfd_thresholds", "cfd_zeros", + "adc_zeros", "adc_delays", "range_correction_adc0", "range_correction_adc1", + "channel_mask_data", "channel_mask_triggers" + ] }, "tcm" : { "type": "object", "properties": { "phase_delay_a": {"type": "number"}, "phase_delay_c": {"type": "number"} - } + }, + "additionalProperties": false, + "required": ["phase_delay_a", "phase_delay_c"] }, "pm_a":{ "type": "array", @@ -182,7 +194,9 @@ const std::string FITFEEConfigurationReader::configurat "or_gate": {"type": "number"}, "trg_charge_low_level": {"type": "number"}, "trg_charge_high_level": {"type": "number"} - } + }, + "additionalProperties": false, + "required": ["or_gate", "trg_charge_low_level", "trg_charge_high_level"] } }, "pm_c": { @@ -193,7 +207,9 @@ const std::string FITFEEConfigurationReader::configurat "or_gate": {"type": "number"}, "trg_charge_low_level": {"type": "number"}, "trg_charge_high_level": {"type": "number"} - } + }, + "additionalProperties": false, + "required": ["or_gate", "trg_charge_low_level", "trg_charge_high_level"] } }, "triggers": { @@ -204,6 +220,7 @@ const std::string FITFEEConfigurationReader::configurat "required": ["channels", "tcm", "triggers"] } )SCH"; +}; } // namespace o2::fit #endif \ No newline at end of file diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITHvConfigurationReader.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITHvConfigurationReader.h index 2733981086a15..14ee98a27e05d 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITHvConfigurationReader.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITHvConfigurationReader.h @@ -44,34 +44,34 @@ class FITHvConfigurationReader : public FITDCSBaseConfigReader parseJsonArray(hvChannels, "gain", config.gain); } - const std::string& getSchemaString() const + std::string_view getSchemaString() const { return configurationSchema; } private: - static const std::string configurationSchema; -}; - -const std::string FITHvConfigurationReader::configurationSchema = R"json( -{ + inline static constexpr std::string_view configurationSchema = R"json( + { "type": "object", "properties": { - "hv_channels": { + "hv_channels": { "type": "object", "properties": { - "gain" : { - "type": "array", - "items": {"type": "number"} - } + "gain": { + "type": "array", + "items": { + "type": "number" } + } }, "additionalProperties": false, "required": ["gain"] + } }, "additionalProperties": false, "required": ["hv_channels"] -} -)json"; + } + )json"; +}; } // namespace o2::fit #endif \ No newline at end of file diff --git a/Detectors/FIT/common/dcsmonitoring/src/FITDCSBaseConfigReader.cxx b/Detectors/FIT/common/dcsmonitoring/src/FITDCSBaseConfigReader.cxx index bb66b0a8b65f3..63f48b991c3f6 100644 --- a/Detectors/FIT/common/dcsmonitoring/src/FITDCSBaseConfigReader.cxx +++ b/Detectors/FIT/common/dcsmonitoring/src/FITDCSBaseConfigReader.cxx @@ -17,10 +17,10 @@ rapidjson::Document FITDCSBaseConfigReader::parseJsonBuffer(gsl::span -void addPmConfigsNode(rapidjson::Document& doc, const char* nodeName, const uint8_t (&orGateValues)[NChannels]) +void addPmConfigsNode(rapidjson::Document& doc, const char* nodeName, const uint8_t (&orGateValues)[NChannels], const uint16_t (&trgChargeLowLevel)[NChannels], const uint16_t (&trgChargeHighLevel)[NChannels]) { auto& allocator = doc.GetAllocator(); @@ -84,6 +86,8 @@ void addPmConfigsNode(rapidjson::Document& doc, const char* nodeName, const uint for (size_t idx = 0; idx < NChannels; ++idx) { rapidjson::Value pm(rapidjson::kObjectType); pm.AddMember("or_gate", orGateValues[idx], allocator); + pm.AddMember("trg_charge_low_level", trgChargeLowLevel[idx], allocator); + pm.AddMember("trg_charge_high_level", trgChargeHighLevel[idx], allocator); pmJson.PushBack(pm, allocator); } @@ -105,11 +109,13 @@ void addArrayMember(rapidjson::Value& node, const char* memberName, const T (&va template void addChannelsConfigNode(rapidjson::Document& doc, const char* nodeName, - const float (&timeAligments)[NChannels], + const int16_t (&timeAligments)[NChannels], const uint16_t (&cfdThresholds)[NChannels], const int16_t (&cfdZeros)[NChannels], const int16_t (&adcZeros)[NChannels], const uint16_t (&adcDelays)[NChannels], + const uint16_t (&rangeCorrectionAdc0)[NChannels], + const uint16_t (&rangeCorrectionAdc1)[NChannels], const bool (&channelMaskData)[NChannels], const bool (&channelMaskTriggers)[NChannels]) { @@ -117,11 +123,13 @@ void addChannelsConfigNode(rapidjson::Document& doc, rapidjson::Value channelsJson(rapidjson::kObjectType); - addArrayMember(channelsJson, "time_aligments", timeAligments, allocator); + addArrayMember(channelsJson, "time_alignments", timeAligments, allocator); addArrayMember(channelsJson, "cfd_thresholds", cfdThresholds, allocator); addArrayMember(channelsJson, "cfd_zeros", cfdZeros, allocator); addArrayMember(channelsJson, "adc_zeros", adcZeros, allocator); addArrayMember(channelsJson, "adc_delays", adcDelays, allocator); + addArrayMember(channelsJson, "range_correction_adc0", rangeCorrectionAdc0, allocator); + addArrayMember(channelsJson, "range_correction_adc1", rangeCorrectionAdc1, allocator); addArrayMember(channelsJson, "channel_mask_data", channelMaskData, allocator); addArrayMember(channelsJson, "channel_mask_triggers", channelMaskTriggers, allocator); @@ -153,8 +161,10 @@ class SimpleFITFEEConfigurationReader BOOST_AUTO_TEST_CASE(shouldParseSinglePmConfig) { const uint8_t orGateValue = 20; + const uint16_t rangeCorrectionAdc0 = 1024; + const uint16_t rangeCorrectionAdc1 = 2048; - rapidjson::Document doc = createPmConfigNode(orGateValue); + rapidjson::Document doc = createPmConfigNode(orGateValue, rangeCorrectionAdc0, rangeCorrectionAdc1); PmConfig pmConfig; SimpleFITFEEConfigurationReader reader; @@ -186,11 +196,15 @@ BOOST_AUTO_TEST_CASE(shouldParseTcmConfig) BOOST_AUTO_TEST_CASE(shouldParseArrayOfPmConfigs) { const uint8_t pmAOrGate[] = {3, 4}; + const uint16_t pmATrgChargeLowLevel[] = {2047, 2048}; + const uint16_t pmATrgChargeHighLevel[] = {1047, 1048}; const uint8_t pmCOrGate[] = {5, 6}; + const uint16_t pmCTrgChargeLowLevel[] = {2045, 2046}; + const uint16_t pmCTrgChargeHighLevel[] = {1045, 1046}; rapidjson::Document doc = createEmptyPayload(); - addPmConfigsNode(doc, "pm_a", pmAOrGate); - addPmConfigsNode(doc, "pm_c", pmCOrGate); + addPmConfigsNode(doc, "pm_a", pmAOrGate, pmATrgChargeLowLevel, pmATrgChargeHighLevel); + addPmConfigsNode(doc, "pm_c", pmCOrGate, pmCTrgChargeLowLevel, pmCTrgChargeHighLevel); PmConfig pmAParsed[2]; PmConfig pmCParsed[2]; @@ -211,9 +225,11 @@ BOOST_AUTO_TEST_CASE(shouldParseArrayOfPmConfigs) BOOST_AUTO_TEST_CASE(shouldThrowOnInconsistentPmsArraySize) { const uint8_t pmAOrGate[] = {0, 0}; + const uint16_t pmATrgChargeLowLevel[] = {2047, 2048}; + const uint16_t pmATrgChargeHighLevel[] = {1047, 1048}; rapidjson::Document doc = createEmptyPayload(); - addPmConfigsNode(doc, "pm_a", pmAOrGate); + addPmConfigsNode(doc, "pm_a", pmAOrGate, pmATrgChargeLowLevel, pmATrgChargeHighLevel); PmConfig pmAParsed[3]; @@ -226,11 +242,13 @@ BOOST_AUTO_TEST_CASE(shouldParseChannelsConfig) { constexpr size_t NTestChannels = 4; - const float timeAligments[NTestChannels] = {1.1f, 2.2f, 3.3f, 4.4f}; + const int16_t timeAligments[NTestChannels] = {1, 2, 3, 4}; const uint16_t cfdThresholds[NTestChannels] = {10, 20, 30, 40}; const int16_t cfdZeros[NTestChannels] = {-1, -2, -3, -4}; const int16_t adcZeros[NTestChannels] = {100, 200, 300, 400}; const uint16_t adcDelays[NTestChannels] = {5, 6, 7, 8}; + const uint16_t rangeCorrectionAdc0[NTestChannels] = {2045, 2046, 2047, 2048}; + const uint16_t rangeCorrectionAdc1[NTestChannels] = {2048, 2022, 2021, 2022}; const bool channelMaskData[NTestChannels] = {true, false, true, false}; const bool channelMaskTriggers[NTestChannels] = {false, true, false, true}; @@ -244,6 +262,8 @@ BOOST_AUTO_TEST_CASE(shouldParseChannelsConfig) cfdZeros, adcZeros, adcDelays, + rangeCorrectionAdc0, + rangeCorrectionAdc1, channelMaskData, channelMaskTriggers); @@ -268,21 +288,39 @@ BOOST_AUTO_TEST_CASE(shouldAcceptValidFeeConfigurationPayload) const char* jsonPayload = R"json( { "channels": { - "time_aligments": [1, 2, 3, 4], + "time_alignments": [1, 2, 3, 4], "cfd_thresholds": [10, 20, 30, 40], "cfd_zeros": [11, 22, 33, 44], "adc_zeros": [21, 22, 23, 24], "adc_delays": [31, 32, 33, 34], + "range_correction_adc0": [2048, 2048, 1025, 1024], + "range_correction_adc1": [2048, 2047, 2046, 2045], "channel_mask_data": [true, false, true, false], "channel_mask_triggers": [true, true, false, false] }, "pm_a": [ - {"or_gate": 1.21}, - {"or_gate": 1.22} + { + "or_gate": 1.21, + "trg_charge_low_level": 2, + "trg_charge_high_level": 5 + }, + { + "or_gate": 1.22, + "trg_charge_low_level": 4, + "trg_charge_high_level": 7 + } ], "pm_c": [ - {"or_gate": 0.1}, - {"or_gate": 0.2} + { + "or_gate": 1.22, + "trg_charge_low_level": 4, + "trg_charge_high_level": 7 + }, + { + "or_gate": 1.22, + "trg_charge_low_level": 4, + "trg_charge_high_level": 7 + } ], "tcm": { "phase_delay_a": 3.3, @@ -307,23 +345,41 @@ BOOST_AUTO_TEST_CASE(shouldAcceptValidFeeConfigurationPayloadWithNullPmData) const char* jsonPayload = R"json( { "channels": { - "time_aligments": [1, 2, 3, 4], + "time_alignments": [1, 2, 3, 4], "cfd_thresholds": [10, 20, 30, 40], "cfd_zeros": [11, 22, 33, 44], "adc_zeros": [21, 22, 23, 24], "adc_delays": [31, 32, 33, 34], + "range_correction_adc0": [2048, 2048, 1025, 1024], + "range_correction_adc1": [2048, 2047, 2046, 2045], "channel_mask_data": [true, false, true, false], "channel_mask_triggers": [true, true, false, false] }, "pm_a": [ - {"or_gate": 1.21}, + { + "or_gate": 1.21, + "trg_charge_low_level": 2, + "trg_charge_high_level": 5 + }, null, - {"or_gate": 1.22} + { + "or_gate": 1.21, + "trg_charge_low_level": 2, + "trg_charge_high_level": 5 + } ], "pm_c": [ null, - {"or_gate": 0.1}, - {"or_gate": 0.2}, + { + "or_gate": 1.21, + "trg_charge_low_level": 2, + "trg_charge_high_level": 5 + }, + { + "or_gate": 1.21, + "trg_charge_low_level": 2, + "trg_charge_high_level": 5 + }, null, null ], @@ -353,23 +409,40 @@ BOOST_AUTO_TEST_CASE(shouldDetectInvalidPayload) const char* missingChannelData = R"json( { "channels": { - "time_aligments": [1, 2, 3, 4], - "cfd_thresholds": [10, 20, 40], + "time_alignments": [1, 2, 3, 4], + "cfd_thresholds": [10, 20, 40, 44], "cfd_zeros": [11, 22, 33, 44], - "adc_zeros": [21, 22, 23], "adc_delays": [31, 32, 33, 34], + "range_correction_adc0": [2048, 2048, 1025, 1024], + "range_correction_adc1": [2048, 2047, 2046, 2045], "channel_mask_data": [true, false, true, false], "channel_mask_triggers": [true, true, false, false] }, "pm_a": [ - {"or_gate": 1.21}, + { + "or_gate": 1.21, + "trg_charge_low_level": 2, + "trg_charge_high_level": 5 + }, null, - {"or_gate": 1.22} + { + "or_gate": 1.21, + "trg_charge_low_level": 2, + "trg_charge_high_level": 5 + } ], "pm_c": [ null, - {"or_gate": 0.1}, - {"or_gate": 0.2}, + { + "or_gate": 1.21, + "trg_charge_low_level": 2, + "trg_charge_high_level": 5 + }, + { + "or_gate": 1.21, + "trg_charge_low_level": 2, + "trg_charge_high_level": 5 + }, null, null ], @@ -389,21 +462,34 @@ BOOST_AUTO_TEST_CASE(shouldDetectInvalidPayload) const char* invalidPmConfig = R"json( { "channels": { - "time_aligments": [1, 2, 3, 5, 4], + "time_alignments": [1, 2, 3, 5, 4], "cfd_thresholds": [10, 20, 30, 40], "cfd_zeros": [11, 22, 33, 44], "adc_zeros": [21, 22, 23, 24], - "adc_delays": [31, 32, 33, 34], + "range_correction_adc0": [2048, 2048, 1025, 1024], + "range_correction_adc1": [2048, 2047, 2046, 2045], "channel_mask_data": [true, false, true, false], "channel_mask_triggers": [true, true, false, false] }, "pm_a": [ - {"or_gate": 1.21}, + { + "or_gate": 1.21, + "trg_charge_low_level": 2, + "trg_charge_high_level": 5 + }, null, - {"o_gate": 1.22} + { + "or_gate": 1.21, + "trg_charge_low_level": 2, + "trg_charge_high_level": 5 + } ], "pm_c": [ - {"gate": 0.2}, + { + "or_gate": 1.21, + "trg_charge_low_level": 2, + "trg_charge_high_level": 5 + } ], "tcm": { "phase_delay_a": 3.3, @@ -415,34 +501,51 @@ BOOST_AUTO_TEST_CASE(shouldDetectInvalidPayload) } )json"; - doc = createDocumentFromString(missingChannelData); + doc = createDocumentFromString(invalidPmConfig); BOOST_CHECK(reader.validateSchema(doc, errorMessage) == false); const char* invalidTcmConfig = R"json( { "channels": { - "time_aligments": [1, 2, 3, 4], + "time_alignments": [1, 2, 3, 4], "cfd_thresholds": [10, 20, 30, 40], "cfd_zeros": [11, 22, 33, 44], "adc_zeros": [21, 22, 23, 24], "adc_delays": [31, 32, 33, 34], + "range_correction_adc0": [2048, 2048, 1025, 1024], + "range_correction_adc1": [2048, 2047, 2046, 2045], "channel_mask_data": [true, false, true, false], "channel_mask_triggers": [true, true, false, false] }, "pm_a": [ - {"or_gate": 1.21}, + { + "or_gate": 1.21, + "trg_charge_low_level": 2, + "trg_charge_high_level": 5 + }, null, - {"or_gate": 1.22} + { + "or_gate": 1.21, + "trg_charge_low_level": 2, + "trg_charge_high_level": 5 + } ], "pm_c": [ null, - {"or_gate": 0.1}, - {"or_gate": 0.2}, + { + "or_gate": 1.21, + "trg_charge_low_level": 2, + "trg_charge_high_level": 5 + }, + { + "or_gate": 1.21, + "trg_charge_low_level": 2, + "trg_charge_high_level": 5 + }, null, null ], "tcm": { - "phase_a": 3.3, "phase_delay_c": 4.4 }, "triggers": { @@ -451,7 +554,7 @@ BOOST_AUTO_TEST_CASE(shouldDetectInvalidPayload) } )json"; - doc = createDocumentFromString(missingChannelData); + doc = createDocumentFromString(invalidTcmConfig); BOOST_CHECK(reader.validateSchema(doc, errorMessage) == false); } diff --git a/Detectors/FIT/common/tests/dcsmonitoring/FITHvConfigurationReaderTest.cxx b/Detectors/FIT/common/tests/dcsmonitoring/FITHvConfigurationReaderTest.cxx index d88480d4d5801..5f97eb37385df 100644 --- a/Detectors/FIT/common/tests/dcsmonitoring/FITHvConfigurationReaderTest.cxx +++ b/Detectors/FIT/common/tests/dcsmonitoring/FITHvConfigurationReaderTest.cxx @@ -22,70 +22,74 @@ using namespace o2::fit; BOOST_AUTO_TEST_SUITE(o2_fit_dcs_monitoring) -rapidjson::Document createEmptyPayload() { - rapidjson::Document doc; - doc.SetObject(); - return doc; +rapidjson::Document createEmptyPayload() +{ + rapidjson::Document doc; + doc.SetObject(); + return doc; } -rapidjson::Document createDocumentFromString(const char* data) { - rapidjson::Document doc; - doc.Parse(data); - return doc; +rapidjson::Document createDocumentFromString(const char* data) +{ + rapidjson::Document doc; + doc.Parse(data); + return doc; } -template -void addToPayloadHvChannels(rapidjson::Document& doc, float (&gainValues)[NChannels]) { - auto& allocator = doc.GetAllocator(); - - rapidjson::Value gainJson(rapidjson::kArrayType); - for(int idx = 0; idx < NChannels; idx++) { - gainJson.PushBack(gainValues[idx], allocator); - } - rapidjson::Value hvChannelsJson(rapidjson::kObjectType); - hvChannelsJson.AddMember("gain", gainJson, allocator); - doc.AddMember("hv_channels", hvChannelsJson, allocator); +template +void addToPayloadHvChannels(rapidjson::Document& doc, float (&gainValues)[NChannels]) +{ + auto& allocator = doc.GetAllocator(); + + rapidjson::Value gainJson(rapidjson::kArrayType); + for (int idx = 0; idx < NChannels; idx++) { + gainJson.PushBack(gainValues[idx], allocator); + } + rapidjson::Value hvChannelsJson(rapidjson::kObjectType); + hvChannelsJson.AddMember("gain", gainJson, allocator); + doc.AddMember("hv_channels", hvChannelsJson, allocator); } -template -HvChannelsConfig createExpectedConfig(float (&gainValues)[NChannels]) { - HvChannelsConfig expectedConfig; - std::memcpy(std::begin(expectedConfig.gain), gainValues, sizeof(float) * NChannels); - return expectedConfig; +template +HvChannelsConfig createExpectedConfig(float (&gainValues)[NChannels]) +{ + HvChannelsConfig expectedConfig; + std::memcpy(std::begin(expectedConfig.gain), gainValues, sizeof(float) * NChannels); + return expectedConfig; } -BOOST_AUTO_TEST_CASE(shouldParseHvChannels) +BOOST_AUTO_TEST_CASE(shouldParseHvChannels) { - constexpr size_t NChannels = 5; - float gainValues[NChannels] = {1.0, 2.1, 3.2, 4.3, 5.4}; + constexpr size_t NChannels = 5; + float gainValues[NChannels] = {1.0, 2.1, 3.2, 4.3, 5.4}; - rapidjson::Document doc = createEmptyPayload(); - addToPayloadHvChannels(doc, gainValues); + rapidjson::Document doc = createEmptyPayload(); + addToPayloadHvChannels(doc, gainValues); - HvChannelsConfig channelsConfig; - FITHvConfigurationReader reader; - reader.parseHvChannelData(doc, "hv_channels", channelsConfig); + HvChannelsConfig channelsConfig; + FITHvConfigurationReader reader; + reader.parseHvChannelData(doc, "hv_channels", channelsConfig); - HvChannelsConfig expectedConfig = createExpectedConfig(gainValues); + HvChannelsConfig expectedConfig = createExpectedConfig(gainValues); - BOOST_CHECK(expectedConfig == channelsConfig); + BOOST_CHECK(expectedConfig == channelsConfig); } BOOST_AUTO_TEST_CASE(shouldAcceptValidJsonPayload) { - const char* jsonPayload = R"json( + const char* jsonPayload = R"json( { "hv_channels" : { - "gain": [1,2,3,4], + "gain": [1,2,3,4] } } )json"; - rapidjson::Document doc = createDocumentFromString(jsonPayload); + rapidjson::Document doc = createDocumentFromString(jsonPayload); - FITHvConfigurationReader reader; - std::string errorMessage; - BOOST_CHECK_MESSAGE(reader.validateSchema(doc, errorMessage), errorMessage); + FITHvConfigurationReader reader; + std::string errorMessage; + BOOST_CHECK_MESSAGE(reader.validateSchema(doc, errorMessage), errorMessage); } BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file From 581a9f27a4d1280ac099be0b551594ec7f3a6abc Mon Sep 17 00:00:00 2001 From: Wiktor Pierozak Date: Wed, 12 Aug 2026 11:14:08 +0200 Subject: [PATCH 22/28] Fixed error handling in FDD and FV0 to preven abort on exception --- .../src/FDDDCSConfigProcessor.cxx | 36 ++++++++++--------- .../src/FT0DCSConfigProcessor.cxx | 2 -- .../src/FV0DCSConfigProcessor.cxx | 36 ++++++++++--------- 3 files changed, 40 insertions(+), 34 deletions(-) diff --git a/Detectors/FIT/FDD/dcsmonitoring/src/FDDDCSConfigProcessor.cxx b/Detectors/FIT/FDD/dcsmonitoring/src/FDDDCSConfigProcessor.cxx index bf063bbbc0dfa..e23f2ea2dd7d2 100644 --- a/Detectors/FIT/FDD/dcsmonitoring/src/FDDDCSConfigProcessor.cxx +++ b/Detectors/FIT/FDD/dcsmonitoring/src/FDDDCSConfigProcessor.cxx @@ -13,24 +13,28 @@ void FDDDCSConfigProcessor::init(o2::framework::InitContext& ic) void FDDDCSConfigProcessor::run(o2::framework::ProcessingContext& pc) { - long dataTime = getValidityTime(pc); + try { + long dataTime = getValidityTime(pc); - gsl::span dataBuffer = pc.inputs().get>("inputConfig"); - std::string configFileName = pc.inputs().get("inputConfigFileName"); - LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); + gsl::span dataBuffer = pc.inputs().get>("inputConfig"); + std::string configFileName = pc.inputs().get("inputConfigFileName"); + LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); - if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { - handleDeadChannelMapUpdate(pc, dataTime, dataBuffer); - } else if (mFeeConfigurationReader.matchFilename(configFileName)) { - FddFeeConfiguration feeConfiguration = mFeeConfigurationReader.parseFeeConfiguration(dataBuffer); - o2::ccdb::CcdbObjectInfo objectInfo = mFeeConfigCcdbInfo.createObjectInfo(feeConfiguration, dataTime, {}); - sendObject(pc.outputs(), feeConfiguration, objectInfo, getFeeConfigDescription()); - } else if (mHvConfigurationReader.matchFilename(configFileName)) { - FddHvConfiguration hvConfig = mHvConfigurationReader.parseHvConfiguration(dataBuffer); - o2::ccdb::CcdbObjectInfo objectInfo = mHvConfigCcdbInfo.createObjectInfo(hvConfig, dataTime, {}); - sendObject(pc.outputs(), hvConfig, objectInfo, getHvConfigDescription()); - } else { - LOG(error) << "Unknown input file: " << configFileName; + if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { + handleDeadChannelMapUpdate(pc, dataTime, dataBuffer); + } else if (mFeeConfigurationReader.matchFilename(configFileName)) { + FddFeeConfiguration feeConfiguration = mFeeConfigurationReader.parseFeeConfiguration(dataBuffer); + o2::ccdb::CcdbObjectInfo objectInfo = mFeeConfigCcdbInfo.createObjectInfo(feeConfiguration, dataTime, {}); + sendObject(pc.outputs(), feeConfiguration, objectInfo, getFeeConfigDescription()); + } else if (mHvConfigurationReader.matchFilename(configFileName)) { + FddHvConfiguration hvConfig = mHvConfigurationReader.parseHvConfiguration(dataBuffer); + o2::ccdb::CcdbObjectInfo objectInfo = mHvConfigCcdbInfo.createObjectInfo(hvConfig, dataTime, {}); + sendObject(pc.outputs(), hvConfig, objectInfo, getHvConfigDescription()); + } else { + LOG(error) << "Unknown input file: " << configFileName; + } + } catch (std::exception& e) { + LOG(error) << "Exception: " << e.what(); } } diff --git a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx index a88abeabba772..9f440c9bfaeb7 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx +++ b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx @@ -19,8 +19,6 @@ void FT0DCSConfigProcessor::run(o2::framework::ProcessingContext& pc) gsl::span dataBuffer = pc.inputs().get>("inputConfig"); std::string configFileName = pc.inputs().get("inputConfigFileName"); LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); - LOG(info) << "FEE filename: " << mFeeConfigurationReader.getFilename(); - LOG(info) << "HV filename: " << mHvConfigurationReader.getFilename(); if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { handleDeadChannelMapUpdate(pc, dataTime, dataBuffer); } else if (mFeeConfigurationReader.matchFilename(configFileName)) { diff --git a/Detectors/FIT/FV0/dcsmonitoring/src/FV0DCSConfigProcessor.cxx b/Detectors/FIT/FV0/dcsmonitoring/src/FV0DCSConfigProcessor.cxx index 9bf5f979a1669..07568e6e85b8c 100644 --- a/Detectors/FIT/FV0/dcsmonitoring/src/FV0DCSConfigProcessor.cxx +++ b/Detectors/FIT/FV0/dcsmonitoring/src/FV0DCSConfigProcessor.cxx @@ -14,24 +14,28 @@ void FV0DCSConfigProcessor::init(o2::framework::InitContext& ic) void FV0DCSConfigProcessor::run(o2::framework::ProcessingContext& pc) { - long dataTime = getValidityTime(pc); + try { + long dataTime = getValidityTime(pc); - gsl::span dataBuffer = pc.inputs().get>("inputConfig"); - std::string configFileName = pc.inputs().get("inputConfigFileName"); - LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); + gsl::span dataBuffer = pc.inputs().get>("inputConfig"); + std::string configFileName = pc.inputs().get("inputConfigFileName"); + LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size(); - if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { - handleDeadChannelMapUpdate(pc, dataTime, dataBuffer); - } else if (mFeeConfigurationReader.matchFilename(configFileName)) { - Fv0FeeConfiguration feeConfiguration = mFeeConfigurationReader.parseFeeConfiguration(dataBuffer); - o2::ccdb::CcdbObjectInfo objectInfo = mFeeConfigCcdbInfo.createObjectInfo(feeConfiguration, dataTime, {}); - sendObject(pc.outputs(), feeConfiguration, objectInfo, getFeeConfigDescription()); - } else if (mHvConfigurationReader.matchFilename(configFileName)) { - Fv0HvConfiguration hvConfig = mHvConfigurationReader.parseHvConfiguration(dataBuffer); - o2::ccdb::CcdbObjectInfo objectInfo = mHvConfigCcdbInfo.createObjectInfo(hvConfig, dataTime, {}); - sendObject(pc.outputs(), hvConfig, objectInfo, getHvConfigDescription()); - } else { - LOG(error) << "Unknown input file: " << configFileName; + if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) { + handleDeadChannelMapUpdate(pc, dataTime, dataBuffer); + } else if (mFeeConfigurationReader.matchFilename(configFileName)) { + Fv0FeeConfiguration feeConfiguration = mFeeConfigurationReader.parseFeeConfiguration(dataBuffer); + o2::ccdb::CcdbObjectInfo objectInfo = mFeeConfigCcdbInfo.createObjectInfo(feeConfiguration, dataTime, {}); + sendObject(pc.outputs(), feeConfiguration, objectInfo, getFeeConfigDescription()); + } else if (mHvConfigurationReader.matchFilename(configFileName)) { + Fv0HvConfiguration hvConfig = mHvConfigurationReader.parseHvConfiguration(dataBuffer); + o2::ccdb::CcdbObjectInfo objectInfo = mHvConfigCcdbInfo.createObjectInfo(hvConfig, dataTime, {}); + sendObject(pc.outputs(), hvConfig, objectInfo, getHvConfigDescription()); + } else { + LOG(error) << "Unknown input file: " << configFileName; + } + } catch (std::exception& e) { + LOG(error) << "Exception: " << e.what(); } } From 2d2eb2d8caaf0c75a1b52e19b21f7d92b0148d55 Mon Sep 17 00:00:00 2001 From: Wiktor Pierozak Date: Wed, 12 Aug 2026 16:14:27 +0200 Subject: [PATCH 23/28] Created scripts to fetch FEE configuration --- .../dcsmonitoring/macros/fetchFddFeeConfig.C | 136 ++++++++++++++++++ .../src/FDDFEEConfigurationReader.cxx | 24 ++++ .../macros/fetchFt0FeeConfig.C | 11 +- .../src/FT0FEEConfigurationReader.cxx | 24 ++++ .../dcsmonitoring/macros/fetchFv0FeeConfig.C | 122 ++++++++++++++++ .../src/FV0FEEConfigurationReader.cxx | 16 +++ 6 files changed, 332 insertions(+), 1 deletion(-) create mode 100644 Detectors/FIT/FDD/dcsmonitoring/macros/fetchFddFeeConfig.C rename Detectors/FIT/FT0/{ => dcsmonitoring}/macros/fetchFt0FeeConfig.C (85%) create mode 100644 Detectors/FIT/FV0/dcsmonitoring/macros/fetchFv0FeeConfig.C diff --git a/Detectors/FIT/FDD/dcsmonitoring/macros/fetchFddFeeConfig.C b/Detectors/FIT/FDD/dcsmonitoring/macros/fetchFddFeeConfig.C new file mode 100644 index 0000000000000..06661dfb61c85 --- /dev/null +++ b/Detectors/FIT/FDD/dcsmonitoring/macros/fetchFddFeeConfig.C @@ -0,0 +1,136 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#if !defined(__CLING__) || defined(__ROOTCLING__) + +#include "CCDB/CcdbApi.h" +#include "DataFormatsFDD/FeeConfiguration.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#endif + +void fetchFddFeeConfig(const std::string ccdbUrl = "http://alice-ccdb.cern.ch", long timestamp = -1, const std::string fileName = "fdd-fee-config.json", const std::string ccdbPath = "FDD/Config/FeeConfiguration") +{ + o2::ccdb::CcdbApi ccdbApi; + ccdbApi.init(ccdbUrl); + + std::map metadata; + std::unique_ptr config(ccdbApi.retrieveFromTFileAny(ccdbPath, metadata, timestamp)); + + if (!config) { + throw std::runtime_error("Cannot retrieve FddFeeConfiguration from CCDB path " + ccdbPath); + } + + rapidjson::Document doc; + doc.SetObject(); + auto& allocator = doc.GetAllocator(); + + rapidjson::Value channels(rapidjson::kObjectType); + rapidjson::Value timeAligments(rapidjson::kArrayType); + rapidjson::Value cfdThresholds(rapidjson::kArrayType); + rapidjson::Value cfdZeros(rapidjson::kArrayType); + rapidjson::Value adcZeros(rapidjson::kArrayType); + rapidjson::Value adcDelays(rapidjson::kArrayType); + rapidjson::Value rangeCorrectionAdc0(rapidjson::kArrayType); + rapidjson::Value rangeCorrectionAdc1(rapidjson::kArrayType); + rapidjson::Value channelMaskData(rapidjson::kArrayType); + rapidjson::Value channelMaskTriggers(rapidjson::kArrayType); + + for (int i = 0; i < o2::fdd::FddFeeConfiguration::NChannels; ++i) { + timeAligments.PushBack(config->channels.timeAligments[i], allocator); + cfdThresholds.PushBack(config->channels.cfdThresholds[i], allocator); + cfdZeros.PushBack(config->channels.cfdZeros[i], allocator); + adcZeros.PushBack(config->channels.adcZeros[i], allocator); + adcDelays.PushBack(config->channels.adcDelays[i], allocator); + rangeCorrectionAdc0.PushBack(config->channels.rangeCorrectionAdc0[i], allocator); + rangeCorrectionAdc1.PushBack(config->channels.rangeCorrectionAdc1[i], allocator); + channelMaskData.PushBack(config->channels.channelMaskData[i], allocator); + channelMaskTriggers.PushBack(config->channels.channelMaskTriggers[i], allocator); + } + + channels.AddMember("time_aligments", timeAligments, allocator); + channels.AddMember("cfd_thresholds", cfdThresholds, allocator); + channels.AddMember("cfd_zeros", cfdZeros, allocator); + channels.AddMember("adc_zeros", adcZeros, allocator); + channels.AddMember("adc_delays", adcDelays, allocator); + channels.AddMember("range_correction_adc0", rangeCorrectionAdc0, allocator); + channels.AddMember("range_correction_adc1", rangeCorrectionAdc1, allocator); + channels.AddMember("channel_mask_data", channelMaskData, allocator); + channels.AddMember("channel_mask_triggers", channelMaskTriggers, allocator); + doc.AddMember("channels", channels, allocator); + + rapidjson::Value tcm(rapidjson::kObjectType); + tcm.AddMember("phase_delay_a", config->tcm.phaseDelayA, allocator); + tcm.AddMember("phase_delay_c", config->tcm.phaseDelayC, allocator); + doc.AddMember("tcm", tcm, allocator); + + rapidjson::Value pmA(rapidjson::kArrayType); + + for (int i = 0; i < 10; ++i) { + rapidjson::Value pm(rapidjson::kObjectType); + pm.AddMember("or_gate", config->pmA[i].orGate, allocator); + pm.AddMember("trg_charge_low_level", config->pmA[i].trgChargeLowLevel, allocator); + pm.AddMember("trg_charge_high_level", config->pmA[i].trgChargeHighLevel, allocator); + pmA.PushBack(pm, allocator); + } + doc.AddMember("pm_a", pmA, allocator); + + rapidjson::Value pmC(rapidjson::kArrayType); + for (int i = 0; i < 10; ++i) { + rapidjson::Value pm(rapidjson::kObjectType); + pm.AddMember("or_gate", config->pmC[i].orGate, allocator); + pm.AddMember("trg_charge_low_level", config->pmC[i].trgChargeLowLevel, allocator); + pm.AddMember("trg_charge_high_level", config->pmC[i].trgChargeHighLevel, allocator); + pmC.PushBack(pm, allocator); + } + doc.AddMember("pm_c", pmC, allocator); + + rapidjson::Value triggers(rapidjson::kObjectType); + triggers.AddMember("vertex_time_low_threshold", config->triggers.vertexTimeLowThreshold, allocator); + + triggers.AddMember("vertex_time_high_threshold", config->triggers.vertexTimeHighThreshold, allocator); + triggers.AddMember("semicentral_a", config->triggers.semicentralA, allocator); + triggers.AddMember("semicentral_c", config->triggers.semicentralC, allocator); + triggers.AddMember("central_a", config->triggers.centralA, allocator); + triggers.AddMember("central_c", config->triggers.centralC, allocator); + doc.AddMember("triggers", triggers, allocator); + + rapidjson::StringBuffer buffer; + rapidjson::PrettyWriter writer(buffer); + + doc.Accept(writer); + + if (fileName.empty()) { + std::cout << buffer.GetString() << '\n'; + return; + } + + std::ofstream output(fileName); + + if (!output) { + throw std::runtime_error( + "Cannot open output file " + fileName); + } + + output << buffer.GetString() << '\n'; + + std::cout << "FT0 FEE configuration written to " << fileName << '\n'; +} diff --git a/Detectors/FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx b/Detectors/FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx index cd4f6badfc592..131448aabd2a4 100644 --- a/Detectors/FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx +++ b/Detectors/FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx @@ -12,11 +12,35 @@ FddFeeConfiguration FDDFEEConfigurationReader::parseFeeConfiguration(gsl::spanchannels.cfdZeros[i], allocator); adcZeros.PushBack(config->channels.adcZeros[i], allocator); adcDelays.PushBack(config->channels.adcDelays[i], allocator); + rangeCorrectionAdc0.PushBack(config->channels.rangeCorrectionAdc0[i], allocator); + rangeCorrectionAdc1.PushBack(config->channels.rangeCorrectionAdc1[i], allocator); channelMaskData.PushBack(config->channels.channelMaskData[i], allocator); channelMaskTriggers.PushBack(config->channels.channelMaskTriggers[i], allocator); } @@ -67,6 +71,8 @@ void fetchFt0FeeConfig(const std::string ccdbUrl = "http://alice-ccdb.cern.ch", channels.AddMember("cfd_zeros", cfdZeros, allocator); channels.AddMember("adc_zeros", adcZeros, allocator); channels.AddMember("adc_delays", adcDelays, allocator); + channels.AddMember("range_correction_adc0", rangeCorrectionAdc0, allocator); + channels.AddMember("range_correction_adc1", rangeCorrectionAdc1, allocator); channels.AddMember("channel_mask_data", channelMaskData, allocator); channels.AddMember("channel_mask_triggers", channelMaskTriggers, allocator); doc.AddMember("channels", channels, allocator); @@ -80,8 +86,9 @@ void fetchFt0FeeConfig(const std::string ccdbUrl = "http://alice-ccdb.cern.ch", for (int i = 0; i < 10; ++i) { rapidjson::Value pm(rapidjson::kObjectType); - pm.AddMember("or_gate", config->pmA[i].orGate, allocator); + pm.AddMember("trg_charge_low_level", config->pmA[i].trgChargeLowLevel, allocator); + pm.AddMember("trg_charge_high_level", config->pmA[i].trgChargeHighLevel, allocator); pmA.PushBack(pm, allocator); } doc.AddMember("pm_a", pmA, allocator); @@ -90,6 +97,8 @@ void fetchFt0FeeConfig(const std::string ccdbUrl = "http://alice-ccdb.cern.ch", for (int i = 0; i < 10; ++i) { rapidjson::Value pm(rapidjson::kObjectType); pm.AddMember("or_gate", config->pmC[i].orGate, allocator); + pm.AddMember("trg_charge_low_level", config->pmC[i].trgChargeLowLevel, allocator); + pm.AddMember("trg_charge_high_level", config->pmC[i].trgChargeHighLevel, allocator); pmC.PushBack(pm, allocator); } doc.AddMember("pm_c", pmC, allocator); diff --git a/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx b/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx index fada569f96c8c..37ae4fce6dd61 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx +++ b/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx @@ -12,11 +12,35 @@ Ft0FeeConfiguration FT0FEEConfigurationReader::parseFeeConfiguration(gsl::span +#include +#include + +#include +#include +#include +#include +#include +#include + +#endif + +void fetchFv0FeeConfig(const std::string ccdbUrl = "http://alice-ccdb.cern.ch", long timestamp = -1, const std::string fileName = "fv0-fee-config.json", const std::string ccdbPath = "FV0/Config/FeeConfiguration") +{ + o2::ccdb::CcdbApi ccdbApi; + ccdbApi.init(ccdbUrl); + + std::map metadata; + std::unique_ptr config(ccdbApi.retrieveFromTFileAny(ccdbPath, metadata, timestamp)); + + if (!config) { + throw std::runtime_error("Cannot retrieve Fv0FeeConfiguration from CCDB path " + ccdbPath); + } + + rapidjson::Document doc; + doc.SetObject(); + auto& allocator = doc.GetAllocator(); + + rapidjson::Value channels(rapidjson::kObjectType); + rapidjson::Value timeAligments(rapidjson::kArrayType); + rapidjson::Value cfdThresholds(rapidjson::kArrayType); + rapidjson::Value cfdZeros(rapidjson::kArrayType); + rapidjson::Value adcZeros(rapidjson::kArrayType); + rapidjson::Value adcDelays(rapidjson::kArrayType); + rapidjson::Value rangeCorrectionAdc0(rapidjson::kArrayType); + rapidjson::Value rangeCorrectionAdc1(rapidjson::kArrayType); + rapidjson::Value channelMaskData(rapidjson::kArrayType); + rapidjson::Value channelMaskTriggers(rapidjson::kArrayType); + + for (int i = 0; i < o2::fv0::Fv0FeeConfiguration::NChannels; ++i) { + timeAligments.PushBack(config->channels.timeAligments[i], allocator); + cfdThresholds.PushBack(config->channels.cfdThresholds[i], allocator); + cfdZeros.PushBack(config->channels.cfdZeros[i], allocator); + adcZeros.PushBack(config->channels.adcZeros[i], allocator); + adcDelays.PushBack(config->channels.adcDelays[i], allocator); + rangeCorrectionAdc0.PushBack(config->channels.rangeCorrectionAdc0[i], allocator); + rangeCorrectionAdc1.PushBack(config->channels.rangeCorrectionAdc1[i], allocator); + channelMaskData.PushBack(config->channels.channelMaskData[i], allocator); + channelMaskTriggers.PushBack(config->channels.channelMaskTriggers[i], allocator); + } + + channels.AddMember("time_aligments", timeAligments, allocator); + channels.AddMember("cfd_thresholds", cfdThresholds, allocator); + channels.AddMember("cfd_zeros", cfdZeros, allocator); + channels.AddMember("adc_zeros", adcZeros, allocator); + channels.AddMember("adc_delays", adcDelays, allocator); + channels.AddMember("range_correction_adc0", rangeCorrectionAdc0, allocator); + channels.AddMember("range_correction_adc1", rangeCorrectionAdc1, allocator); + channels.AddMember("channel_mask_data", channelMaskData, allocator); + channels.AddMember("channel_mask_triggers", channelMaskTriggers, allocator); + doc.AddMember("channels", channels, allocator); + + rapidjson::Value tcm(rapidjson::kObjectType); + tcm.AddMember("phase_delay_a", config->tcm.phaseDelayA, allocator); + tcm.AddMember("phase_delay_c", config->tcm.phaseDelayC, allocator); + doc.AddMember("tcm", tcm, allocator); + + rapidjson::Value pmA(rapidjson::kArrayType); + + for (int i = 0; i < 10; ++i) { + rapidjson::Value pm(rapidjson::kObjectType); + pm.AddMember("or_gate", config->pmA[i].orGate, allocator); + pm.AddMember("trg_charge_low_level", config->pmA[i].trgChargeLowLevel, allocator); + pm.AddMember("trg_charge_high_level", config->pmA[i].trgChargeHighLevel, allocator); + pmA.PushBack(pm, allocator); + } + doc.AddMember("pm_a", pmA, allocator); + + rapidjson::Value triggers(rapidjson::kObjectType); + triggers.AddMember("n_channels_level", config->triggers.nChannels, allocator); + triggers.AddMember("inner_rings_level", config->triggers.innerRings, allocator); + triggers.AddMember("charge_level", config->triggers.charge, allocator); + triggers.AddMember("outer_rings_level", config->triggers.outerRings, allocator); + doc.AddMember("triggers", triggers, allocator); + + rapidjson::StringBuffer buffer; + rapidjson::PrettyWriter writer(buffer); + + doc.Accept(writer); + + if (fileName.empty()) { + std::cout << buffer.GetString() << '\n'; + return; + } + + std::ofstream output(fileName); + + if (!output) { + throw std::runtime_error( + "Cannot open output file " + fileName); + } + + output << buffer.GetString() << '\n'; + std::cout << "FV0 FEE configuration written to " << fileName << '\n'; +} diff --git a/Detectors/FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx b/Detectors/FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx index 947fbd75f57d3..f079b51ed0eb3 100644 --- a/Detectors/FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx +++ b/Detectors/FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx @@ -10,9 +10,25 @@ Fv0FeeConfiguration FV0FEEConfigurationReader::parseFeeConfiguration(gsl::span Date: Mon, 31 Aug 2026 08:24:35 +0200 Subject: [PATCH 24/28] Changed configuration filenames, renamed FITDCSConfigProcessorSpec.h to FITDCSConfigProcessor, added back DeadChannelMap definition in link file' --- .../FDDDCSMonitoring/FDDDCSConfigProcessor.h | 2 +- .../dcsmonitoring/macros/fdd-fee-config.json | 282 +++ .../workflow/FDDDCSConfigProcessorSpec.h | 4 +- .../FT0DCSMonitoring/FT0DCSConfigProcessor.h | 2 +- .../dcsmonitoring/macros/ft0-fee-config.json | 2010 +++++++++++++++++ .../workflow/FT0DCSConfigProcessorSpec.h | 4 +- .../FV0DCSMonitoring/FV0DCSConfigProcessor.h | 2 +- .../dcsmonitoring/macros/fv0-fee-config.json | 516 +++++ .../workflow/FV0DCSConfigProcessorSpec.h | 4 +- ...rocessorSpec.h => FITDCSConfigProcessor.h} | 0 .../src/FITDCSMonitoringLinkDef.h | 2 +- 11 files changed, 2818 insertions(+), 10 deletions(-) create mode 100644 Detectors/FIT/FDD/dcsmonitoring/macros/fdd-fee-config.json create mode 100644 Detectors/FIT/FT0/dcsmonitoring/macros/ft0-fee-config.json create mode 100644 Detectors/FIT/FV0/dcsmonitoring/macros/fv0-fee-config.json rename Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/{FITDCSConfigProcessorSpec.h => FITDCSConfigProcessor.h} (100%) diff --git a/Detectors/FIT/FDD/dcsmonitoring/include/FDDDCSMonitoring/FDDDCSConfigProcessor.h b/Detectors/FIT/FDD/dcsmonitoring/include/FDDDCSMonitoring/FDDDCSConfigProcessor.h index 82885a42f80e7..451725cb14bbd 100644 --- a/Detectors/FIT/FDD/dcsmonitoring/include/FDDDCSMonitoring/FDDDCSConfigProcessor.h +++ b/Detectors/FIT/FDD/dcsmonitoring/include/FDDDCSMonitoring/FDDDCSConfigProcessor.h @@ -14,7 +14,7 @@ #ifndef O2_FDD_DCS_CONFIG_PROCESSOR_H #define O2_FDD_DCS_CONFIG_PROCESSOR_H -#include "FITDCSMonitoring/FITDCSConfigProcessorSpec.h" +#include "FITDCSMonitoring/FITDCSConfigProcessor.h" #include "FDDDCSMonitoring/FDDFEEConfigurationReader.h" #include "FITDCSMonitoring/FITHvConfigurationReader.h" diff --git a/Detectors/FIT/FDD/dcsmonitoring/macros/fdd-fee-config.json b/Detectors/FIT/FDD/dcsmonitoring/macros/fdd-fee-config.json new file mode 100644 index 0000000000000..d6b434ce03b7e --- /dev/null +++ b/Detectors/FIT/FDD/dcsmonitoring/macros/fdd-fee-config.json @@ -0,0 +1,282 @@ +{ + "channels": { + "time_aligments": [ + -625, + -624, + -623, + -622, + -621, + -620, + -619, + -618, + -617, + -616, + -615, + -614, + -613, + -612, + -611, + -610 + ], + "cfd_thresholds": [ + 27498, + 27499, + 27500, + 27501, + 27502, + 27503, + 27504, + 27505, + 27506, + 27507, + 27508, + 27509, + 27510, + 27511, + 27512, + 27513 + ], + "cfd_zeros": [ + -374, + -373, + -372, + -371, + -370, + -369, + -368, + -367, + -366, + -365, + -364, + -363, + -362, + -361, + -360, + -359 + ], + "adc_zeros": [ + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74 + ], + "adc_delays": [ + 11582, + 11583, + 11584, + 11585, + 11586, + 11587, + 11588, + 11589, + 11590, + 11591, + 11592, + 11593, + 11594, + 11595, + 11596, + 11597 + ], + "range_correction_adc0": [ + 700, + 701, + 702, + 703, + 704, + 705, + 706, + 707, + 708, + 709, + 710, + 711, + 712, + 713, + 714, + 715 + ], + "range_correction_adc1": [ + 1903, + 1904, + 1905, + 1906, + 1907, + 1908, + 1909, + 1910, + 1911, + 1912, + 1913, + 1914, + 1915, + 1916, + 1917, + 1918 + ], + "channel_mask_data": [ + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true + ], + "channel_mask_triggers": [ + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false + ] + }, + "tcm": { + "phase_delay_a": 620.0599975585938, + "phase_delay_c": 621.0599975585938 + }, + "pm_a": [ + { + "or_gate": 74, + "trg_charge_low_level": 16547, + "trg_charge_high_level": 17563 + }, + { + "or_gate": 75, + "trg_charge_low_level": 16548, + "trg_charge_high_level": 17564 + }, + { + "or_gate": 76, + "trg_charge_low_level": 16549, + "trg_charge_high_level": 17565 + }, + { + "or_gate": 77, + "trg_charge_low_level": 16550, + "trg_charge_high_level": 17566 + }, + { + "or_gate": 78, + "trg_charge_low_level": 16551, + "trg_charge_high_level": 17567 + }, + { + "or_gate": 79, + "trg_charge_low_level": 16552, + "trg_charge_high_level": 17568 + }, + { + "or_gate": 80, + "trg_charge_low_level": 16553, + "trg_charge_high_level": 17569 + }, + { + "or_gate": 81, + "trg_charge_low_level": 16554, + "trg_charge_high_level": 17570 + }, + { + "or_gate": 82, + "trg_charge_low_level": 16555, + "trg_charge_high_level": 17571 + }, + { + "or_gate": 83, + "trg_charge_low_level": 16556, + "trg_charge_high_level": 17572 + } + ], + "pm_c": [ + { + "or_gate": 221, + "trg_charge_low_level": 26573, + "trg_charge_high_level": 4663 + }, + { + "or_gate": 222, + "trg_charge_low_level": 26574, + "trg_charge_high_level": 4664 + }, + { + "or_gate": 223, + "trg_charge_low_level": 26575, + "trg_charge_high_level": 4665 + }, + { + "or_gate": 224, + "trg_charge_low_level": 26576, + "trg_charge_high_level": 4666 + }, + { + "or_gate": 225, + "trg_charge_low_level": 26577, + "trg_charge_high_level": 4667 + }, + { + "or_gate": 226, + "trg_charge_low_level": 26578, + "trg_charge_high_level": 4668 + }, + { + "or_gate": 227, + "trg_charge_low_level": 26579, + "trg_charge_high_level": 4669 + }, + { + "or_gate": 228, + "trg_charge_low_level": 26580, + "trg_charge_high_level": 4670 + }, + { + "or_gate": 229, + "trg_charge_low_level": 26581, + "trg_charge_high_level": 4671 + }, + { + "or_gate": 230, + "trg_charge_low_level": 26582, + "trg_charge_high_level": 4672 + } + ], + "triggers": { + "vertex_time_low_threshold": -396.0, + "vertex_time_high_threshold": -395.0, + "semicentral_a": 0, + "semicentral_c": 0, + "central_a": 927, + "central_c": 928 + } +} diff --git a/Detectors/FIT/FDD/dcsmonitoring/workflow/FDDDCSConfigProcessorSpec.h b/Detectors/FIT/FDD/dcsmonitoring/workflow/FDDDCSConfigProcessorSpec.h index 76ebb6eeffcfc..0b23e729415fc 100644 --- a/Detectors/FIT/FDD/dcsmonitoring/workflow/FDDDCSConfigProcessorSpec.h +++ b/Detectors/FIT/FDD/dcsmonitoring/workflow/FDDDCSConfigProcessorSpec.h @@ -55,9 +55,9 @@ DataProcessorSpec getFDDDCSConfigProcessorSpec() {"filename-dchm", VariantType::String, "FDD-deadchannels.txt", {"Dead channel map file name"}}, {"valid-days-dchm", VariantType::UInt32, 180u, {"Dead channel map validity in days"}}, {"no-validate", VariantType::Bool, false, {"Don't validate the CCDB uploads"}}, - {"filename-fee-config", VariantType::String, "ft0-fee-config.json", {"FEE configuration file name"}}, + {"filename-fee-config", VariantType::String, "FDD-fee-config.json", {"FEE configuration file name"}}, {"valid-days-fee-config", VariantType::UInt32, 180u, {"FEE configuration validity in days"}}, - {"filename-hv-config", VariantType::String, "ft0-hv-config.json", {"HV configuration file name"}}, + {"filename-hv-config", VariantType::String, "FDD-hv-config.json", {"HV configuration file name"}}, {"valid-days-hv-config", VariantType::UInt32, 180u, {"HV configuration validity in days"}}}}; } diff --git a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigProcessor.h b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigProcessor.h index d89d811a520de..0deb06f6d65bc 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigProcessor.h +++ b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigProcessor.h @@ -1,7 +1,7 @@ #ifndef O2_FT0_DCSCONFIGPROCESSOR_H #define O2_FT0_DCSCONFIGPROCESSOR_H -#include "FITDCSMonitoring/FITDCSConfigProcessorSpec.h" +#include "FITDCSMonitoring/FITDCSConfigProcessor.h" #include "FT0DCSMonitoring/FT0FEEConfigurationReader.h" #include "FITDCSMonitoring/FITHvConfigurationReader.h" #include "DetectorsCalibration/Utils.h" diff --git a/Detectors/FIT/FT0/dcsmonitoring/macros/ft0-fee-config.json b/Detectors/FIT/FT0/dcsmonitoring/macros/ft0-fee-config.json new file mode 100644 index 0000000000000..155c1edafdb8a --- /dev/null +++ b/Detectors/FIT/FT0/dcsmonitoring/macros/ft0-fee-config.json @@ -0,0 +1,2010 @@ +{ + "channels": { + "time_aligments": [ + 355, + 356, + 357, + 358, + 359, + 360, + 361, + 362, + 363, + 364, + 365, + 366, + 367, + 368, + 369, + 370, + 371, + 372, + 373, + 374, + 375, + 376, + 377, + 378, + 379, + 380, + 381, + 382, + 383, + 384, + 385, + 386, + 387, + 388, + 389, + 390, + 391, + 392, + 393, + 394, + 395, + 396, + 397, + 398, + 399, + 400, + 401, + 402, + 403, + 404, + 405, + 406, + 407, + 408, + 409, + 410, + 411, + 412, + 413, + 414, + 415, + 416, + 417, + 418, + 419, + 420, + 421, + 422, + 423, + 424, + 425, + 426, + 427, + 428, + 429, + 430, + 431, + 432, + 433, + 434, + 435, + 436, + 437, + 438, + 439, + 440, + 441, + 442, + 443, + 444, + 445, + 446, + 447, + 448, + 449, + 450, + 451, + 452, + 453, + 454, + 455, + 456, + 457, + 458, + 459, + 460, + 461, + 462, + 463, + 464, + 465, + 466, + 467, + 468, + 469, + 470, + 471, + 472, + 473, + 474, + 475, + 476, + 477, + 478, + 479, + 480, + 481, + 482, + 483, + 484, + 485, + 486, + 487, + 488, + 489, + 490, + 491, + 492, + 493, + 494, + 495, + 496, + 497, + 498, + 499, + 500, + 501, + 502, + 503, + 504, + 505, + 506, + 507, + 508, + 509, + 510, + 511, + 512, + 513, + 514, + 515, + 516, + 517, + 518, + 519, + 520, + 521, + 522, + 523, + 524, + 525, + 526, + 527, + 528, + 529, + 530, + 531, + 532, + 533, + 534, + 535, + 536, + 537, + 538, + 539, + 540, + 541, + 542, + 543, + 544, + 545, + 546, + 547, + 548, + 549, + 550, + 551, + 552, + 553, + 554, + 555, + 556, + 557, + 558, + 559, + 560, + 561, + 562 + ], + "cfd_thresholds": [ + 11616, + 11617, + 11618, + 11619, + 11620, + 11621, + 11622, + 11623, + 11624, + 11625, + 11626, + 11627, + 11628, + 11629, + 11630, + 11631, + 11632, + 11633, + 11634, + 11635, + 11636, + 11637, + 11638, + 11639, + 11640, + 11641, + 11642, + 11643, + 11644, + 11645, + 11646, + 11647, + 11648, + 11649, + 11650, + 11651, + 11652, + 11653, + 11654, + 11655, + 11656, + 11657, + 11658, + 11659, + 11660, + 11661, + 11662, + 11663, + 11664, + 11665, + 11666, + 11667, + 11668, + 11669, + 11670, + 11671, + 11672, + 11673, + 11674, + 11675, + 11676, + 11677, + 11678, + 11679, + 11680, + 11681, + 11682, + 11683, + 11684, + 11685, + 11686, + 11687, + 11688, + 11689, + 11690, + 11691, + 11692, + 11693, + 11694, + 11695, + 11696, + 11697, + 11698, + 11699, + 11700, + 11701, + 11702, + 11703, + 11704, + 11705, + 11706, + 11707, + 11708, + 11709, + 11710, + 11711, + 11712, + 11713, + 11714, + 11715, + 11716, + 11717, + 11718, + 11719, + 11720, + 11721, + 11722, + 11723, + 11724, + 11725, + 11726, + 11727, + 11728, + 11729, + 11730, + 11731, + 11732, + 11733, + 11734, + 11735, + 11736, + 11737, + 11738, + 11739, + 11740, + 11741, + 11742, + 11743, + 11744, + 11745, + 11746, + 11747, + 11748, + 11749, + 11750, + 11751, + 11752, + 11753, + 11754, + 11755, + 11756, + 11757, + 11758, + 11759, + 11760, + 11761, + 11762, + 11763, + 11764, + 11765, + 11766, + 11767, + 11768, + 11769, + 11770, + 11771, + 11772, + 11773, + 11774, + 11775, + 11776, + 11777, + 11778, + 11779, + 11780, + 11781, + 11782, + 11783, + 11784, + 11785, + 11786, + 11787, + 11788, + 11789, + 11790, + 11791, + 11792, + 11793, + 11794, + 11795, + 11796, + 11797, + 11798, + 11799, + 11800, + 11801, + 11802, + 11803, + 11804, + 11805, + 11806, + 11807, + 11808, + 11809, + 11810, + 11811, + 11812, + 11813, + 11814, + 11815, + 11816, + 11817, + 11818, + 11819, + 11820, + 11821, + 11822, + 11823 + ], + "cfd_zeros": [ + -77, + -76, + -75, + -74, + -73, + -72, + -71, + -70, + -69, + -68, + -67, + -66, + -65, + -64, + -63, + -62, + -61, + -60, + -59, + -58, + -57, + -56, + -55, + -54, + -53, + -52, + -51, + -50, + -49, + -48, + -47, + -46, + -45, + -44, + -43, + -42, + -41, + -40, + -39, + -38, + -37, + -36, + -35, + -34, + -33, + -32, + -31, + -30, + -29, + -28, + -27, + -26, + -25, + -24, + -23, + -22, + -21, + -20, + -19, + -18, + -17, + -16, + -15, + -14, + -13, + -12, + -11, + -10, + -9, + -8, + -7, + -6, + -5, + -4, + -3, + -2, + -1, + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97, + 98, + 99, + 100, + 101, + 102, + 103, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 112, + 113, + 114, + 115, + 116, + 117, + 118, + 119, + 120, + 121, + 122, + 123, + 124, + 125, + 126, + 127, + 128, + 129, + 130 + ], + "adc_zeros": [ + 274, + 275, + 276, + 277, + 278, + 279, + 280, + 281, + 282, + 283, + 284, + 285, + 286, + 287, + 288, + 289, + 290, + 291, + 292, + 293, + 294, + 295, + 296, + 297, + 298, + 299, + 300, + 301, + 302, + 303, + 304, + 305, + 306, + 307, + 308, + 309, + 310, + 311, + 312, + 313, + 314, + 315, + 316, + 317, + 318, + 319, + 320, + 321, + 322, + 323, + 324, + 325, + 326, + 327, + 328, + 329, + 330, + 331, + 332, + 333, + 334, + 335, + 336, + 337, + 338, + 339, + 340, + 341, + 342, + 343, + 344, + 345, + 346, + 347, + 348, + 349, + 350, + 351, + 352, + 353, + 354, + 355, + 356, + 357, + 358, + 359, + 360, + 361, + 362, + 363, + 364, + 365, + 366, + 367, + 368, + 369, + 370, + 371, + 372, + 373, + 374, + 375, + 376, + 377, + 378, + 379, + 380, + 381, + 382, + 383, + 384, + 385, + 386, + 387, + 388, + 389, + 390, + 391, + 392, + 393, + 394, + 395, + 396, + 397, + 398, + 399, + 400, + 401, + 402, + 403, + 404, + 405, + 406, + 407, + 408, + 409, + 410, + 411, + 412, + 413, + 414, + 415, + 416, + 417, + 418, + 419, + 420, + 421, + 422, + 423, + 424, + 425, + 426, + 427, + 428, + 429, + 430, + 431, + 432, + 433, + 434, + 435, + 436, + 437, + 438, + 439, + 440, + 441, + 442, + 443, + 444, + 445, + 446, + 447, + 448, + 449, + 450, + 451, + 452, + 453, + 454, + 455, + 456, + 457, + 458, + 459, + 460, + 461, + 462, + 463, + 464, + 465, + 466, + 467, + 468, + 469, + 470, + 471, + 472, + 473, + 474, + 475, + 476, + 477, + 478, + 479, + 480, + 481 + ], + "adc_delays": [ + 469, + 470, + 471, + 472, + 473, + 474, + 475, + 476, + 477, + 478, + 479, + 480, + 481, + 482, + 483, + 484, + 485, + 486, + 487, + 488, + 489, + 490, + 491, + 492, + 493, + 494, + 495, + 496, + 497, + 498, + 499, + 500, + 501, + 502, + 503, + 504, + 505, + 506, + 507, + 508, + 509, + 510, + 511, + 512, + 513, + 514, + 515, + 516, + 517, + 518, + 519, + 520, + 521, + 522, + 523, + 524, + 525, + 526, + 527, + 528, + 529, + 530, + 531, + 532, + 533, + 534, + 535, + 536, + 537, + 538, + 539, + 540, + 541, + 542, + 543, + 544, + 545, + 546, + 547, + 548, + 549, + 550, + 551, + 552, + 553, + 554, + 555, + 556, + 557, + 558, + 559, + 560, + 561, + 562, + 563, + 564, + 565, + 566, + 567, + 568, + 569, + 570, + 571, + 572, + 573, + 574, + 575, + 576, + 577, + 578, + 579, + 580, + 581, + 582, + 583, + 584, + 585, + 586, + 587, + 588, + 589, + 590, + 591, + 592, + 593, + 594, + 595, + 596, + 597, + 598, + 599, + 600, + 601, + 602, + 603, + 604, + 605, + 606, + 607, + 608, + 609, + 610, + 611, + 612, + 613, + 614, + 615, + 616, + 617, + 618, + 619, + 620, + 621, + 622, + 623, + 624, + 625, + 626, + 627, + 628, + 629, + 630, + 631, + 632, + 633, + 634, + 635, + 636, + 637, + 638, + 639, + 640, + 641, + 642, + 643, + 644, + 645, + 646, + 647, + 648, + 649, + 650, + 651, + 652, + 653, + 654, + 655, + 656, + 657, + 658, + 659, + 660, + 661, + 662, + 663, + 664, + 665, + 666, + 667, + 668, + 669, + 670, + 671, + 672, + 673, + 674, + 675, + 676 + ], + "range_correction_adc0": [ + 173, + 174, + 175, + 176, + 177, + 178, + 179, + 180, + 181, + 182, + 183, + 184, + 185, + 186, + 187, + 188, + 189, + 190, + 191, + 192, + 193, + 194, + 195, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 210, + 211, + 212, + 213, + 214, + 215, + 216, + 217, + 218, + 219, + 220, + 221, + 222, + 223, + 224, + 225, + 226, + 227, + 228, + 229, + 230, + 231, + 232, + 233, + 234, + 235, + 236, + 237, + 238, + 239, + 240, + 241, + 242, + 243, + 244, + 245, + 246, + 247, + 248, + 249, + 250, + 251, + 252, + 253, + 254, + 255, + 256, + 257, + 258, + 259, + 260, + 261, + 262, + 263, + 264, + 265, + 266, + 267, + 268, + 269, + 270, + 271, + 272, + 273, + 274, + 275, + 276, + 277, + 278, + 279, + 280, + 281, + 282, + 283, + 284, + 285, + 286, + 287, + 288, + 289, + 290, + 291, + 292, + 293, + 294, + 295, + 296, + 297, + 298, + 299, + 300, + 301, + 302, + 303, + 304, + 305, + 306, + 307, + 308, + 309, + 310, + 311, + 312, + 313, + 314, + 315, + 316, + 317, + 318, + 319, + 320, + 321, + 322, + 323, + 324, + 325, + 326, + 327, + 328, + 329, + 330, + 331, + 332, + 333, + 334, + 335, + 336, + 337, + 338, + 339, + 340, + 341, + 342, + 343, + 344, + 345, + 346, + 347, + 348, + 349, + 350, + 351, + 352, + 353, + 354, + 355, + 356, + 357, + 358, + 359, + 360, + 361, + 362, + 363, + 364, + 365, + 366, + 367, + 368, + 369, + 370, + 371, + 372, + 373, + 374, + 375, + 376, + 377, + 378, + 379, + 380 + ], + "range_correction_adc1": [ + 99, + 100, + 101, + 102, + 103, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 112, + 113, + 114, + 115, + 116, + 117, + 118, + 119, + 120, + 121, + 122, + 123, + 124, + 125, + 126, + 127, + 128, + 129, + 130, + 131, + 132, + 133, + 134, + 135, + 136, + 137, + 138, + 139, + 140, + 141, + 142, + 143, + 144, + 145, + 146, + 147, + 148, + 149, + 150, + 151, + 152, + 153, + 154, + 155, + 156, + 157, + 158, + 159, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 174, + 175, + 176, + 177, + 178, + 179, + 180, + 181, + 182, + 183, + 184, + 185, + 186, + 187, + 188, + 189, + 190, + 191, + 192, + 193, + 194, + 195, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 210, + 211, + 212, + 213, + 214, + 215, + 216, + 217, + 218, + 219, + 220, + 221, + 222, + 223, + 224, + 225, + 226, + 227, + 228, + 229, + 230, + 231, + 232, + 233, + 234, + 235, + 236, + 237, + 238, + 239, + 240, + 241, + 242, + 243, + 244, + 245, + 246, + 247, + 248, + 249, + 250, + 251, + 252, + 253, + 254, + 255, + 256, + 257, + 258, + 259, + 260, + 261, + 262, + 263, + 264, + 265, + 266, + 267, + 268, + 269, + 270, + 271, + 272, + 273, + 274, + 275, + 276, + 277, + 278, + 279, + 280, + 281, + 282, + 283, + 284, + 285, + 286, + 287, + 288, + 289, + 290, + 291, + 292, + 293, + 294, + 295, + 296, + 297, + 298, + 299, + 300, + 301, + 302, + 303, + 304, + 305, + 306 + ], + "channel_mask_data": [ + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true + ], + "channel_mask_triggers": [ + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false + ] + }, + "tcm": { + "phase_delay_a": 38.388999938964847, + "phase_delay_c": 39.388999938964847 + }, + "pm_a": [ + { + "or_gate": 128, + "trg_charge_low_level": 51863, + "trg_charge_high_level": 51520 + }, + { + "or_gate": 129, + "trg_charge_low_level": 51864, + "trg_charge_high_level": 51521 + }, + { + "or_gate": 130, + "trg_charge_low_level": 51865, + "trg_charge_high_level": 51522 + }, + { + "or_gate": 131, + "trg_charge_low_level": 51866, + "trg_charge_high_level": 51523 + }, + { + "or_gate": 132, + "trg_charge_low_level": 51867, + "trg_charge_high_level": 51524 + }, + { + "or_gate": 133, + "trg_charge_low_level": 51868, + "trg_charge_high_level": 51525 + }, + { + "or_gate": 134, + "trg_charge_low_level": 51869, + "trg_charge_high_level": 51526 + }, + { + "or_gate": 135, + "trg_charge_low_level": 51870, + "trg_charge_high_level": 51527 + }, + { + "or_gate": 136, + "trg_charge_low_level": 51871, + "trg_charge_high_level": 51528 + }, + { + "or_gate": 137, + "trg_charge_low_level": 51872, + "trg_charge_high_level": 51529 + } + ], + "pm_c": [ + { + "or_gate": 31, + "trg_charge_low_level": 48923, + "trg_charge_high_level": 62771 + }, + { + "or_gate": 32, + "trg_charge_low_level": 48924, + "trg_charge_high_level": 62772 + }, + { + "or_gate": 33, + "trg_charge_low_level": 48925, + "trg_charge_high_level": 62773 + }, + { + "or_gate": 34, + "trg_charge_low_level": 48926, + "trg_charge_high_level": 62774 + }, + { + "or_gate": 35, + "trg_charge_low_level": 48927, + "trg_charge_high_level": 62775 + }, + { + "or_gate": 36, + "trg_charge_low_level": 48928, + "trg_charge_high_level": 62776 + }, + { + "or_gate": 37, + "trg_charge_low_level": 48929, + "trg_charge_high_level": 62777 + }, + { + "or_gate": 38, + "trg_charge_low_level": 48930, + "trg_charge_high_level": 62778 + }, + { + "or_gate": 39, + "trg_charge_low_level": 48931, + "trg_charge_high_level": 62779 + }, + { + "or_gate": 40, + "trg_charge_low_level": 48932, + "trg_charge_high_level": 62780 + } + ], + "triggers": { + "vertex_time_low_threshold": -1, + "vertex_time_high_threshold": 0, + "semicentral_a": 0, + "semicentral_c": 0, + "central_a": 44611, + "central_c": 44612 + } +} diff --git a/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h b/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h index 2da3ec9aa366b..0b880b2d32b84 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h +++ b/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h @@ -52,9 +52,9 @@ DataProcessorSpec getFT0DCSConfigProcessorSpec() {"filename-dchm", VariantType::String, "FT0-deadchannels.txt", {"Dead channel map file name"}}, {"valid-days-dchm", VariantType::UInt32, 180u, {"Dead channel map validity in days"}}, {"no-validate", VariantType::Bool, false, {"Don't validate the CCDB uploads"}}, - {"filename-fee-config", VariantType::String, "ft0-fee-config.json", {"FEE configuration file name"}}, + {"filename-fee-config", VariantType::String, "FT0-fee-config.json", {"FEE configuration file name"}}, {"valid-days-fee-config", VariantType::UInt32, 180u, {"FEE configuration validity in days"}}, - {"filename-hv-config", VariantType::String, "ft0-hv-config.json", {"HV configuration file name"}}, + {"filename-hv-config", VariantType::String, "FT0-hv-config.json", {"HV configuration file name"}}, {"valid-days-hv-config", VariantType::UInt32, 180u, {"HV configuration validity in days"}} } }; diff --git a/Detectors/FIT/FV0/dcsmonitoring/include/FV0DCSMonitoring/FV0DCSConfigProcessor.h b/Detectors/FIT/FV0/dcsmonitoring/include/FV0DCSMonitoring/FV0DCSConfigProcessor.h index 0f0f25e562f7f..e69190e327ce1 100644 --- a/Detectors/FIT/FV0/dcsmonitoring/include/FV0DCSMonitoring/FV0DCSConfigProcessor.h +++ b/Detectors/FIT/FV0/dcsmonitoring/include/FV0DCSMonitoring/FV0DCSConfigProcessor.h @@ -13,7 +13,7 @@ #ifndef O2_FV0_DCS_CONFIG_PROCESSOR_H #define O2_FV0_DCS_CONFIG_PROCESSOR_H -#include "FITDCSMonitoring/FITDCSConfigProcessorSpec.h" +#include "FITDCSMonitoring/FITDCSConfigProcessor.h" #include "FV0DCSMonitoring/FV0FEEConfigurationReader.h" #include "FITDCSMonitoring/FITHvConfigurationReader.h" diff --git a/Detectors/FIT/FV0/dcsmonitoring/macros/fv0-fee-config.json b/Detectors/FIT/FV0/dcsmonitoring/macros/fv0-fee-config.json new file mode 100644 index 0000000000000..f04a9e55494e0 --- /dev/null +++ b/Detectors/FIT/FV0/dcsmonitoring/macros/fv0-fee-config.json @@ -0,0 +1,516 @@ +{ + "channels": { + "time_aligments": [ + 726, + 727, + 728, + 729, + 730, + 731, + 732, + 733, + 734, + 735, + 736, + 737, + 738, + 739, + 740, + 741, + 742, + 743, + 744, + 745, + 746, + 747, + 748, + 749, + 750, + 751, + 752, + 753, + 754, + 755, + 756, + 757, + 758, + 759, + 760, + 761, + 762, + 763, + 764, + 765, + 766, + 767, + 768, + 769, + 770, + 771, + 772, + 773 + ], + "cfd_thresholds": [ + 25958, + 25959, + 25960, + 25961, + 25962, + 25963, + 25964, + 25965, + 25966, + 25967, + 25968, + 25969, + 25970, + 25971, + 25972, + 25973, + 25974, + 25975, + 25976, + 25977, + 25978, + 25979, + 25980, + 25981, + 25982, + 25983, + 25984, + 25985, + 25986, + 25987, + 25988, + 25989, + 25990, + 25991, + 25992, + 25993, + 25994, + 25995, + 25996, + 25997, + 25998, + 25999, + 26000, + 26001, + 26002, + 26003, + 26004, + 26005 + ], + "cfd_zeros": [ + -103, + -102, + -101, + -100, + -99, + -98, + -97, + -96, + -95, + -94, + -93, + -92, + -91, + -90, + -89, + -88, + -87, + -86, + -85, + -84, + -83, + -82, + -81, + -80, + -79, + -78, + -77, + -76, + -75, + -74, + -73, + -72, + -71, + -70, + -69, + -68, + -67, + -66, + -65, + -64, + -63, + -62, + -61, + -60, + -59, + -58, + -57, + -56 + ], + "adc_zeros": [ + -387, + -386, + -385, + -384, + -383, + -382, + -381, + -380, + -379, + -378, + -377, + -376, + -375, + -374, + -373, + -372, + -371, + -370, + -369, + -368, + -367, + -366, + -365, + -364, + -363, + -362, + -361, + -360, + -359, + -358, + -357, + -356, + -355, + -354, + -353, + -352, + -351, + -350, + -349, + -348, + -347, + -346, + -345, + -344, + -343, + -342, + -341, + -340 + ], + "adc_delays": [ + 3266, + 3267, + 3268, + 3269, + 3270, + 3271, + 3272, + 3273, + 3274, + 3275, + 3276, + 3277, + 3278, + 3279, + 3280, + 3281, + 3282, + 3283, + 3284, + 3285, + 3286, + 3287, + 3288, + 3289, + 3290, + 3291, + 3292, + 3293, + 3294, + 3295, + 3296, + 3297, + 3298, + 3299, + 3300, + 3301, + 3302, + 3303, + 3304, + 3305, + 3306, + 3307, + 3308, + 3309, + 3310, + 3311, + 3312, + 3313 + ], + "range_correction_adc0": [ + 1656, + 1657, + 1658, + 1659, + 1660, + 1661, + 1662, + 1663, + 1664, + 1665, + 1666, + 1667, + 1668, + 1669, + 1670, + 1671, + 1672, + 1673, + 1674, + 1675, + 1676, + 1677, + 1678, + 1679, + 1680, + 1681, + 1682, + 1683, + 1684, + 1685, + 1686, + 1687, + 1688, + 1689, + 1690, + 1691, + 1692, + 1693, + 1694, + 1695, + 1696, + 1697, + 1698, + 1699, + 1700, + 1701, + 1702, + 1703 + ], + "range_correction_adc1": [ + 1625, + 1626, + 1627, + 1628, + 1629, + 1630, + 1631, + 1632, + 1633, + 1634, + 1635, + 1636, + 1637, + 1638, + 1639, + 1640, + 1641, + 1642, + 1643, + 1644, + 1645, + 1646, + 1647, + 1648, + 1649, + 1650, + 1651, + 1652, + 1653, + 1654, + 1655, + 1656, + 1657, + 1658, + 1659, + 1660, + 1661, + 1662, + 1663, + 1664, + 1665, + 1666, + 1667, + 1668, + 1669, + 1670, + 1671, + 1672 + ], + "channel_mask_data": [ + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false + ], + "channel_mask_triggers": [ + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false, + true, + false + ] + }, + "tcm": { + "phase_delay_a": 201.51600646972657, + "phase_delay_c": 202.51600646972657 + }, + "pm_a": [ + { + "or_gate": 33, + "trg_charge_low_level": 30653, + "trg_charge_high_level": 50544 + }, + { + "or_gate": 34, + "trg_charge_low_level": 30654, + "trg_charge_high_level": 50545 + }, + { + "or_gate": 35, + "trg_charge_low_level": 30655, + "trg_charge_high_level": 50546 + }, + { + "or_gate": 36, + "trg_charge_low_level": 30656, + "trg_charge_high_level": 50547 + }, + { + "or_gate": 37, + "trg_charge_low_level": 30657, + "trg_charge_high_level": 50548 + }, + { + "or_gate": 38, + "trg_charge_low_level": 30658, + "trg_charge_high_level": 50549 + }, + { + "or_gate": 39, + "trg_charge_low_level": 30659, + "trg_charge_high_level": 50550 + }, + { + "or_gate": 40, + "trg_charge_low_level": 30660, + "trg_charge_high_level": 50551 + }, + { + "or_gate": 41, + "trg_charge_low_level": 30661, + "trg_charge_high_level": 50552 + }, + { + "or_gate": 42, + "trg_charge_low_level": 30662, + "trg_charge_high_level": 50553 + } + ], + "triggers": { + "n_channels_level": 16384, + "inner_rings_level": 770, + "charge_level": 1, + "outer_rings_level": 726 + } +} diff --git a/Detectors/FIT/FV0/dcsmonitoring/workflow/FV0DCSConfigProcessorSpec.h b/Detectors/FIT/FV0/dcsmonitoring/workflow/FV0DCSConfigProcessorSpec.h index 133987800cf36..c178c7c1e8d64 100644 --- a/Detectors/FIT/FV0/dcsmonitoring/workflow/FV0DCSConfigProcessorSpec.h +++ b/Detectors/FIT/FV0/dcsmonitoring/workflow/FV0DCSConfigProcessorSpec.h @@ -55,9 +55,9 @@ DataProcessorSpec getFV0DCSConfigProcessorSpec() {"filename-dchm", VariantType::String, "FV0-deadchannels.txt", {"Dead channel map file name"}}, {"valid-days-dchm", VariantType::UInt32, 180u, {"Dead channel map validity in days"}}, {"no-validate", VariantType::Bool, false, {"Don't validate the CCDB uploads"}}, - {"filename-fee-config", VariantType::String, "ft0-fee-config.json", {"FEE configuration file name"}}, + {"filename-fee-config", VariantType::String, "FV0-fee-config.json", {"FEE configuration file name"}}, {"valid-days-fee-config", VariantType::UInt32, 180u, {"FEE configuration validity in days"}}, - {"filename-hv-config", VariantType::String, "ft0-hv-config.json", {"HV configuration file name"}}, + {"filename-hv-config", VariantType::String, "FV0-hv-config.json", {"HV configuration file name"}}, {"valid-days-hv-config", VariantType::UInt32, 180u, {"HV configuration validity in days"}}}}; } diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessor.h similarity index 100% rename from Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessorSpec.h rename to Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITDCSConfigProcessor.h diff --git a/Detectors/FIT/common/dcsmonitoring/src/FITDCSMonitoringLinkDef.h b/Detectors/FIT/common/dcsmonitoring/src/FITDCSMonitoringLinkDef.h index 8658965baede6..24d0a9ccc6a6c 100644 --- a/Detectors/FIT/common/dcsmonitoring/src/FITDCSMonitoringLinkDef.h +++ b/Detectors/FIT/common/dcsmonitoring/src/FITDCSMonitoringLinkDef.h @@ -16,7 +16,7 @@ #pragma link off all functions; #pragma link C++ std::unordered_map < uint8_t, bool> + ; +#pragma link C++ struct o2::fit::DeadChannelMap + ; // TODO AM: Move this to DataFormatsFIT when unused class warning is solved. #pragma link C++ class std::unordered_map < o2::dcs::DataPointIdentifier, o2::fit::DCSDPValues> + ; - #endif From 5ce8687edcfa33d5e4b18e46420b698431e1f3cd Mon Sep 17 00:00:00 2001 From: Wiktor Pierozak Date: Fri, 2 Oct 2026 11:46:11 +0200 Subject: [PATCH 25/28] Added side_combination_mode to configuration structure --- .../FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h | 1 + .../FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h | 2 +- .../FIT/FV0/include/DataFormatsFV0/FeeConfiguration.h | 1 + DataFormats/Detectors/FIT/common/CMakeLists.txt | 3 ++- .../Detectors/FIT/common/src/DataFormatsFITLinkDef.h | 1 + Detectors/FIT/FDD/dcsmonitoring/macros/CMakeLists.txt | 6 ++++++ .../FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx | 6 ++++++ Detectors/FIT/FT0/dcsmonitoring/macros/CMakeLists.txt | 6 ++++++ Detectors/FIT/FT0/dcsmonitoring/macros/fetchFt0FeeConfig.C | 1 + .../FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx | 6 ++++++ Detectors/FIT/FT0/macros/CMakeLists.txt | 6 ------ Detectors/FIT/FV0/dcsmonitoring/macros/CMakeLists.txt | 6 ++++++ .../FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx | 6 ++++++ Detectors/FIT/common/dcsmonitoring/CMakeLists.txt | 2 +- ...DCSConfigProcessorSpec.cxx => FITDCSConfigProcessor.cxx} | 2 +- .../FIT/common/dcsmonitoring/src/FITDCSMonitoringLinkDef.h | 1 - 16 files changed, 45 insertions(+), 11 deletions(-) rename Detectors/FIT/common/dcsmonitoring/src/{FITDCSConfigProcessorSpec.cxx => FITDCSConfigProcessor.cxx} (98%) diff --git a/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h b/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h index 959df0933662c..f9b365eea6114 100644 --- a/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h +++ b/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/FeeConfiguration.h @@ -23,6 +23,7 @@ struct TriggersConfig { uint16_t semicentralC{o2::fit::config_helpers::DefaultValue}; uint16_t centralA{o2::fit::config_helpers::DefaultValue}; uint16_t centralC{o2::fit::config_helpers::DefaultValue}; + uint8_t sidesCombinationMode{o2::fit::config_helpers::DefaultValue}; ClassDefNV(TriggersConfig, 1); }; diff --git a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h index e03c060c5772a..2d5f9a656c255 100644 --- a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h +++ b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/FeeConfiguration.h @@ -25,7 +25,7 @@ struct TriggersConfig { uint16_t semicentralC{o2::fit::config_helpers::DefaultValue}; uint16_t centralA{o2::fit::config_helpers::DefaultValue}; uint16_t centralC{o2::fit::config_helpers::DefaultValue}; - + uint8_t sidesCombinationMode{o2::fit::config_helpers::DefaultValue}; ClassDefNV(TriggersConfig, 1); }; diff --git a/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/FeeConfiguration.h b/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/FeeConfiguration.h index aca1bdbf75255..17646acbbfe79 100644 --- a/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/FeeConfiguration.h +++ b/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/FeeConfiguration.h @@ -21,6 +21,7 @@ struct TriggersConfig { uint16_t innerRings{o2::fit::config_helpers::DefaultValue}; uint16_t charge{o2::fit::config_helpers::DefaultValue}; uint16_t outerRings{o2::fit::config_helpers::DefaultValue}; + uint8_t sidesCombinationMode{o2::fit::config_helpers::DefaultValue}; ClassDefNV(TriggersConfig, 1); }; diff --git a/DataFormats/Detectors/FIT/common/CMakeLists.txt b/DataFormats/Detectors/FIT/common/CMakeLists.txt index 5d41438cecf7d..4bdd9a1e00fa5 100644 --- a/DataFormats/Detectors/FIT/common/CMakeLists.txt +++ b/DataFormats/Detectors/FIT/common/CMakeLists.txt @@ -24,4 +24,5 @@ o2_target_root_dictionary(DataFormatsFIT include/DataFormatsFIT/Triggers.h include/DataFormatsFIT/ChannelData.h include/DataFormatsFIT/Digit.h - include/DataFormatsFIT/Configuration.h) + include/DataFormatsFIT/Configuration.h + include/DataFormatsFIT/DeadChannelMap.h) diff --git a/DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h b/DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h index 671841523961a..d017599cb8998 100644 --- a/DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h +++ b/DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h @@ -28,6 +28,7 @@ #pragma link C++ struct o2::fit::TcmConfig + ; #pragma link C++ struct o2::fit::PmConfig + ; +#pragma link C++ struct o2::fit::DeadChannelMap + ; /* #include "DetectorsCommonDataFormats/DetID.h" #pragma link C++ struct o2::fit::ChannelData + ; diff --git a/Detectors/FIT/FDD/dcsmonitoring/macros/CMakeLists.txt b/Detectors/FIT/FDD/dcsmonitoring/macros/CMakeLists.txt index 63571c1001d3f..1fc63e6c61d01 100644 --- a/Detectors/FIT/FDD/dcsmonitoring/macros/CMakeLists.txt +++ b/Detectors/FIT/FDD/dcsmonitoring/macros/CMakeLists.txt @@ -13,3 +13,9 @@ o2_add_test_root_macro(makeFDDCCDBEntryForDCS.C PUBLIC_LINK_LIBRARIES O2::CCDB O2::DetectorsDCS LABELS fdd) + +o2_add_test_root_macro(fetchFddFeeConfig.C + PUBLIC_LINK_LIBRARIES + O2::CCDB + O2::DataFormatsFDD + LABELS fdd) \ No newline at end of file diff --git a/Detectors/FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx b/Detectors/FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx index 131448aabd2a4..a3755d0f0ba86 100644 --- a/Detectors/FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx +++ b/Detectors/FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx @@ -43,11 +43,17 @@ void FDDFEEConfigurationReader::parseTriggers(const rapidjson::Value& root, cons } const auto& centralCNode = triggersNode["central_c"]; + if(triggersNode.HasMember("sides_combination_mode") == false) { + throw std::runtime_error("Missing sides_combination_mode node!"); + } + const auto& sidesCombinationMode = triggersNode["sides_combination_mode"]; + config.vertexTimeLowThreshold = vertexTimeLowThresholdNode.GetInt(); config.vertexTimeHighThreshold = vertexTimeHighThresholdNode.GetInt(); config.semicentralA = semicentralANode.GetUint(); config.semicentralC = semicentralCNode.GetUint(); config.centralA = centralANode.GetUint(); config.centralC = centralCNode.GetUint(); + config.sidesCombinationMode = sidesCombinationMode.GetUint(); } } // namespace o2::fdd \ No newline at end of file diff --git a/Detectors/FIT/FT0/dcsmonitoring/macros/CMakeLists.txt b/Detectors/FIT/FT0/dcsmonitoring/macros/CMakeLists.txt index 9d4391d8f4084..3ee7472fcb04d 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/macros/CMakeLists.txt +++ b/Detectors/FIT/FT0/dcsmonitoring/macros/CMakeLists.txt @@ -13,3 +13,9 @@ o2_add_test_root_macro(makeFT0CCDBEntryForDCS.C PUBLIC_LINK_LIBRARIES O2::CCDB O2::DetectorsDCS LABELS ft0) + +o2_add_test_root_macro(fetchFt0FeeConfig.C + PUBLIC_LINK_LIBRARIES + O2::CCDB + O2::DataFormatsFT0 + LABELS ft0) \ No newline at end of file diff --git a/Detectors/FIT/FT0/dcsmonitoring/macros/fetchFt0FeeConfig.C b/Detectors/FIT/FT0/dcsmonitoring/macros/fetchFt0FeeConfig.C index 0752cdf1c8664..4aa5cf7003c05 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/macros/fetchFt0FeeConfig.C +++ b/Detectors/FIT/FT0/dcsmonitoring/macros/fetchFt0FeeConfig.C @@ -111,6 +111,7 @@ void fetchFt0FeeConfig(const std::string ccdbUrl = "http://alice-ccdb.cern.ch", triggers.AddMember("semicentral_c", config->triggers.semicentralC, allocator); triggers.AddMember("central_a", config->triggers.centralA, allocator); triggers.AddMember("central_c", config->triggers.centralC, allocator); + triggers.AddMember("sides_combination_mode", config->triggers.sidesCombinationMode, allocator); doc.AddMember("triggers", triggers, allocator); rapidjson::StringBuffer buffer; diff --git a/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx b/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx index 37ae4fce6dd61..25e0f20171e52 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx +++ b/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx @@ -43,11 +43,17 @@ void FT0FEEConfigurationReader::parseTriggers(const rapidjson::Value& root, cons } const auto& centralCNode = triggersNode["central_c"]; + if(triggersNode.HasMember("sides_combination_mode") == false) { + throw std::runtime_error("Missing sides_combination_mode node!"); + } + const auto& sidesCombinationMode = triggersNode["sides_combination_mode"]; + config.vertexTimeLowThreshold = vertexTimeLowThresholdNode.GetInt(); config.vertexTimeHighThreshold = vertexTimeHighThresholdNode.GetInt(); config.semicentralA = semicentralANode.GetUint(); config.semicentralC = semicentralCNode.GetUint(); config.centralA = centralANode.GetUint(); config.centralC = centralCNode.GetUint(); + config.sidesCombinationMode = sidesCombinationMode.GetUint(); } } // namespace o2::ft0 \ No newline at end of file diff --git a/Detectors/FIT/FT0/macros/CMakeLists.txt b/Detectors/FIT/FT0/macros/CMakeLists.txt index 6e7b33ab87798..27c5891e864f2 100644 --- a/Detectors/FIT/FT0/macros/CMakeLists.txt +++ b/Detectors/FIT/FT0/macros/CMakeLists.txt @@ -15,12 +15,6 @@ o2_add_test_root_macro(FT0Misaligner.C LABELS ft0) o2_add_test_root_macro(FT0readEventsPerBc.C - PUBLIC_LINK_LIBRARIES - O2::CCDB - O2::DataFormatsFT0 - LABELS ft0) - -o2_add_test_root_macro(fetchFt0FeeConfig.C PUBLIC_LINK_LIBRARIES O2::CCDB O2::DataFormatsFT0 diff --git a/Detectors/FIT/FV0/dcsmonitoring/macros/CMakeLists.txt b/Detectors/FIT/FV0/dcsmonitoring/macros/CMakeLists.txt index 446f01dde8ffe..bfa2ed0e72b8d 100644 --- a/Detectors/FIT/FV0/dcsmonitoring/macros/CMakeLists.txt +++ b/Detectors/FIT/FV0/dcsmonitoring/macros/CMakeLists.txt @@ -13,3 +13,9 @@ o2_add_test_root_macro(makeFV0CCDBEntryForDCS.C PUBLIC_LINK_LIBRARIES O2::CCDB O2::DetectorsDCS LABELS fv0) + +o2_add_test_root_macro(fetchFv0FeeConfig.C + PUBLIC_LINK_LIBRARIES + O2::CCDB + O2::DataFormatsFV0 + LABELS fv0) \ No newline at end of file diff --git a/Detectors/FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx b/Detectors/FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx index f079b51ed0eb3..a5d800ef5e5f0 100644 --- a/Detectors/FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx +++ b/Detectors/FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx @@ -31,9 +31,15 @@ void FV0FEEConfigurationReader::parseTriggers(const rapidjson::Value& root, cons } const auto& outerRingsLevelNode = triggersNode["outer_rings_level"]; + if(triggersNode.HasMember("sides_combination_mode") == false) { + throw std::runtime_error("Missing sides_combination_mode node!"); + } + const auto& sidesCombinationMode = triggersNode["sides_combination_mode"]; + config.innerRings = innerRingsLevelNode.GetInt(); config.nChannels = nChannelsLevelNode.GetInt(); config.charge = chargeLevelNode.GetInt(); config.outerRings = chargeLevelNode.GetInt(); + config.sidesCombinationMode = sidesCombinationMode.GetUint(); } } // namespace o2::fv0 \ No newline at end of file diff --git a/Detectors/FIT/common/dcsmonitoring/CMakeLists.txt b/Detectors/FIT/common/dcsmonitoring/CMakeLists.txt index bd49845f5d8d1..248c52a810b30 100644 --- a/Detectors/FIT/common/dcsmonitoring/CMakeLists.txt +++ b/Detectors/FIT/common/dcsmonitoring/CMakeLists.txt @@ -13,7 +13,7 @@ o2_add_library(FITDCSMonitoring SOURCES src/FITDCSDataProcessor.cxx src/FITDCSDataReader.cxx src/FITDeadChannelMapReader.cxx - src/FITDCSConfigProcessorSpec.cxx + src/FITDCSConfigProcessor.cxx src/FITDCSBaseConfigReader.cxx PUBLIC_LINK_LIBRARIES O2::DataFormatsFIT O2::DetectorsCalibration diff --git a/Detectors/FIT/common/dcsmonitoring/src/FITDCSConfigProcessorSpec.cxx b/Detectors/FIT/common/dcsmonitoring/src/FITDCSConfigProcessor.cxx similarity index 98% rename from Detectors/FIT/common/dcsmonitoring/src/FITDCSConfigProcessorSpec.cxx rename to Detectors/FIT/common/dcsmonitoring/src/FITDCSConfigProcessor.cxx index 8a7ec7d0eb166..56ff479f99379 100644 --- a/Detectors/FIT/common/dcsmonitoring/src/FITDCSConfigProcessorSpec.cxx +++ b/Detectors/FIT/common/dcsmonitoring/src/FITDCSConfigProcessor.cxx @@ -1,4 +1,4 @@ -#include "FITDCSMonitoring/FITDCSConfigProcessorSpec.h" +#include "FITDCSMonitoring/FITDCSConfigProcessor.h" namespace o2::fit { diff --git a/Detectors/FIT/common/dcsmonitoring/src/FITDCSMonitoringLinkDef.h b/Detectors/FIT/common/dcsmonitoring/src/FITDCSMonitoringLinkDef.h index 24d0a9ccc6a6c..c6d473429cf86 100644 --- a/Detectors/FIT/common/dcsmonitoring/src/FITDCSMonitoringLinkDef.h +++ b/Detectors/FIT/common/dcsmonitoring/src/FITDCSMonitoringLinkDef.h @@ -16,7 +16,6 @@ #pragma link off all functions; #pragma link C++ std::unordered_map < uint8_t, bool> + ; -#pragma link C++ struct o2::fit::DeadChannelMap + ; // TODO AM: Move this to DataFormatsFIT when unused class warning is solved. #pragma link C++ class std::unordered_map < o2::dcs::DataPointIdentifier, o2::fit::DCSDPValues> + ; #endif From 34e7cabb434eec2c8d0836cb2c305e32cb483959 Mon Sep 17 00:00:00 2001 From: wpierozak Date: Fri, 2 Oct 2026 12:44:44 +0200 Subject: [PATCH 26/28] Added fdd coincidence mode and threshold calibration to FIT configuration object --- .../include/DataFormatsFIT/Configuration.h | 3 + .../dcsmonitoring/macros/fdd-fee-config.json | 282 --- .../dcsmonitoring/macros/fetchFddFeeConfig.C | 3 + .../dcsmonitoring/macros/fetchFt0FeeConfig.C | 3 + .../dcsmonitoring/macros/ft0-fee-config.json | 2010 ----------------- .../dcsmonitoring/macros/fetchFv0FeeConfig.C | 3 + .../dcsmonitoring/macros/fv0-fee-config.json | 516 ----- .../FITFEEConfigurationReader.h | 10 +- 8 files changed, 19 insertions(+), 2811 deletions(-) delete mode 100644 Detectors/FIT/FDD/dcsmonitoring/macros/fdd-fee-config.json delete mode 100644 Detectors/FIT/FT0/dcsmonitoring/macros/ft0-fee-config.json delete mode 100644 Detectors/FIT/FV0/dcsmonitoring/macros/fv0-fee-config.json diff --git a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h index 2b80b2e8500fa..72eae33c3d862 100644 --- a/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h +++ b/DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Configuration.h @@ -64,6 +64,7 @@ struct PmConfig { uint8_t orGate{config_helpers::DefaultValue}; uint16_t trgChargeHighLevel{config_helpers::DefaultValue}; uint16_t trgChargeLowLevel{config_helpers::DefaultValue}; + bool fddCoincidenceMode{config_helpers::DefaultValue}; bool operator==(const PmConfig&) const = default; ClassDefNV(PmConfig, 1); }; @@ -77,6 +78,7 @@ struct ChannelsConfig { uint16_t adcDelays[NChannels]; uint16_t rangeCorrectionAdc0[NChannels]; uint16_t rangeCorrectionAdc1[NChannels]; + uint16_t thresholdCalibration[NChannels]; bool channelMaskData[NChannels]; bool channelMaskTriggers[NChannels]; @@ -91,6 +93,7 @@ struct ChannelsConfig { config_helpers::fillDefaultArray(rangeCorrectionAdc1); config_helpers::fillDefaultArray(channelMaskData); config_helpers::fillDefaultArray(channelMaskTriggers); + config_helpers::fillDefaultArray(thresholdCalibration); } template diff --git a/Detectors/FIT/FDD/dcsmonitoring/macros/fdd-fee-config.json b/Detectors/FIT/FDD/dcsmonitoring/macros/fdd-fee-config.json deleted file mode 100644 index d6b434ce03b7e..0000000000000 --- a/Detectors/FIT/FDD/dcsmonitoring/macros/fdd-fee-config.json +++ /dev/null @@ -1,282 +0,0 @@ -{ - "channels": { - "time_aligments": [ - -625, - -624, - -623, - -622, - -621, - -620, - -619, - -618, - -617, - -616, - -615, - -614, - -613, - -612, - -611, - -610 - ], - "cfd_thresholds": [ - 27498, - 27499, - 27500, - 27501, - 27502, - 27503, - 27504, - 27505, - 27506, - 27507, - 27508, - 27509, - 27510, - 27511, - 27512, - 27513 - ], - "cfd_zeros": [ - -374, - -373, - -372, - -371, - -370, - -369, - -368, - -367, - -366, - -365, - -364, - -363, - -362, - -361, - -360, - -359 - ], - "adc_zeros": [ - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 71, - 72, - 73, - 74 - ], - "adc_delays": [ - 11582, - 11583, - 11584, - 11585, - 11586, - 11587, - 11588, - 11589, - 11590, - 11591, - 11592, - 11593, - 11594, - 11595, - 11596, - 11597 - ], - "range_correction_adc0": [ - 700, - 701, - 702, - 703, - 704, - 705, - 706, - 707, - 708, - 709, - 710, - 711, - 712, - 713, - 714, - 715 - ], - "range_correction_adc1": [ - 1903, - 1904, - 1905, - 1906, - 1907, - 1908, - 1909, - 1910, - 1911, - 1912, - 1913, - 1914, - 1915, - 1916, - 1917, - 1918 - ], - "channel_mask_data": [ - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true - ], - "channel_mask_triggers": [ - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false - ] - }, - "tcm": { - "phase_delay_a": 620.0599975585938, - "phase_delay_c": 621.0599975585938 - }, - "pm_a": [ - { - "or_gate": 74, - "trg_charge_low_level": 16547, - "trg_charge_high_level": 17563 - }, - { - "or_gate": 75, - "trg_charge_low_level": 16548, - "trg_charge_high_level": 17564 - }, - { - "or_gate": 76, - "trg_charge_low_level": 16549, - "trg_charge_high_level": 17565 - }, - { - "or_gate": 77, - "trg_charge_low_level": 16550, - "trg_charge_high_level": 17566 - }, - { - "or_gate": 78, - "trg_charge_low_level": 16551, - "trg_charge_high_level": 17567 - }, - { - "or_gate": 79, - "trg_charge_low_level": 16552, - "trg_charge_high_level": 17568 - }, - { - "or_gate": 80, - "trg_charge_low_level": 16553, - "trg_charge_high_level": 17569 - }, - { - "or_gate": 81, - "trg_charge_low_level": 16554, - "trg_charge_high_level": 17570 - }, - { - "or_gate": 82, - "trg_charge_low_level": 16555, - "trg_charge_high_level": 17571 - }, - { - "or_gate": 83, - "trg_charge_low_level": 16556, - "trg_charge_high_level": 17572 - } - ], - "pm_c": [ - { - "or_gate": 221, - "trg_charge_low_level": 26573, - "trg_charge_high_level": 4663 - }, - { - "or_gate": 222, - "trg_charge_low_level": 26574, - "trg_charge_high_level": 4664 - }, - { - "or_gate": 223, - "trg_charge_low_level": 26575, - "trg_charge_high_level": 4665 - }, - { - "or_gate": 224, - "trg_charge_low_level": 26576, - "trg_charge_high_level": 4666 - }, - { - "or_gate": 225, - "trg_charge_low_level": 26577, - "trg_charge_high_level": 4667 - }, - { - "or_gate": 226, - "trg_charge_low_level": 26578, - "trg_charge_high_level": 4668 - }, - { - "or_gate": 227, - "trg_charge_low_level": 26579, - "trg_charge_high_level": 4669 - }, - { - "or_gate": 228, - "trg_charge_low_level": 26580, - "trg_charge_high_level": 4670 - }, - { - "or_gate": 229, - "trg_charge_low_level": 26581, - "trg_charge_high_level": 4671 - }, - { - "or_gate": 230, - "trg_charge_low_level": 26582, - "trg_charge_high_level": 4672 - } - ], - "triggers": { - "vertex_time_low_threshold": -396.0, - "vertex_time_high_threshold": -395.0, - "semicentral_a": 0, - "semicentral_c": 0, - "central_a": 927, - "central_c": 928 - } -} diff --git a/Detectors/FIT/FDD/dcsmonitoring/macros/fetchFddFeeConfig.C b/Detectors/FIT/FDD/dcsmonitoring/macros/fetchFddFeeConfig.C index 06661dfb61c85..e205b7e5d56d4 100644 --- a/Detectors/FIT/FDD/dcsmonitoring/macros/fetchFddFeeConfig.C +++ b/Detectors/FIT/FDD/dcsmonitoring/macros/fetchFddFeeConfig.C @@ -53,6 +53,7 @@ void fetchFddFeeConfig(const std::string ccdbUrl = "http://alice-ccdb.cern.ch", rapidjson::Value rangeCorrectionAdc1(rapidjson::kArrayType); rapidjson::Value channelMaskData(rapidjson::kArrayType); rapidjson::Value channelMaskTriggers(rapidjson::kArrayType); + rapidjson::Value thresholdCalibration(rapidjson::kArrayType); for (int i = 0; i < o2::fdd::FddFeeConfiguration::NChannels; ++i) { timeAligments.PushBack(config->channels.timeAligments[i], allocator); @@ -64,6 +65,7 @@ void fetchFddFeeConfig(const std::string ccdbUrl = "http://alice-ccdb.cern.ch", rangeCorrectionAdc1.PushBack(config->channels.rangeCorrectionAdc1[i], allocator); channelMaskData.PushBack(config->channels.channelMaskData[i], allocator); channelMaskTriggers.PushBack(config->channels.channelMaskTriggers[i], allocator); + thresholdCalibration.PushBack(config->channels.thresholdCalibration[i], allocator); } channels.AddMember("time_aligments", timeAligments, allocator); @@ -75,6 +77,7 @@ void fetchFddFeeConfig(const std::string ccdbUrl = "http://alice-ccdb.cern.ch", channels.AddMember("range_correction_adc1", rangeCorrectionAdc1, allocator); channels.AddMember("channel_mask_data", channelMaskData, allocator); channels.AddMember("channel_mask_triggers", channelMaskTriggers, allocator); + channels.AddMember("threshold_calibration", thresholdCalibration, allocator); doc.AddMember("channels", channels, allocator); rapidjson::Value tcm(rapidjson::kObjectType); diff --git a/Detectors/FIT/FT0/dcsmonitoring/macros/fetchFt0FeeConfig.C b/Detectors/FIT/FT0/dcsmonitoring/macros/fetchFt0FeeConfig.C index 4aa5cf7003c05..8109dcb264d5c 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/macros/fetchFt0FeeConfig.C +++ b/Detectors/FIT/FT0/dcsmonitoring/macros/fetchFt0FeeConfig.C @@ -53,6 +53,7 @@ void fetchFt0FeeConfig(const std::string ccdbUrl = "http://alice-ccdb.cern.ch", rapidjson::Value rangeCorrectionAdc1(rapidjson::kArrayType); rapidjson::Value channelMaskData(rapidjson::kArrayType); rapidjson::Value channelMaskTriggers(rapidjson::kArrayType); + rapidjson::Value thresholdCalibration(rapidjson::kArrayType); for (int i = 0; i < o2::ft0::Ft0FeeConfiguration::NChannels; ++i) { timeAligments.PushBack(config->channels.timeAligments[i], allocator); @@ -64,6 +65,7 @@ void fetchFt0FeeConfig(const std::string ccdbUrl = "http://alice-ccdb.cern.ch", rangeCorrectionAdc1.PushBack(config->channels.rangeCorrectionAdc1[i], allocator); channelMaskData.PushBack(config->channels.channelMaskData[i], allocator); channelMaskTriggers.PushBack(config->channels.channelMaskTriggers[i], allocator); + thresholdCalibration.PushBack(config->channels.thresholdCalibration[i], allocator); } channels.AddMember("time_aligments", timeAligments, allocator); @@ -75,6 +77,7 @@ void fetchFt0FeeConfig(const std::string ccdbUrl = "http://alice-ccdb.cern.ch", channels.AddMember("range_correction_adc1", rangeCorrectionAdc1, allocator); channels.AddMember("channel_mask_data", channelMaskData, allocator); channels.AddMember("channel_mask_triggers", channelMaskTriggers, allocator); + channels.AddMember("threshold_calibration", thresholdCalibration, allocator); doc.AddMember("channels", channels, allocator); rapidjson::Value tcm(rapidjson::kObjectType); diff --git a/Detectors/FIT/FT0/dcsmonitoring/macros/ft0-fee-config.json b/Detectors/FIT/FT0/dcsmonitoring/macros/ft0-fee-config.json deleted file mode 100644 index 155c1edafdb8a..0000000000000 --- a/Detectors/FIT/FT0/dcsmonitoring/macros/ft0-fee-config.json +++ /dev/null @@ -1,2010 +0,0 @@ -{ - "channels": { - "time_aligments": [ - 355, - 356, - 357, - 358, - 359, - 360, - 361, - 362, - 363, - 364, - 365, - 366, - 367, - 368, - 369, - 370, - 371, - 372, - 373, - 374, - 375, - 376, - 377, - 378, - 379, - 380, - 381, - 382, - 383, - 384, - 385, - 386, - 387, - 388, - 389, - 390, - 391, - 392, - 393, - 394, - 395, - 396, - 397, - 398, - 399, - 400, - 401, - 402, - 403, - 404, - 405, - 406, - 407, - 408, - 409, - 410, - 411, - 412, - 413, - 414, - 415, - 416, - 417, - 418, - 419, - 420, - 421, - 422, - 423, - 424, - 425, - 426, - 427, - 428, - 429, - 430, - 431, - 432, - 433, - 434, - 435, - 436, - 437, - 438, - 439, - 440, - 441, - 442, - 443, - 444, - 445, - 446, - 447, - 448, - 449, - 450, - 451, - 452, - 453, - 454, - 455, - 456, - 457, - 458, - 459, - 460, - 461, - 462, - 463, - 464, - 465, - 466, - 467, - 468, - 469, - 470, - 471, - 472, - 473, - 474, - 475, - 476, - 477, - 478, - 479, - 480, - 481, - 482, - 483, - 484, - 485, - 486, - 487, - 488, - 489, - 490, - 491, - 492, - 493, - 494, - 495, - 496, - 497, - 498, - 499, - 500, - 501, - 502, - 503, - 504, - 505, - 506, - 507, - 508, - 509, - 510, - 511, - 512, - 513, - 514, - 515, - 516, - 517, - 518, - 519, - 520, - 521, - 522, - 523, - 524, - 525, - 526, - 527, - 528, - 529, - 530, - 531, - 532, - 533, - 534, - 535, - 536, - 537, - 538, - 539, - 540, - 541, - 542, - 543, - 544, - 545, - 546, - 547, - 548, - 549, - 550, - 551, - 552, - 553, - 554, - 555, - 556, - 557, - 558, - 559, - 560, - 561, - 562 - ], - "cfd_thresholds": [ - 11616, - 11617, - 11618, - 11619, - 11620, - 11621, - 11622, - 11623, - 11624, - 11625, - 11626, - 11627, - 11628, - 11629, - 11630, - 11631, - 11632, - 11633, - 11634, - 11635, - 11636, - 11637, - 11638, - 11639, - 11640, - 11641, - 11642, - 11643, - 11644, - 11645, - 11646, - 11647, - 11648, - 11649, - 11650, - 11651, - 11652, - 11653, - 11654, - 11655, - 11656, - 11657, - 11658, - 11659, - 11660, - 11661, - 11662, - 11663, - 11664, - 11665, - 11666, - 11667, - 11668, - 11669, - 11670, - 11671, - 11672, - 11673, - 11674, - 11675, - 11676, - 11677, - 11678, - 11679, - 11680, - 11681, - 11682, - 11683, - 11684, - 11685, - 11686, - 11687, - 11688, - 11689, - 11690, - 11691, - 11692, - 11693, - 11694, - 11695, - 11696, - 11697, - 11698, - 11699, - 11700, - 11701, - 11702, - 11703, - 11704, - 11705, - 11706, - 11707, - 11708, - 11709, - 11710, - 11711, - 11712, - 11713, - 11714, - 11715, - 11716, - 11717, - 11718, - 11719, - 11720, - 11721, - 11722, - 11723, - 11724, - 11725, - 11726, - 11727, - 11728, - 11729, - 11730, - 11731, - 11732, - 11733, - 11734, - 11735, - 11736, - 11737, - 11738, - 11739, - 11740, - 11741, - 11742, - 11743, - 11744, - 11745, - 11746, - 11747, - 11748, - 11749, - 11750, - 11751, - 11752, - 11753, - 11754, - 11755, - 11756, - 11757, - 11758, - 11759, - 11760, - 11761, - 11762, - 11763, - 11764, - 11765, - 11766, - 11767, - 11768, - 11769, - 11770, - 11771, - 11772, - 11773, - 11774, - 11775, - 11776, - 11777, - 11778, - 11779, - 11780, - 11781, - 11782, - 11783, - 11784, - 11785, - 11786, - 11787, - 11788, - 11789, - 11790, - 11791, - 11792, - 11793, - 11794, - 11795, - 11796, - 11797, - 11798, - 11799, - 11800, - 11801, - 11802, - 11803, - 11804, - 11805, - 11806, - 11807, - 11808, - 11809, - 11810, - 11811, - 11812, - 11813, - 11814, - 11815, - 11816, - 11817, - 11818, - 11819, - 11820, - 11821, - 11822, - 11823 - ], - "cfd_zeros": [ - -77, - -76, - -75, - -74, - -73, - -72, - -71, - -70, - -69, - -68, - -67, - -66, - -65, - -64, - -63, - -62, - -61, - -60, - -59, - -58, - -57, - -56, - -55, - -54, - -53, - -52, - -51, - -50, - -49, - -48, - -47, - -46, - -45, - -44, - -43, - -42, - -41, - -40, - -39, - -38, - -37, - -36, - -35, - -34, - -33, - -32, - -31, - -30, - -29, - -28, - -27, - -26, - -25, - -24, - -23, - -22, - -21, - -20, - -19, - -18, - -17, - -16, - -15, - -14, - -13, - -12, - -11, - -10, - -9, - -8, - -7, - -6, - -5, - -4, - -3, - -2, - -1, - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 71, - 72, - 73, - 74, - 75, - 76, - 77, - 78, - 79, - 80, - 81, - 82, - 83, - 84, - 85, - 86, - 87, - 88, - 89, - 90, - 91, - 92, - 93, - 94, - 95, - 96, - 97, - 98, - 99, - 100, - 101, - 102, - 103, - 104, - 105, - 106, - 107, - 108, - 109, - 110, - 111, - 112, - 113, - 114, - 115, - 116, - 117, - 118, - 119, - 120, - 121, - 122, - 123, - 124, - 125, - 126, - 127, - 128, - 129, - 130 - ], - "adc_zeros": [ - 274, - 275, - 276, - 277, - 278, - 279, - 280, - 281, - 282, - 283, - 284, - 285, - 286, - 287, - 288, - 289, - 290, - 291, - 292, - 293, - 294, - 295, - 296, - 297, - 298, - 299, - 300, - 301, - 302, - 303, - 304, - 305, - 306, - 307, - 308, - 309, - 310, - 311, - 312, - 313, - 314, - 315, - 316, - 317, - 318, - 319, - 320, - 321, - 322, - 323, - 324, - 325, - 326, - 327, - 328, - 329, - 330, - 331, - 332, - 333, - 334, - 335, - 336, - 337, - 338, - 339, - 340, - 341, - 342, - 343, - 344, - 345, - 346, - 347, - 348, - 349, - 350, - 351, - 352, - 353, - 354, - 355, - 356, - 357, - 358, - 359, - 360, - 361, - 362, - 363, - 364, - 365, - 366, - 367, - 368, - 369, - 370, - 371, - 372, - 373, - 374, - 375, - 376, - 377, - 378, - 379, - 380, - 381, - 382, - 383, - 384, - 385, - 386, - 387, - 388, - 389, - 390, - 391, - 392, - 393, - 394, - 395, - 396, - 397, - 398, - 399, - 400, - 401, - 402, - 403, - 404, - 405, - 406, - 407, - 408, - 409, - 410, - 411, - 412, - 413, - 414, - 415, - 416, - 417, - 418, - 419, - 420, - 421, - 422, - 423, - 424, - 425, - 426, - 427, - 428, - 429, - 430, - 431, - 432, - 433, - 434, - 435, - 436, - 437, - 438, - 439, - 440, - 441, - 442, - 443, - 444, - 445, - 446, - 447, - 448, - 449, - 450, - 451, - 452, - 453, - 454, - 455, - 456, - 457, - 458, - 459, - 460, - 461, - 462, - 463, - 464, - 465, - 466, - 467, - 468, - 469, - 470, - 471, - 472, - 473, - 474, - 475, - 476, - 477, - 478, - 479, - 480, - 481 - ], - "adc_delays": [ - 469, - 470, - 471, - 472, - 473, - 474, - 475, - 476, - 477, - 478, - 479, - 480, - 481, - 482, - 483, - 484, - 485, - 486, - 487, - 488, - 489, - 490, - 491, - 492, - 493, - 494, - 495, - 496, - 497, - 498, - 499, - 500, - 501, - 502, - 503, - 504, - 505, - 506, - 507, - 508, - 509, - 510, - 511, - 512, - 513, - 514, - 515, - 516, - 517, - 518, - 519, - 520, - 521, - 522, - 523, - 524, - 525, - 526, - 527, - 528, - 529, - 530, - 531, - 532, - 533, - 534, - 535, - 536, - 537, - 538, - 539, - 540, - 541, - 542, - 543, - 544, - 545, - 546, - 547, - 548, - 549, - 550, - 551, - 552, - 553, - 554, - 555, - 556, - 557, - 558, - 559, - 560, - 561, - 562, - 563, - 564, - 565, - 566, - 567, - 568, - 569, - 570, - 571, - 572, - 573, - 574, - 575, - 576, - 577, - 578, - 579, - 580, - 581, - 582, - 583, - 584, - 585, - 586, - 587, - 588, - 589, - 590, - 591, - 592, - 593, - 594, - 595, - 596, - 597, - 598, - 599, - 600, - 601, - 602, - 603, - 604, - 605, - 606, - 607, - 608, - 609, - 610, - 611, - 612, - 613, - 614, - 615, - 616, - 617, - 618, - 619, - 620, - 621, - 622, - 623, - 624, - 625, - 626, - 627, - 628, - 629, - 630, - 631, - 632, - 633, - 634, - 635, - 636, - 637, - 638, - 639, - 640, - 641, - 642, - 643, - 644, - 645, - 646, - 647, - 648, - 649, - 650, - 651, - 652, - 653, - 654, - 655, - 656, - 657, - 658, - 659, - 660, - 661, - 662, - 663, - 664, - 665, - 666, - 667, - 668, - 669, - 670, - 671, - 672, - 673, - 674, - 675, - 676 - ], - "range_correction_adc0": [ - 173, - 174, - 175, - 176, - 177, - 178, - 179, - 180, - 181, - 182, - 183, - 184, - 185, - 186, - 187, - 188, - 189, - 190, - 191, - 192, - 193, - 194, - 195, - 196, - 197, - 198, - 199, - 200, - 201, - 202, - 203, - 204, - 205, - 206, - 207, - 208, - 209, - 210, - 211, - 212, - 213, - 214, - 215, - 216, - 217, - 218, - 219, - 220, - 221, - 222, - 223, - 224, - 225, - 226, - 227, - 228, - 229, - 230, - 231, - 232, - 233, - 234, - 235, - 236, - 237, - 238, - 239, - 240, - 241, - 242, - 243, - 244, - 245, - 246, - 247, - 248, - 249, - 250, - 251, - 252, - 253, - 254, - 255, - 256, - 257, - 258, - 259, - 260, - 261, - 262, - 263, - 264, - 265, - 266, - 267, - 268, - 269, - 270, - 271, - 272, - 273, - 274, - 275, - 276, - 277, - 278, - 279, - 280, - 281, - 282, - 283, - 284, - 285, - 286, - 287, - 288, - 289, - 290, - 291, - 292, - 293, - 294, - 295, - 296, - 297, - 298, - 299, - 300, - 301, - 302, - 303, - 304, - 305, - 306, - 307, - 308, - 309, - 310, - 311, - 312, - 313, - 314, - 315, - 316, - 317, - 318, - 319, - 320, - 321, - 322, - 323, - 324, - 325, - 326, - 327, - 328, - 329, - 330, - 331, - 332, - 333, - 334, - 335, - 336, - 337, - 338, - 339, - 340, - 341, - 342, - 343, - 344, - 345, - 346, - 347, - 348, - 349, - 350, - 351, - 352, - 353, - 354, - 355, - 356, - 357, - 358, - 359, - 360, - 361, - 362, - 363, - 364, - 365, - 366, - 367, - 368, - 369, - 370, - 371, - 372, - 373, - 374, - 375, - 376, - 377, - 378, - 379, - 380 - ], - "range_correction_adc1": [ - 99, - 100, - 101, - 102, - 103, - 104, - 105, - 106, - 107, - 108, - 109, - 110, - 111, - 112, - 113, - 114, - 115, - 116, - 117, - 118, - 119, - 120, - 121, - 122, - 123, - 124, - 125, - 126, - 127, - 128, - 129, - 130, - 131, - 132, - 133, - 134, - 135, - 136, - 137, - 138, - 139, - 140, - 141, - 142, - 143, - 144, - 145, - 146, - 147, - 148, - 149, - 150, - 151, - 152, - 153, - 154, - 155, - 156, - 157, - 158, - 159, - 160, - 161, - 162, - 163, - 164, - 165, - 166, - 167, - 168, - 169, - 170, - 171, - 172, - 173, - 174, - 175, - 176, - 177, - 178, - 179, - 180, - 181, - 182, - 183, - 184, - 185, - 186, - 187, - 188, - 189, - 190, - 191, - 192, - 193, - 194, - 195, - 196, - 197, - 198, - 199, - 200, - 201, - 202, - 203, - 204, - 205, - 206, - 207, - 208, - 209, - 210, - 211, - 212, - 213, - 214, - 215, - 216, - 217, - 218, - 219, - 220, - 221, - 222, - 223, - 224, - 225, - 226, - 227, - 228, - 229, - 230, - 231, - 232, - 233, - 234, - 235, - 236, - 237, - 238, - 239, - 240, - 241, - 242, - 243, - 244, - 245, - 246, - 247, - 248, - 249, - 250, - 251, - 252, - 253, - 254, - 255, - 256, - 257, - 258, - 259, - 260, - 261, - 262, - 263, - 264, - 265, - 266, - 267, - 268, - 269, - 270, - 271, - 272, - 273, - 274, - 275, - 276, - 277, - 278, - 279, - 280, - 281, - 282, - 283, - 284, - 285, - 286, - 287, - 288, - 289, - 290, - 291, - 292, - 293, - 294, - 295, - 296, - 297, - 298, - 299, - 300, - 301, - 302, - 303, - 304, - 305, - 306 - ], - "channel_mask_data": [ - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true - ], - "channel_mask_triggers": [ - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false - ] - }, - "tcm": { - "phase_delay_a": 38.388999938964847, - "phase_delay_c": 39.388999938964847 - }, - "pm_a": [ - { - "or_gate": 128, - "trg_charge_low_level": 51863, - "trg_charge_high_level": 51520 - }, - { - "or_gate": 129, - "trg_charge_low_level": 51864, - "trg_charge_high_level": 51521 - }, - { - "or_gate": 130, - "trg_charge_low_level": 51865, - "trg_charge_high_level": 51522 - }, - { - "or_gate": 131, - "trg_charge_low_level": 51866, - "trg_charge_high_level": 51523 - }, - { - "or_gate": 132, - "trg_charge_low_level": 51867, - "trg_charge_high_level": 51524 - }, - { - "or_gate": 133, - "trg_charge_low_level": 51868, - "trg_charge_high_level": 51525 - }, - { - "or_gate": 134, - "trg_charge_low_level": 51869, - "trg_charge_high_level": 51526 - }, - { - "or_gate": 135, - "trg_charge_low_level": 51870, - "trg_charge_high_level": 51527 - }, - { - "or_gate": 136, - "trg_charge_low_level": 51871, - "trg_charge_high_level": 51528 - }, - { - "or_gate": 137, - "trg_charge_low_level": 51872, - "trg_charge_high_level": 51529 - } - ], - "pm_c": [ - { - "or_gate": 31, - "trg_charge_low_level": 48923, - "trg_charge_high_level": 62771 - }, - { - "or_gate": 32, - "trg_charge_low_level": 48924, - "trg_charge_high_level": 62772 - }, - { - "or_gate": 33, - "trg_charge_low_level": 48925, - "trg_charge_high_level": 62773 - }, - { - "or_gate": 34, - "trg_charge_low_level": 48926, - "trg_charge_high_level": 62774 - }, - { - "or_gate": 35, - "trg_charge_low_level": 48927, - "trg_charge_high_level": 62775 - }, - { - "or_gate": 36, - "trg_charge_low_level": 48928, - "trg_charge_high_level": 62776 - }, - { - "or_gate": 37, - "trg_charge_low_level": 48929, - "trg_charge_high_level": 62777 - }, - { - "or_gate": 38, - "trg_charge_low_level": 48930, - "trg_charge_high_level": 62778 - }, - { - "or_gate": 39, - "trg_charge_low_level": 48931, - "trg_charge_high_level": 62779 - }, - { - "or_gate": 40, - "trg_charge_low_level": 48932, - "trg_charge_high_level": 62780 - } - ], - "triggers": { - "vertex_time_low_threshold": -1, - "vertex_time_high_threshold": 0, - "semicentral_a": 0, - "semicentral_c": 0, - "central_a": 44611, - "central_c": 44612 - } -} diff --git a/Detectors/FIT/FV0/dcsmonitoring/macros/fetchFv0FeeConfig.C b/Detectors/FIT/FV0/dcsmonitoring/macros/fetchFv0FeeConfig.C index e9008f5915979..fcf1f5558855f 100644 --- a/Detectors/FIT/FV0/dcsmonitoring/macros/fetchFv0FeeConfig.C +++ b/Detectors/FIT/FV0/dcsmonitoring/macros/fetchFv0FeeConfig.C @@ -53,6 +53,7 @@ void fetchFv0FeeConfig(const std::string ccdbUrl = "http://alice-ccdb.cern.ch", rapidjson::Value rangeCorrectionAdc1(rapidjson::kArrayType); rapidjson::Value channelMaskData(rapidjson::kArrayType); rapidjson::Value channelMaskTriggers(rapidjson::kArrayType); + rapidjson::Value thresholdCalibration(rapidjson::kArrayType); for (int i = 0; i < o2::fv0::Fv0FeeConfiguration::NChannels; ++i) { timeAligments.PushBack(config->channels.timeAligments[i], allocator); @@ -64,6 +65,7 @@ void fetchFv0FeeConfig(const std::string ccdbUrl = "http://alice-ccdb.cern.ch", rangeCorrectionAdc1.PushBack(config->channels.rangeCorrectionAdc1[i], allocator); channelMaskData.PushBack(config->channels.channelMaskData[i], allocator); channelMaskTriggers.PushBack(config->channels.channelMaskTriggers[i], allocator); + thresholdCalibration.PushBack(config->channels.thresholdCalibration[i], allocator); } channels.AddMember("time_aligments", timeAligments, allocator); @@ -75,6 +77,7 @@ void fetchFv0FeeConfig(const std::string ccdbUrl = "http://alice-ccdb.cern.ch", channels.AddMember("range_correction_adc1", rangeCorrectionAdc1, allocator); channels.AddMember("channel_mask_data", channelMaskData, allocator); channels.AddMember("channel_mask_triggers", channelMaskTriggers, allocator); + channels.AddMember("threshold_calibration", thresholdCalibration, allocator); doc.AddMember("channels", channels, allocator); rapidjson::Value tcm(rapidjson::kObjectType); diff --git a/Detectors/FIT/FV0/dcsmonitoring/macros/fv0-fee-config.json b/Detectors/FIT/FV0/dcsmonitoring/macros/fv0-fee-config.json deleted file mode 100644 index f04a9e55494e0..0000000000000 --- a/Detectors/FIT/FV0/dcsmonitoring/macros/fv0-fee-config.json +++ /dev/null @@ -1,516 +0,0 @@ -{ - "channels": { - "time_aligments": [ - 726, - 727, - 728, - 729, - 730, - 731, - 732, - 733, - 734, - 735, - 736, - 737, - 738, - 739, - 740, - 741, - 742, - 743, - 744, - 745, - 746, - 747, - 748, - 749, - 750, - 751, - 752, - 753, - 754, - 755, - 756, - 757, - 758, - 759, - 760, - 761, - 762, - 763, - 764, - 765, - 766, - 767, - 768, - 769, - 770, - 771, - 772, - 773 - ], - "cfd_thresholds": [ - 25958, - 25959, - 25960, - 25961, - 25962, - 25963, - 25964, - 25965, - 25966, - 25967, - 25968, - 25969, - 25970, - 25971, - 25972, - 25973, - 25974, - 25975, - 25976, - 25977, - 25978, - 25979, - 25980, - 25981, - 25982, - 25983, - 25984, - 25985, - 25986, - 25987, - 25988, - 25989, - 25990, - 25991, - 25992, - 25993, - 25994, - 25995, - 25996, - 25997, - 25998, - 25999, - 26000, - 26001, - 26002, - 26003, - 26004, - 26005 - ], - "cfd_zeros": [ - -103, - -102, - -101, - -100, - -99, - -98, - -97, - -96, - -95, - -94, - -93, - -92, - -91, - -90, - -89, - -88, - -87, - -86, - -85, - -84, - -83, - -82, - -81, - -80, - -79, - -78, - -77, - -76, - -75, - -74, - -73, - -72, - -71, - -70, - -69, - -68, - -67, - -66, - -65, - -64, - -63, - -62, - -61, - -60, - -59, - -58, - -57, - -56 - ], - "adc_zeros": [ - -387, - -386, - -385, - -384, - -383, - -382, - -381, - -380, - -379, - -378, - -377, - -376, - -375, - -374, - -373, - -372, - -371, - -370, - -369, - -368, - -367, - -366, - -365, - -364, - -363, - -362, - -361, - -360, - -359, - -358, - -357, - -356, - -355, - -354, - -353, - -352, - -351, - -350, - -349, - -348, - -347, - -346, - -345, - -344, - -343, - -342, - -341, - -340 - ], - "adc_delays": [ - 3266, - 3267, - 3268, - 3269, - 3270, - 3271, - 3272, - 3273, - 3274, - 3275, - 3276, - 3277, - 3278, - 3279, - 3280, - 3281, - 3282, - 3283, - 3284, - 3285, - 3286, - 3287, - 3288, - 3289, - 3290, - 3291, - 3292, - 3293, - 3294, - 3295, - 3296, - 3297, - 3298, - 3299, - 3300, - 3301, - 3302, - 3303, - 3304, - 3305, - 3306, - 3307, - 3308, - 3309, - 3310, - 3311, - 3312, - 3313 - ], - "range_correction_adc0": [ - 1656, - 1657, - 1658, - 1659, - 1660, - 1661, - 1662, - 1663, - 1664, - 1665, - 1666, - 1667, - 1668, - 1669, - 1670, - 1671, - 1672, - 1673, - 1674, - 1675, - 1676, - 1677, - 1678, - 1679, - 1680, - 1681, - 1682, - 1683, - 1684, - 1685, - 1686, - 1687, - 1688, - 1689, - 1690, - 1691, - 1692, - 1693, - 1694, - 1695, - 1696, - 1697, - 1698, - 1699, - 1700, - 1701, - 1702, - 1703 - ], - "range_correction_adc1": [ - 1625, - 1626, - 1627, - 1628, - 1629, - 1630, - 1631, - 1632, - 1633, - 1634, - 1635, - 1636, - 1637, - 1638, - 1639, - 1640, - 1641, - 1642, - 1643, - 1644, - 1645, - 1646, - 1647, - 1648, - 1649, - 1650, - 1651, - 1652, - 1653, - 1654, - 1655, - 1656, - 1657, - 1658, - 1659, - 1660, - 1661, - 1662, - 1663, - 1664, - 1665, - 1666, - 1667, - 1668, - 1669, - 1670, - 1671, - 1672 - ], - "channel_mask_data": [ - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false - ], - "channel_mask_triggers": [ - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false, - true, - false - ] - }, - "tcm": { - "phase_delay_a": 201.51600646972657, - "phase_delay_c": 202.51600646972657 - }, - "pm_a": [ - { - "or_gate": 33, - "trg_charge_low_level": 30653, - "trg_charge_high_level": 50544 - }, - { - "or_gate": 34, - "trg_charge_low_level": 30654, - "trg_charge_high_level": 50545 - }, - { - "or_gate": 35, - "trg_charge_low_level": 30655, - "trg_charge_high_level": 50546 - }, - { - "or_gate": 36, - "trg_charge_low_level": 30656, - "trg_charge_high_level": 50547 - }, - { - "or_gate": 37, - "trg_charge_low_level": 30657, - "trg_charge_high_level": 50548 - }, - { - "or_gate": 38, - "trg_charge_low_level": 30658, - "trg_charge_high_level": 50549 - }, - { - "or_gate": 39, - "trg_charge_low_level": 30659, - "trg_charge_high_level": 50550 - }, - { - "or_gate": 40, - "trg_charge_low_level": 30660, - "trg_charge_high_level": 50551 - }, - { - "or_gate": 41, - "trg_charge_low_level": 30661, - "trg_charge_high_level": 50552 - }, - { - "or_gate": 42, - "trg_charge_low_level": 30662, - "trg_charge_high_level": 50553 - } - ], - "triggers": { - "n_channels_level": 16384, - "inner_rings_level": 770, - "charge_level": 1, - "outer_rings_level": 726 - } -} diff --git a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h index decce9d7e0cf7..a74f6668c55de 100644 --- a/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h +++ b/Detectors/FIT/common/dcsmonitoring/include/FITDCSMonitoring/FITFEEConfigurationReader.h @@ -106,6 +106,7 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader parseJsonArray(channelsNode, "range_correction_adc1", channelsConfiguration.rangeCorrectionAdc1); parseJsonArray(channelsNode, "channel_mask_data", channelsConfiguration.channelMaskData); parseJsonArray(channelsNode, "channel_mask_triggers", channelsConfiguration.channelMaskTriggers); + parseJsonArray(channelsNode, "threshold_calibration", channelsConfiguration.thresholdCalibration); } void parseTcmConfig(const rapidjson::Value& root, const char* tcmNodeName, TcmConfig& tcmConfig) @@ -168,7 +169,8 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader "range_correction_adc0": {"type": "array", "items": {"type": "integer"}}, "range_correction_adc1": {"type": "array", "items": {"type": "integer"}}, "channel_mask_data": {"type": "array", "items": {"type": "boolean"}}, - "channel_mask_triggers": {"type": "array", "items": {"type": "boolean"}} + "channel_mask_triggers": {"type": "array", "items": {"type": "boolean"}}, + "threshold_calibration": {"type": "array", "items": {"type": "integer"}} }, "additionalProperties": false, "required": [ @@ -193,7 +195,8 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader "properties": { "or_gate": {"type": "number"}, "trg_charge_low_level": {"type": "number"}, - "trg_charge_high_level": {"type": "number"} + "trg_charge_high_level": {"type": "number"}, + "fdd_coincidence_mode": {"type": "boolean"} }, "additionalProperties": false, "required": ["or_gate", "trg_charge_low_level", "trg_charge_high_level"] @@ -206,7 +209,8 @@ class FITFEEConfigurationReader : public FITDCSBaseConfigReader "properties": { "or_gate": {"type": "number"}, "trg_charge_low_level": {"type": "number"}, - "trg_charge_high_level": {"type": "number"} + "trg_charge_high_level": {"type": "number"}, + "fddCoincidenceMode": {"type": "boolean} }, "additionalProperties": false, "required": ["or_gate", "trg_charge_low_level", "trg_charge_high_level"] From 159c731747836edd3cbcd322c3e7ea010182df3f Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Fri, 2 Oct 2026 10:49:08 +0000 Subject: [PATCH 27/28] Please consider the following formatting changes --- .../src/FDDFEEConfigurationReader.cxx | 14 +++++++------- .../src/FT0FEEConfigurationReader.cxx | 14 +++++++------- .../workflow/FT0DCSConfigProcessorSpec.h | 4 +--- .../src/FV0FEEConfigurationReader.cxx | 12 ++++++------ 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/Detectors/FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx b/Detectors/FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx index a3755d0f0ba86..5b30fbf54daab 100644 --- a/Detectors/FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx +++ b/Detectors/FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx @@ -13,37 +13,37 @@ void FDDFEEConfigurationReader::parseTriggers(const rapidjson::Value& root, cons { const auto& triggersNode = root["triggers"]; - if(triggersNode.HasMember("vertex_time_low_threshold") == false) { + if (triggersNode.HasMember("vertex_time_low_threshold") == false) { throw std::runtime_error("Missing vertex_time_low_threshold trigger node!"); } const auto& vertexTimeLowThresholdNode = triggersNode["vertex_time_low_threshold"]; - if(triggersNode.HasMember("vertex_time_high_threshold") == false) { + if (triggersNode.HasMember("vertex_time_high_threshold") == false) { throw std::runtime_error("Missing vertex_time_high_threshold trigger node!"); } const auto& vertexTimeHighThresholdNode = triggersNode["vertex_time_high_threshold"]; - if(triggersNode.HasMember("semi_central_a") == false) { + if (triggersNode.HasMember("semi_central_a") == false) { throw std::runtime_error("Missing semi_central_a trigger node!"); } const auto& semicentralANode = triggersNode["semi_central_a"]; - if(triggersNode.HasMember("semi_central_c") == false) { + if (triggersNode.HasMember("semi_central_c") == false) { throw std::runtime_error("Missing semi_central_c trigger node!"); } const auto& semicentralCNode = triggersNode["semi_central_c"]; - if(triggersNode.HasMember("central_a") == false) { + if (triggersNode.HasMember("central_a") == false) { throw std::runtime_error("Missing central_a trigger node!"); } const auto& centralANode = triggersNode["central_a"]; - if(triggersNode.HasMember("central_c") == false) { + if (triggersNode.HasMember("central_c") == false) { throw std::runtime_error("Missing central_c trigger node!"); } const auto& centralCNode = triggersNode["central_c"]; - if(triggersNode.HasMember("sides_combination_mode") == false) { + if (triggersNode.HasMember("sides_combination_mode") == false) { throw std::runtime_error("Missing sides_combination_mode node!"); } const auto& sidesCombinationMode = triggersNode["sides_combination_mode"]; diff --git a/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx b/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx index 25e0f20171e52..30ba2c4d942a9 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx +++ b/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx @@ -13,37 +13,37 @@ void FT0FEEConfigurationReader::parseTriggers(const rapidjson::Value& root, cons { const auto& triggersNode = root["triggers"]; - if(triggersNode.HasMember("vertex_time_low_threshold") == false) { + if (triggersNode.HasMember("vertex_time_low_threshold") == false) { throw std::runtime_error("Missing vertex_time_low_threshold trigger node!"); } const auto& vertexTimeLowThresholdNode = triggersNode["vertex_time_low_threshold"]; - if(triggersNode.HasMember("vertex_time_high_threshold") == false) { + if (triggersNode.HasMember("vertex_time_high_threshold") == false) { throw std::runtime_error("Missing vertex_time_high_threshold trigger node!"); } const auto& vertexTimeHighThresholdNode = triggersNode["vertex_time_high_threshold"]; - if(triggersNode.HasMember("semi_central_a") == false) { + if (triggersNode.HasMember("semi_central_a") == false) { throw std::runtime_error("Missing semi_central_a trigger node!"); } const auto& semicentralANode = triggersNode["semi_central_a"]; - if(triggersNode.HasMember("semi_central_c") == false) { + if (triggersNode.HasMember("semi_central_c") == false) { throw std::runtime_error("Missing semi_central_c trigger node!"); } const auto& semicentralCNode = triggersNode["semi_central_c"]; - if(triggersNode.HasMember("central_a") == false) { + if (triggersNode.HasMember("central_a") == false) { throw std::runtime_error("Missing central_a trigger node!"); } const auto& centralANode = triggersNode["central_a"]; - if(triggersNode.HasMember("central_c") == false) { + if (triggersNode.HasMember("central_c") == false) { throw std::runtime_error("Missing central_c trigger node!"); } const auto& centralCNode = triggersNode["central_c"]; - if(triggersNode.HasMember("sides_combination_mode") == false) { + if (triggersNode.HasMember("sides_combination_mode") == false) { throw std::runtime_error("Missing sides_combination_mode node!"); } const auto& sidesCombinationMode = triggersNode["sides_combination_mode"]; diff --git a/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h b/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h index 0b880b2d32b84..fdd8ebc92b542 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h +++ b/Detectors/FIT/FT0/dcsmonitoring/workflow/FT0DCSConfigProcessorSpec.h @@ -55,9 +55,7 @@ DataProcessorSpec getFT0DCSConfigProcessorSpec() {"filename-fee-config", VariantType::String, "FT0-fee-config.json", {"FEE configuration file name"}}, {"valid-days-fee-config", VariantType::UInt32, 180u, {"FEE configuration validity in days"}}, {"filename-hv-config", VariantType::String, "FT0-hv-config.json", {"HV configuration file name"}}, - {"valid-days-hv-config", VariantType::UInt32, 180u, {"HV configuration validity in days"}} - } - }; + {"valid-days-hv-config", VariantType::UInt32, 180u, {"HV configuration validity in days"}}}}; } } // namespace o2::framework diff --git a/Detectors/FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx b/Detectors/FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx index a5d800ef5e5f0..454d615e23aed 100644 --- a/Detectors/FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx +++ b/Detectors/FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx @@ -10,28 +10,28 @@ Fv0FeeConfiguration FV0FEEConfigurationReader::parseFeeConfiguration(gsl::span Date: Fri, 2 Oct 2026 13:09:55 +0200 Subject: [PATCH 28/28] Added missing copyrights --- .../FDD/dcsmonitoring/src/FDDDCSConfigProcessor.cxx | 11 +++++++++++ .../dcsmonitoring/src/FDDFEEConfigurationReader.cxx | 11 +++++++++++ .../include/FT0DCSMonitoring/FT0DCSConfigProcessor.h | 11 +++++++++++ .../FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx | 11 +++++++++++ .../dcsmonitoring/src/FT0FEEConfigurationReader.cxx | 11 +++++++++++ .../FV0/dcsmonitoring/src/FV0DCSConfigProcessor.cxx | 11 +++++++++++ .../dcsmonitoring/src/FV0FEEConfigurationReader.cxx | 11 +++++++++++ .../dcsmonitoring/src/FITDCSBaseConfigReader.cxx | 11 +++++++++++ .../dcsmonitoring/src/FITDCSConfigProcessor.cxx | 11 +++++++++++ 9 files changed, 99 insertions(+) diff --git a/Detectors/FIT/FDD/dcsmonitoring/src/FDDDCSConfigProcessor.cxx b/Detectors/FIT/FDD/dcsmonitoring/src/FDDDCSConfigProcessor.cxx index e23f2ea2dd7d2..dc271433f1994 100644 --- a/Detectors/FIT/FDD/dcsmonitoring/src/FDDDCSConfigProcessor.cxx +++ b/Detectors/FIT/FDD/dcsmonitoring/src/FDDDCSConfigProcessor.cxx @@ -1,3 +1,14 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + #include "FDDDCSMonitoring/FDDDCSConfigProcessor.h" #include "DataFormatsFDD/HvConfiguration.h" diff --git a/Detectors/FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx b/Detectors/FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx index 5b30fbf54daab..224cfb0051e2a 100644 --- a/Detectors/FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx +++ b/Detectors/FIT/FDD/dcsmonitoring/src/FDDFEEConfigurationReader.cxx @@ -1,3 +1,14 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + #include "FDDDCSMonitoring/FDDFEEConfigurationReader.h" #include #include diff --git a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigProcessor.h b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigProcessor.h index 0deb06f6d65bc..589acaad5318e 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigProcessor.h +++ b/Detectors/FIT/FT0/dcsmonitoring/include/FT0DCSMonitoring/FT0DCSConfigProcessor.h @@ -1,3 +1,14 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + #ifndef O2_FT0_DCSCONFIGPROCESSOR_H #define O2_FT0_DCSCONFIGPROCESSOR_H diff --git a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx index 9f440c9bfaeb7..f5000ae4cc638 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx +++ b/Detectors/FIT/FT0/dcsmonitoring/src/FT0DCSConfigProcessor.cxx @@ -1,3 +1,14 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + #include "FT0DCSMonitoring/FT0DCSConfigProcessor.h" #include "DataFormatsFT0/HvConfiguration.h" diff --git a/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx b/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx index 30ba2c4d942a9..5303dc7d45991 100644 --- a/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx +++ b/Detectors/FIT/FT0/dcsmonitoring/src/FT0FEEConfigurationReader.cxx @@ -1,3 +1,14 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + #include "FT0DCSMonitoring/FT0FEEConfigurationReader.h" #include #include diff --git a/Detectors/FIT/FV0/dcsmonitoring/src/FV0DCSConfigProcessor.cxx b/Detectors/FIT/FV0/dcsmonitoring/src/FV0DCSConfigProcessor.cxx index 07568e6e85b8c..4eaf335917629 100644 --- a/Detectors/FIT/FV0/dcsmonitoring/src/FV0DCSConfigProcessor.cxx +++ b/Detectors/FIT/FV0/dcsmonitoring/src/FV0DCSConfigProcessor.cxx @@ -1,3 +1,14 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + #include "FV0DCSMonitoring/FV0DCSConfigProcessor.h" #include "DataFormatsFV0/HvConfiguration.h" #include "DataFormatsFV0/FeeConfiguration.h" diff --git a/Detectors/FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx b/Detectors/FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx index 454d615e23aed..459d9a8a5ed86 100644 --- a/Detectors/FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx +++ b/Detectors/FIT/FV0/dcsmonitoring/src/FV0FEEConfigurationReader.cxx @@ -1,3 +1,14 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + #include "FV0DCSMonitoring/FV0FEEConfigurationReader.h" namespace o2::fv0 diff --git a/Detectors/FIT/common/dcsmonitoring/src/FITDCSBaseConfigReader.cxx b/Detectors/FIT/common/dcsmonitoring/src/FITDCSBaseConfigReader.cxx index 63f48b991c3f6..d7700459109b7 100644 --- a/Detectors/FIT/common/dcsmonitoring/src/FITDCSBaseConfigReader.cxx +++ b/Detectors/FIT/common/dcsmonitoring/src/FITDCSBaseConfigReader.cxx @@ -1,3 +1,14 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + #include "FITDCSMonitoring/FITDCSBaseConfigReader.h" namespace o2::fit diff --git a/Detectors/FIT/common/dcsmonitoring/src/FITDCSConfigProcessor.cxx b/Detectors/FIT/common/dcsmonitoring/src/FITDCSConfigProcessor.cxx index 56ff479f99379..de3f66ca08905 100644 --- a/Detectors/FIT/common/dcsmonitoring/src/FITDCSConfigProcessor.cxx +++ b/Detectors/FIT/common/dcsmonitoring/src/FITDCSConfigProcessor.cxx @@ -1,3 +1,14 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + #include "FITDCSMonitoring/FITDCSConfigProcessor.h" namespace o2::fit