Project
Loading...
Searching...
No Matches
DCSProcessor.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
15
16#ifndef O2_TPC_DCSProcessor_H_
17#define O2_TPC_DCSProcessor_H_
18
19#include <memory>
20#include <gsl/span>
21#include <algorithm>
22#include <limits>
23
24#include "Rtypes.h"
25
28#include "DataFormatsTPC/DCS.h"
29
31
32namespace o2::tpc
33{
35{
36 public:
37 struct TimeRange {
38 uint64_t first{};
39 uint64_t last{};
40 };
41
42 void process(const gsl::span<const DPCOM> dps);
43
44 float getValueF(const DPCOM& dp) const;
45
46 void fillTemperature(const DPCOM& dp);
47 void fillHV(const DPCOM& dp);
48 void fillGas(const DPCOM& dp);
49 void fillPressure(const DPCOM& dp);
50 void finalizeSlot();
51 void finalize();
52
55 void finalizeGas();
56 void finalizePressure();
57
59 void setDebugOutputName(std::string_view name) { mDebugOutputName = name; }
60
62 void setWriteDebug(const bool debug = true) { mWriteDebug = debug; }
63
65 void writeDebug();
66
68 void setFitInterval(dcs::TimeStampType interval) { mFitInterval = interval; }
69
71 void setPressureInterval(dcs::TimeStampType interval) { mPressureInterval = interval; }
72
73 void setRefPressureInterval(dcs::TimeStampType interval) { mPressureIntervalRef = interval; }
74
76 auto getFitInterval() const { return mFitInterval; }
77
79 auto getPressureInterval() const { return mPressureInterval; }
80
82 void setRoundToInterval(const bool round = true) { mRoundToInterval = round; }
83
85 void reset()
86 {
87 mTemperature.clear();
88 mHighVoltage.clear();
89 mGas.clear();
90 mPressure.clear();
91
92 mTimeTemperature = {};
93 mTimeHighVoltage = {};
94 mTimeGas = {};
95 }
96
98 bool hasData() const { return mHasData; }
99
100 const auto& getTimeTemperature() const { return mTimeTemperature; }
101 const auto& getTimeHighVoltage() const { return mTimeHighVoltage; }
102 const auto& getTimeGas() const { return mTimeGas; }
103 const auto& getTimePressure() const { return mTimePressure; }
104
105 auto& getTemperature() { return mTemperature; }
106 auto& getHighVoltage() { return mHighVoltage; }
107 auto& getGas() { return mGas; }
108 auto& getPressure() { return mPressure; }
109
110 private:
111 dcs::Temperature mTemperature;
112 dcs::HV mHighVoltage;
113 dcs::Gas mGas;
114 dcs::Pressure mPressure;
115
116 TimeRange mTimeTemperature;
117 TimeRange mTimeHighVoltage;
118 TimeRange mTimeGas;
119 TimeRange mTimePressure;
120
121 dcs::TimeStampType mFitInterval{5 * 60 * 1000};
122 dcs::TimeStampType mPressureInterval{200 * 1000};
123 dcs::TimeStampType mPressureIntervalRef{60 * 60 * 1000};
124 bool mWriteDebug{false};
125 bool mRoundToInterval{false};
126 bool mHasData{false};
127 std::string mDebugOutputName{"DCS_debug.root"};
128 std::unique_ptr<o2::utils::TreeStreamRedirector> mDebugStream;
129
130 ClassDefNV(DCSProcessor, 0);
131};
132
133} // namespace o2::tpc
134#endif
DCS data point data formats.
std::ostringstream debug
const auto & getTimeGas() const
void fillPressure(const DPCOM &dp)
const auto & getTimePressure() const
bool hasData() const
if data to process
void setFitInterval(dcs::TimeStampType interval)
set the fit interval
void setWriteDebug(const bool debug=true)
if to write debug information
void fillHV(const DPCOM &dp)
const auto & getTimeTemperature() const
void reset()
reset all data
void setRefPressureInterval(dcs::TimeStampType interval)
void setRoundToInterval(const bool round=true)
round to fit interval
void fillTemperature(const DPCOM &dp)
float getValueF(const DPCOM &dp) const
void setDebugOutputName(std::string_view name)
name of the debug output tree
void setPressureInterval(dcs::TimeStampType interval)
set the interval for averaging the pressure values
void writeDebug()
write the debug output tree
auto getPressureInterval() const
get fit interval
const auto & getTimeHighVoltage() const
auto getFitInterval() const
get fit interval
void fillGas(const DPCOM &dp)
GLuint const GLchar * name
Definition glcorearb.h:781
uint64_t TimeStampType
Definition DCS.h:45
Global TPC definitions and constants.
Definition SimTraits.h:167
void clear()
Definition DCS.h:519
void clear()
Definition DCS.h:430
void clear()
\clear all stored data except the buffer
Definition DCS.cxx:305