36 LOGP(info,
"Updating pressure");
38 mPressure.second = pressure->robustPressure.time;
39 mPressure.first = pressure->robustPressure.robustPressure;
44 LOGP(info,
"Updating temperature");
54 for (
const auto& dp : temp.statsA.data) {
59 for (
const auto& dp : temp.statsC.data) {
66 float temperature =
toKelvin(temp.getMeanTempRaw());
71 LOGP(warning,
"No temperature data available from fit. Using average temperature {} K", temperature);
87 if (std::find(inputs.begin(), inputs.end(), isp) == inputs.end()) {
88 inputs.emplace_back(isp);
100 if (std::find(outputs.begin(), outputs.end(), osp) == outputs.end()) {
101 outputs.emplace_back(osp);
108 auto [idxLeft, idxRight] = *idxClosest;
109 if (idxRight > idxLeft) {
110 const auto x0 = timestamps[idxLeft];
111 const auto x1 = timestamps[idxRight];
114 const float y = (
y0 * (
x1 - timestamp) +
y1 * (timestamp -
x0)) / (
x1 -
x0);
127 LOGP(info,
"Sending pressure {}, temperature A {} and temperature C {} for timestamp {}", pressure, temp.first, temp.second, timestamp);
137 LOGP(error,
"Pressure {} is zero or negative, cannot compute T/P ratio for timestamp {}", pressure, ts);
140 const float tp = temp / pressure;
150 constexpr float minTemp =
toKelvin(15);
151 constexpr float maxTemp =
toKelvin(25);
152 if (
auto t = temp.first; t > minTemp && t < maxTemp) {
156 if (
auto t = temp.second; t > minTemp && t < maxTemp) {
162 constexpr float defaultTemp =
toKelvin(19.6440f);
163 LOGP(info,
"Returning default temperature of {}K", defaultTemp);
167 const float meanT = sumT /
w;
173 ULong64_t minTime = std::numeric_limits<ULong64_t>::max();
174 ULong64_t maxTime = 0;
177 minTime = std::min(minTime,
mPressure.second.front());
178 maxTime = std::max(maxTime,
mPressure.second.back());
189 return {minTime, maxTime};
CDB Type definitions for TPC.
DCS data point data formats.
Helper class to extract pressure and temperature.
void snapshot(const Output &spec, T const &object)
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
static void requestCCDBInputs(std::vector< o2::framework::InputSpec > &inputs)
float getPressure(const ULong64_t timestamp) const
get pressure for given time stamp in ms
float getTP(int64_t ts) const
void extractCCDBInputs(o2::framework::ProcessingContext &pc) const
trigger checking for CCDB objects
std::pair< ULong64_t, ULong64_t > getMinMaxTime() const
get minimum and maximum time stamps of the pressure and temperature data
static constexpr o2::header::DataDescription getDataDescriptionTemperature()
dataformats::Pair< float, float > getTemperature(const ULong64_t timestamp) const
get temperature for given time stamp in ms
static void addOutput(std::vector< o2::framework::OutputSpec > &outputs, o2::framework::OutputSpec &&osp)
std::pair< std::vector< float >, std::vector< ULong64_t > > mTemperatureA
temperature values A-side
void sendPTForTS(o2::framework::ProcessingContext &pc, const ULong64_t timestamp) const
send temperature and pressure for given time stamp
int mFitIntervalMS
fit interval for the temperature
float getMeanTemperature(const ULong64_t timestamp) const
get mean temperature over A and C side
std::pair< std::vector< float >, std::vector< ULong64_t > > mPressure
pressure values for both measurements
static constexpr o2::header::DataDescription getDataDescriptionPressure()
static void addInput(std::vector< o2::framework::InputSpec > &inputs, o2::framework::InputSpec &&isp)
bool accountCCDBInputs(const o2::framework::ConcreteDataMatcher &matcher, void *obj)
check for new CCDB objects
static constexpr float toKelvin(float celsius)
std::pair< std::vector< float >, std::vector< ULong64_t > > mTemperatureC
temperature values C-side
static void setOutputs(std::vector< o2::framework::OutputSpec > &outputs)
define outputs in case pressure and temperature will be send
float interpolate(const std::vector< ULong64_t > ×tamps, const std::vector< float > &values, ULong64_t timestamp) const
interpolate input values for given timestamp
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLuint GLfloat GLfloat GLfloat x1
GLenum GLsizei GLsizei GLint * values
GLubyte GLubyte GLubyte GLubyte w
GLuint GLfloat GLfloat y0
constexpr o2::header::DataOrigin gDataOriginTPC
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > ccdbParamSpec(std::string const &path, int runDependent, std::vector< CCDBMetadata > metadata={}, int qrate=0)
std::optional< std::pair< size_t, size_t > > findClosestIndices(const std::vector< DataTimeType > ×tamps, DataTime timestamp)
Global TPC definitions and constants.
const std::unordered_map< CDBType, const std::string > CDBTypeMap
Storage name in CCDB for each calibration and parameter type.
@ CalPressure
DCS pressure measurements.
@ CalTemperature
DCS temperature measurements.