Skip to content

Commit

Permalink
TPC: AtmosPressure Reductor WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
mlesch committed Dec 10, 2024
1 parent 7b6a2f2 commit 9f91bdb
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Modules/TPC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
51 changes: 51 additions & 0 deletions Modules/TPC/include/TPC/AtmosPressureReductor.h
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions Modules/TPC/include/TPC/LinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 + ;
Expand Down
56 changes: 56 additions & 0 deletions Modules/TPC/src/AtmosPressureReductor.cxx
Original file line number Diff line number Diff line change
@@ -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<o2::grp::GRPEnvVariables>()) {
std::vector<float> 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

0 comments on commit 9f91bdb

Please sign in to comment.