Project
Loading...
Searching...
No Matches
PressureTemperatureHelper.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 PRESSURETEMPERATUREHELPER_H_
17#define PRESSURETEMPERATUREHELPER_H_
18
19#include "GPUCommonRtypes.h"
20#include "Headers/DataHeader.h"
22
23namespace o2::framework
24{
25class ProcessingContext;
27class InputSpec;
28class OutputSpec;
29} // namespace o2::framework
30
31namespace o2::ccdb
32{
33class BasicCCDBManager;
34} // namespace o2::ccdb
35
36namespace o2::tpc
37{
38
40{
41 public:
43
45 bool accountCCDBInputs(const o2::framework::ConcreteDataMatcher& matcher, void* obj);
46
49
53 void extractCCDBInputs(o2::ccdb::BasicCCDBManager& ccdb, long timestampMS);
54
55 // add required inputs
56 static void requestCCDBInputs(std::vector<o2::framework::InputSpec>& inputs);
57
59 static void setOutputs(std::vector<o2::framework::OutputSpec>& outputs);
60
62 void sendPTForTS(o2::framework::ProcessingContext& pc, const ULong64_t timestamp) const;
63
65 void setFitIntervalTemp(const int fitIntervalMS) { mFitIntervalMS = fitIntervalMS; }
66
71 float interpolate(const std::vector<ULong64_t>& timestamps, const std::vector<float>& values, ULong64_t timestamp) const;
72
74 float getPressure(const ULong64_t timestamp) const { return interpolate(mPressure.second, mPressure.first, timestamp); }
75
77 void setPressure(const std::pair<std::vector<float>, std::vector<ULong64_t>>& pressure) { mPressure = pressure; }
78
80 void setTemperature(const std::pair<std::vector<float>, std::vector<ULong64_t>>& temperatureA, const std::pair<std::vector<float>, std::vector<ULong64_t>>& temperatureC)
81 {
82 mTemperatureA = temperatureA;
83 mTemperatureC = temperatureC;
84 }
85
87 dataformats::Pair<float, float> getTemperature(const ULong64_t timestamp) const { return dataformats::Pair<float, float>{interpolate(mTemperatureA.second, mTemperatureA.first, timestamp), interpolate(mTemperatureC.second, mTemperatureC.first, timestamp)}; }
88
90 float getMeanTemperature(const ULong64_t timestamp) const;
91
92 // get ratio of temperature over pressure for given time stamp
93 float getTP(int64_t ts) const;
94
97
99 std::pair<ULong64_t, ULong64_t> getMinMaxTime() const;
100
101 protected:
102 static void addInput(std::vector<o2::framework::InputSpec>& inputs, o2::framework::InputSpec&& isp);
103 static void addOutput(std::vector<o2::framework::OutputSpec>& outputs, o2::framework::OutputSpec&& osp);
104 static constexpr float toKelvin(float celsius) { return celsius + 273.15f; } // convert Celsius to Kelvin
105
106 std::pair<std::vector<float>, std::vector<ULong64_t>> mPressure;
107 std::pair<std::vector<float>, std::vector<ULong64_t>> mTemperatureA;
108 std::pair<std::vector<float>, std::vector<ULong64_t>> mTemperatureC;
109 int mFitIntervalMS{5 * 60 * 1000};
110
111 const void* mLastPressureObj{};
112 const void* mLastTemperatureObj{};
113
115};
116} // namespace o2::tpc
117#endif
const void * mLastTemperatureObj
last pressure object accounted for via BasicCCDBManager, for dedup only, not streamed
static void requestCCDBInputs(std::vector< o2::framework::InputSpec > &inputs)
float getPressure(const ULong64_t timestamp) const
get pressure for given time stamp in ms
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()
ClassDefNV(PressureTemperatureHelper, 2)
last temperature object accounted for via BasicCCDBManager, for dedup only, not streamed
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
void setPressure(const std::pair< std::vector< float >, std::vector< ULong64_t > > &pressure)
manually set the pressure
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
void setFitIntervalTemp(const int fitIntervalMS)
set fit interval range for temperature in ms
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
void setTemperature(const std::pair< std::vector< float >, std::vector< ULong64_t > > &temperatureA, const std::pair< std::vector< float >, std::vector< ULong64_t > > &temperatureC)
manually set the temperature
float interpolate(const std::vector< ULong64_t > &timestamps, const std::vector< float > &values, ULong64_t timestamp) const
interpolate input values for given timestamp
GLenum GLsizei GLsizei GLint * values
Definition glcorearb.h:1576
information complementary to a CCDB object (path, metadata, startTimeValidity, endTimeValidity etc)
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
Global TPC definitions and constants.
Definition SimTraits.h:172