From 9f91bdbffc2a3775d70510c5ceec4e5c9065942f Mon Sep 17 00:00:00 2001 From: mlesch Date: Tue, 19 Nov 2024 16:58:04 +0100 Subject: [PATCH 1/5] TPC: AtmosPressure Reductor WIP --- Modules/TPC/CMakeLists.txt | 4 +- .../TPC/include/TPC/AtmosPressureReductor.h | 51 +++++++++++++++++ Modules/TPC/include/TPC/LinkDef.h | 1 + Modules/TPC/src/AtmosPressureReductor.cxx | 56 +++++++++++++++++++ 4 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 Modules/TPC/include/TPC/AtmosPressureReductor.h create mode 100644 Modules/TPC/src/AtmosPressureReductor.cxx diff --git a/Modules/TPC/CMakeLists.txt b/Modules/TPC/CMakeLists.txt index a5c22a344..1d25d4792 100644 --- a/Modules/TPC/CMakeLists.txt +++ b/Modules/TPC/CMakeLists.txt @@ -39,7 +39,8 @@ target_sources(O2QcTPC PRIVATE src/PID.cxx src/VDriftCalibReductor.cxx src/SeparationPowerReductor.cxx src/TimeGainCalibReductor.cxx - src/DCSPTempReductor.cxx) + src/DCSPTempReductor.cxx + src/AtmosPressureReductor.cxx) target_include_directories( O2QcTPC @@ -99,6 +100,7 @@ add_root_dictionary(O2QcTPC include/TPC/SeparationPowerReductor.h include/TPC/TimeGainCalibReductor.h include/TPC/DCSPTempReductor.h + include/TPC/AtmosPressureReductor.h LINKDEF include/TPC/LinkDef.h) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/TPC diff --git a/Modules/TPC/include/TPC/AtmosPressureReductor.h b/Modules/TPC/include/TPC/AtmosPressureReductor.h new file mode 100644 index 000000000..814f5c086 --- /dev/null +++ b/Modules/TPC/include/TPC/AtmosPressureReductor.h @@ -0,0 +1,51 @@ +// 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 AtmosPressureReductor.h +/// \author Marcel Lesch +/// + +#ifndef QUALITYCONTROL_ATMOSPRESSUREREDUCTOR_H +#define QUALITYCONTROL_ATMOSPRESSUREREDUCTOR_H + +#include "QualityControl/ReductorConditionAny.h" + +namespace o2::quality_control_modules::tpc +{ + +/// \brief A Reductor for atmospheric pressure +/// +/// A Reductor for atmospheric pressure +/// It produces a branch in the format: "pressure1/F:errPressure1:pressure2:errPressure2" + +class AtmosPressureReductor : public quality_control::postprocessing::ReductorConditionAny +{ + public: + AtmosPressureReductor() = default; + ~AtmosPressureReductor() = default; + + void* getBranchAddress() override; + const char* getBranchLeafList() override; + bool update(ConditionRetriever& retriever) override; + + private: + struct { + Float_t pressure1; + Float_t errPressure1; + Float_t pressure2; + Float_t errPressure2; + } mStats; +}; + +} // namespace o2::quality_control_modules::tpc + +#endif // QUALITYCONTROL_ATMOSPRESSUREREDUCTOR_H diff --git a/Modules/TPC/include/TPC/LinkDef.h b/Modules/TPC/include/TPC/LinkDef.h index 21565f1ee..ed5a0e9e0 100644 --- a/Modules/TPC/include/TPC/LinkDef.h +++ b/Modules/TPC/include/TPC/LinkDef.h @@ -44,6 +44,7 @@ #pragma link C++ class o2::quality_control_modules::tpc::SeparationPowerReductor + ; #pragma link C++ class o2::quality_control_modules::tpc::TimeGainCalibReductor + ; #pragma link C++ class o2::quality_control_modules::tpc::DCSPTempReductor + ; +#pragma link C++ class o2::quality_control_modules::tpc::AtmosPressureReductor + ; #pragma link C++ function o2::quality_control_modules::tpc::addAndPublish + ; #pragma link C++ function o2::quality_control_modules::tpc::toVector + ; diff --git a/Modules/TPC/src/AtmosPressureReductor.cxx b/Modules/TPC/src/AtmosPressureReductor.cxx new file mode 100644 index 000000000..acd4132b8 --- /dev/null +++ b/Modules/TPC/src/AtmosPressureReductor.cxx @@ -0,0 +1,56 @@ +// 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 AtmosPressureReductor.cxx +/// \author Marcel Lesch +/// + +#include "TPC/AtmosPressureReductor.h" +#include "GRPCalibration/GRPDCSDPsProcessor.h" +#include "TPC/Utility.h" + +namespace o2::quality_control_modules::tpc +{ + +void* AtmosPressureReductor::getBranchAddress() +{ + return &mStats; +} + +const char* AtmosPressureReductor::getBranchLeafList() +{ + return "pressure1/F:errPressure1:pressure2:errPressure2"; +} + +bool AtmosPressureReductor::update(ConditionRetriever& retriever) +{ + if (auto env = retriever.retrieve()) { + std::vector pressureValues; + + // pressure 1 + for (const auto& [time, p] : env->mEnvVars["CavernAtmosPressure"]) { + pressureValues.push_back(p); + } + calcMeanAndStddev(pressureValues, mStats.pressure1, mStats.errPressure1); + pressureValues.clear(); + + // pressure 2 + for (const auto& [time, p] : env->mEnvVars["CavernAtmosPressure2"]) { + pressureValues.push_back(p); + } + calcMeanAndStddev(pressureValues, mStats.pressure2, mStats.errPressure2); + return true; + } + return false; +} + +} // namespace o2::quality_control_modules::tpc \ No newline at end of file From 01e7a58aa40c51b191c79b8f64a75960ec5881d9 Mon Sep 17 00:00:00 2001 From: mlesch Date: Tue, 19 Nov 2024 17:33:51 +0100 Subject: [PATCH 2/5] TPC: AtmosPressure Reductor WIP 2 --- Modules/TPC/CMakeLists.txt | 1 + .../TPC/run/tpcQCAtmosPressureTrending.json | 80 +++++++++++++++++++ Modules/TPC/src/AtmosPressureReductor.cxx | 8 +- 3 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 Modules/TPC/run/tpcQCAtmosPressureTrending.json diff --git a/Modules/TPC/CMakeLists.txt b/Modules/TPC/CMakeLists.txt index 1d25d4792..c17064206 100644 --- a/Modules/TPC/CMakeLists.txt +++ b/Modules/TPC/CMakeLists.txt @@ -185,4 +185,5 @@ install(FILES run/tpcQCPID_sampled.json run/tpcQCTrending_separationpower.json run/tpcQCTimeGainCalibTrending.json run/tpcDCSPTempTrending.json + run/tpcQCAtmosPressureTrending.json DESTINATION etc) diff --git a/Modules/TPC/run/tpcQCAtmosPressureTrending.json b/Modules/TPC/run/tpcQCAtmosPressureTrending.json new file mode 100644 index 000000000..bf7be4988 --- /dev/null +++ b/Modules/TPC/run/tpcQCAtmosPressureTrending.json @@ -0,0 +1,80 @@ +{ + "qc": { + "config": { + "database": { + "implementation": "CCDB", + "host": "ccdb-test.cern.ch:8080", + "username": "not_applicable", + "password": "not_applicable", + "name": "not_applicable" + }, + "Activity": { + "number": "", + "type": "", + "start": "", + "end": "" + }, + "monitoring": { + "url": "infologger:///debug?qc" + }, + "consul": { + "url": "" + }, + "conditionDB": { + "url": "ccdb-test.cern.ch:8080" + }, + "postprocessing": { + "periodSeconds": "10" + } + }, + "postprocessing": { + "AtmosPressure": { + "active": "true", + "resumeTrend": "false", + "className": "o2::quality_control::postprocessing::TrendingTask", + "moduleName": "QualityControl", + "detectorName": "TPC", + "producePlotsOnUpdate": "true", + "dataSources": [ + { + "type": "condition", + "path": "GLO/Config/", + "names": [ "EnvVars" ], + "reductorName": "o2::quality_control_modules::tpc::AtmosPressureReductor", + "moduleName": "QcTPC" + } + ], + "plots": [ + { + "name": "atmosPressure1_Trending", + "title": "Trend of atmospheric pressure 1 over time", + "varexp": "EnvVars.pressure1:time", + "selection": "", + "option": "*L", + "graphAxisLabel": "atmos. Pressure:time", + "graphErrors": "EnvVars.errPressure1:0" + }, + { + "name": "atmosPressure2_Trending", + "title": "Trend of atmospheric pressure 2 over time", + "varexp": "EnvVars.pressure2:time", + "selection": "", + "option": "*L", + "graphAxisLabel": "atmos. Pressure:time", + "graphErrors": "EnvVars.errPressure2:0" + } + ], + "initTrigger": [ + "userorcontrol" + ], + "updateTrigger": [ + "foreachlatest:ccdb:GLO/Config/EnvVars/" + ], + "stopTrigger": [ + "userorcontrol" + ] + } + } + } + } + \ No newline at end of file diff --git a/Modules/TPC/src/AtmosPressureReductor.cxx b/Modules/TPC/src/AtmosPressureReductor.cxx index acd4132b8..4f7da87d9 100644 --- a/Modules/TPC/src/AtmosPressureReductor.cxx +++ b/Modules/TPC/src/AtmosPressureReductor.cxx @@ -38,16 +38,16 @@ bool AtmosPressureReductor::update(ConditionRetriever& retriever) // pressure 1 for (const auto& [time, p] : env->mEnvVars["CavernAtmosPressure"]) { - pressureValues.push_back(p); + pressureValues.emplace_back(p); } - calcMeanAndStddev(pressureValues, mStats.pressure1, mStats.errPressure1); + //calcMeanAndStddev(pressureValues, mStats.pressure1, mStats.errPressure1); pressureValues.clear(); // pressure 2 for (const auto& [time, p] : env->mEnvVars["CavernAtmosPressure2"]) { - pressureValues.push_back(p); + pressureValues.emplace_back(p); } - calcMeanAndStddev(pressureValues, mStats.pressure2, mStats.errPressure2); + //calcMeanAndStddev(pressureValues, mStats.pressure2, mStats.errPressure2); return true; } return false; From 3dd2a70024160d210c103d301b4c89f0c99e2b9d Mon Sep 17 00:00:00 2001 From: mlesch Date: Thu, 21 Nov 2024 15:46:59 +0100 Subject: [PATCH 3/5] WIP TPC: Reductor for atmos. pressures --- .../TPC/include/TPC/AtmosPressureReductor.h | 16 +++++++------ .../TPC/run/tpcQCAtmosPressureTrending.json | 16 ++++++------- Modules/TPC/src/AtmosPressureReductor.cxx | 23 ++++++++++++------- 3 files changed, 32 insertions(+), 23 deletions(-) diff --git a/Modules/TPC/include/TPC/AtmosPressureReductor.h b/Modules/TPC/include/TPC/AtmosPressureReductor.h index 814f5c086..29a3a782e 100644 --- a/Modules/TPC/include/TPC/AtmosPressureReductor.h +++ b/Modules/TPC/include/TPC/AtmosPressureReductor.h @@ -22,10 +22,10 @@ namespace o2::quality_control_modules::tpc { -/// \brief A Reductor for atmospheric pressure +/// \brief A reductor for atmospheric pressure /// -/// A Reductor for atmospheric pressure -/// It produces a branch in the format: "pressure1/F:errPressure1:pressure2:errPressure2" +/// A reductor for atmospheric pressure +/// It produces a branch in the format: "cavernPressure1/F:errCavernPressure1:cavernPressure2:errCavernPressure2:surfacePressure:errSurfacePressure" class AtmosPressureReductor : public quality_control::postprocessing::ReductorConditionAny { @@ -39,10 +39,12 @@ class AtmosPressureReductor : public quality_control::postprocessing::ReductorCo private: struct { - Float_t pressure1; - Float_t errPressure1; - Float_t pressure2; - Float_t errPressure2; + Float_t cavernPressure1; + Float_t errCavernPressure1; + Float_t cavernPressure2; + Float_t errCavernPressure2; + Float_t surfacePressure; + Float_t errSurfacePressure; } mStats; }; diff --git a/Modules/TPC/run/tpcQCAtmosPressureTrending.json b/Modules/TPC/run/tpcQCAtmosPressureTrending.json index bf7be4988..e71d48c09 100644 --- a/Modules/TPC/run/tpcQCAtmosPressureTrending.json +++ b/Modules/TPC/run/tpcQCAtmosPressureTrending.json @@ -47,21 +47,21 @@ "plots": [ { "name": "atmosPressure1_Trending", - "title": "Trend of atmospheric pressure 1 over time", - "varexp": "EnvVars.pressure1:time", + "title": "Trend of atmospheric cavern pressure 1 over time", + "varexp": "EnvVars.cavernPressure1:time", "selection": "", "option": "*L", - "graphAxisLabel": "atmos. Pressure:time", - "graphErrors": "EnvVars.errPressure1:0" + "graphAxisLabel": "atmospheric Cavern Pressure:time", + "graphErrors": "EnvVars.errCavernPressure1:0" }, { "name": "atmosPressure2_Trending", - "title": "Trend of atmospheric pressure 2 over time", - "varexp": "EnvVars.pressure2:time", + "title": "Trend of atmospheric cavern pressure 2 over time", + "varexp": "EnvVars.cavernPressure2:time", "selection": "", "option": "*L", - "graphAxisLabel": "atmos. Pressure:time", - "graphErrors": "EnvVars.errPressure2:0" + "graphAxisLabel": "atmospheric Cavern Pressure:time", + "graphErrors": "EnvVars.errCavernPressure2:0" } ], "initTrigger": [ diff --git a/Modules/TPC/src/AtmosPressureReductor.cxx b/Modules/TPC/src/AtmosPressureReductor.cxx index 4f7da87d9..5b90af35a 100644 --- a/Modules/TPC/src/AtmosPressureReductor.cxx +++ b/Modules/TPC/src/AtmosPressureReductor.cxx @@ -28,26 +28,33 @@ void* AtmosPressureReductor::getBranchAddress() const char* AtmosPressureReductor::getBranchLeafList() { - return "pressure1/F:errPressure1:pressure2:errPressure2"; + return "cavernPressure1/F:errCavernPressure1:cavernPressure2:errCavernPressure2:surfacePressure:errSurfacePressure"; } bool AtmosPressureReductor::update(ConditionRetriever& retriever) { if (auto env = retriever.retrieve()) { - std::vector pressureValues; + std::vector pressureValues; - // pressure 1 + // Cavern pressure 1 for (const auto& [time, p] : env->mEnvVars["CavernAtmosPressure"]) { - pressureValues.emplace_back(p); + pressureValues.emplace_back((float)p); } - //calcMeanAndStddev(pressureValues, mStats.pressure1, mStats.errPressure1); + calcMeanAndStddev(pressureValues, mStats.cavernPressure1, mStats.errCavernPressure1); pressureValues.clear(); - // pressure 2 + // Cavern pressure 2 for (const auto& [time, p] : env->mEnvVars["CavernAtmosPressure2"]) { - pressureValues.emplace_back(p); + pressureValues.emplace_back((float)p); } - //calcMeanAndStddev(pressureValues, mStats.pressure2, mStats.errPressure2); + calcMeanAndStddev(pressureValues, mStats.cavernPressure2, mStats.errCavernPressure2); + pressureValues.clear(); + + // Surface pressure + for (const auto& [time, p] : env->mEnvVars["SurfaceAtmosPressure"]) { + pressureValues.emplace_back((float)p); + } + calcMeanAndStddev(pressureValues, mStats.surfacePressure, mStats.errSurfacePressure); return true; } return false; From 4720a11702d3ca26a2d0d21174ada5db43fe87ec Mon Sep 17 00:00:00 2001 From: mlesch Date: Mon, 23 Dec 2024 12:53:17 +0100 Subject: [PATCH 4/5] Implementing changes --- Modules/TPC/src/AtmosPressureReductor.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/TPC/src/AtmosPressureReductor.cxx b/Modules/TPC/src/AtmosPressureReductor.cxx index 5b90af35a..3e42506e3 100644 --- a/Modules/TPC/src/AtmosPressureReductor.cxx +++ b/Modules/TPC/src/AtmosPressureReductor.cxx @@ -37,7 +37,7 @@ bool AtmosPressureReductor::update(ConditionRetriever& retriever) std::vector pressureValues; // Cavern pressure 1 - for (const auto& [time, p] : env->mEnvVars["CavernAtmosPressure"]) { + for ([[maybe_unused]] const auto& [time, p] : env->mEnvVars["CavernAtmosPressure"]) { pressureValues.emplace_back((float)p); } calcMeanAndStddev(pressureValues, mStats.cavernPressure1, mStats.errCavernPressure1); @@ -51,7 +51,7 @@ bool AtmosPressureReductor::update(ConditionRetriever& retriever) pressureValues.clear(); // Surface pressure - for (const auto& [time, p] : env->mEnvVars["SurfaceAtmosPressure"]) { + for ([[maybe_unused]] const auto& [time, p] : env->mEnvVars["SurfaceAtmosPressure"]) { pressureValues.emplace_back((float)p); } calcMeanAndStddev(pressureValues, mStats.surfacePressure, mStats.errSurfacePressure); From c9abb77c7a39eb28e37d810a63657d539ad15af5 Mon Sep 17 00:00:00 2001 From: mlesch Date: Mon, 23 Dec 2024 12:55:11 +0100 Subject: [PATCH 5/5] changes 2 --- Modules/TPC/src/AtmosPressureReductor.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/TPC/src/AtmosPressureReductor.cxx b/Modules/TPC/src/AtmosPressureReductor.cxx index 3e42506e3..8f5179665 100644 --- a/Modules/TPC/src/AtmosPressureReductor.cxx +++ b/Modules/TPC/src/AtmosPressureReductor.cxx @@ -44,7 +44,7 @@ bool AtmosPressureReductor::update(ConditionRetriever& retriever) pressureValues.clear(); // Cavern pressure 2 - for (const auto& [time, p] : env->mEnvVars["CavernAtmosPressure2"]) { + for ([[maybe_unused]] const auto& [time, p] : env->mEnvVars["CavernAtmosPressure2"]) { pressureValues.emplace_back((float)p); } calcMeanAndStddev(pressureValues, mStats.cavernPressure2, mStats.errCavernPressure2);