diff --git a/Modules/TPC/CMakeLists.txt b/Modules/TPC/CMakeLists.txt index a5c22a3444..c170642066 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 @@ -183,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/include/TPC/AtmosPressureReductor.h b/Modules/TPC/include/TPC/AtmosPressureReductor.h new file mode 100644 index 0000000000..29a3a782e6 --- /dev/null +++ b/Modules/TPC/include/TPC/AtmosPressureReductor.h @@ -0,0 +1,53 @@ +// 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: "cavernPressure1/F:errCavernPressure1:cavernPressure2:errCavernPressure2:surfacePressure:errSurfacePressure" + +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 cavernPressure1; + Float_t errCavernPressure1; + Float_t cavernPressure2; + Float_t errCavernPressure2; + Float_t surfacePressure; + Float_t errSurfacePressure; + } 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 21565f1ee4..ed5a0e9e0d 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/run/tpcQCAtmosPressureTrending.json b/Modules/TPC/run/tpcQCAtmosPressureTrending.json new file mode 100644 index 0000000000..e71d48c091 --- /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 cavern pressure 1 over time", + "varexp": "EnvVars.cavernPressure1:time", + "selection": "", + "option": "*L", + "graphAxisLabel": "atmospheric Cavern Pressure:time", + "graphErrors": "EnvVars.errCavernPressure1:0" + }, + { + "name": "atmosPressure2_Trending", + "title": "Trend of atmospheric cavern pressure 2 over time", + "varexp": "EnvVars.cavernPressure2:time", + "selection": "", + "option": "*L", + "graphAxisLabel": "atmospheric Cavern Pressure:time", + "graphErrors": "EnvVars.errCavernPressure2: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 new file mode 100644 index 0000000000..8f51796658 --- /dev/null +++ b/Modules/TPC/src/AtmosPressureReductor.cxx @@ -0,0 +1,63 @@ +// 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 "cavernPressure1/F:errCavernPressure1:cavernPressure2:errCavernPressure2:surfacePressure:errSurfacePressure"; +} + +bool AtmosPressureReductor::update(ConditionRetriever& retriever) +{ + if (auto env = retriever.retrieve()) { + std::vector pressureValues; + + // Cavern pressure 1 + for ([[maybe_unused]] const auto& [time, p] : env->mEnvVars["CavernAtmosPressure"]) { + pressureValues.emplace_back((float)p); + } + calcMeanAndStddev(pressureValues, mStats.cavernPressure1, mStats.errCavernPressure1); + pressureValues.clear(); + + // Cavern pressure 2 + for ([[maybe_unused]] const auto& [time, p] : env->mEnvVars["CavernAtmosPressure2"]) { + pressureValues.emplace_back((float)p); + } + calcMeanAndStddev(pressureValues, mStats.cavernPressure2, mStats.errCavernPressure2); + pressureValues.clear(); + + // Surface pressure + for ([[maybe_unused]] const auto& [time, p] : env->mEnvVars["SurfaceAtmosPressure"]) { + pressureValues.emplace_back((float)p); + } + calcMeanAndStddev(pressureValues, mStats.surfacePressure, mStats.errSurfacePressure); + return true; + } + return false; +} + +} // namespace o2::quality_control_modules::tpc \ No newline at end of file