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::tpc
32{
33
35{
36 public:
38
40 bool accountCCDBInputs(const o2::framework::ConcreteDataMatcher& matcher, void* obj);
41
44
45 // add required inputs
46 static void requestCCDBInputs(std::vector<o2::framework::InputSpec>& inputs);
47
49 static void setOutputs(std::vector<o2::framework::OutputSpec>& outputs);
50
52 void sendPTForTS(o2::framework::ProcessingContext& pc, const ULong64_t timestamp) const;
53
55 void setFitIntervalTemp(const int fitIntervalMS) { mFitIntervalMS = fitIntervalMS; }
56
61 float interpolate(const std::vector<ULong64_t>& timestamps, const std::vector<float>& values, ULong64_t timestamp) const;
62
64 float getPressure(const ULong64_t timestamp) const { return interpolate(mPressure.second, mPressure.first, timestamp); }
65
67 void setPressure(const std::pair<std::vector<float>, std::vector<ULong64_t>>& pressure) { mPressure = pressure; }
68
70 void setTemperature(const std::pair<std::vector<float>, std::vector<ULong64_t>>& temperatureA, const std::pair<std::vector<float>, std::vector<ULong64_t>>& temperatureC)
71 {
72 mTemperatureA = temperatureA;
73 mTemperatureC = temperatureC;
74 }
75
77 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)}; }
78
80 float getMeanTemperature(const ULong64_t timestamp) const;
81
82 // get ratio of temperature over pressure for given time stamp
83 float getTP(int64_t ts) const;
84
87
89 std::pair<ULong64_t, ULong64_t> getMinMaxTime() const;
90
91 protected:
92 static void addInput(std::vector<o2::framework::InputSpec>& inputs, o2::framework::InputSpec&& isp);
93 static void addOutput(std::vector<o2::framework::OutputSpec>& outputs, o2::framework::OutputSpec&& osp);
94 static constexpr float toKelvin(float celsius) { return celsius + 273.15f; } // convert Celsius to Kelvin
95
96 std::pair<std::vector<float>, std::vector<ULong64_t>> mPressure;
97 std::pair<std::vector<float>, std::vector<ULong64_t>> mTemperatureA;
98 std::pair<std::vector<float>, std::vector<ULong64_t>> mTemperatureC;
99 int mFitIntervalMS{5 * 60 * 1000};
100
102};
103} // namespace o2::tpc
104#endif
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()
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
ClassDefNV(PressureTemperatureHelper, 1)
GLenum GLsizei GLsizei GLint * values
Definition glcorearb.h:1576
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
Global TPC definitions and constants.
Definition SimTraits.h:167