16#ifndef TPC_DCSCalibData_H_
17#define TPC_DCSCalibData_H_
26#include <unordered_map>
76 std::pair<std::vector<T>, std::vector<TimeStampType>> pairs;
77 pairs.first.reserve(
data.size());
78 pairs.second.reserve(
data.size());
79 for (
const auto& dp :
data) {
80 pairs.first.emplace_back(dp.value);
81 pairs.second.emplace_back(dp.time);
96 std::unique(
data.begin(),
data.end(),
97 [](
const auto& dp1,
const auto& dp2) {
98 return dp1.time == dp2.time;
101 data.shrink_to_fit();
116 const auto i = std::upper_bound(
data.begin(),
data.end(),
DPType{timeStamp, {}});
117 return (
i ==
data.begin()) ? (*i).value : (*(
i - 1)).value;
129 const auto iFrom = std::upper_bound(
data.begin(),
data.end(),
DPType{from, {}});
130 const auto iUntil = (from == until) ? iFrom :
std::upper_bound(
data.
begin(),
data.
end(), DPType{until, {}});
131 const auto distFrom = std::distance(
data.begin(), iFrom);
132 const auto distUntil = std::distance(iUntil,
data.end());
133 const auto nFrom = std::min(distFrom,
range + 1);
134 const auto nUntil = std::min(distUntil,
range);
135 const auto nPoints = std::distance(iFrom - nFrom, iUntil + nUntil);
136 return {std::accumulate(iFrom - nFrom, iUntil + nUntil, DPType{(*(iFrom - nFrom)).time, T{}}).
value, nPoints};
141 const auto sumAndPoints = getSumAndPoints(from, until,
range);
142 return sumAndPoints.first /
static_cast<float>(sumAndPoints.second);
151 for (
auto&
data : dataVector) {
159 for (
auto&
data : dataVector) {
167 if (
a.size() !=
b.size()) {
168 LOGP(warning,
"Trying to append std::vector<dcs::DataPointVector<T>>s of different size: {} != {}",
a.size(),
b.size());
170 for (
size_t i = 0;
i <
a.size(); ++
i) {
181 for (
const auto& dps : dpVec) {
182 const auto sumAndPoints = dps.getSumAndPoints(from, until,
range);
183 ret += sumAndPoints.first;
184 nPoints += sumAndPoints.second;
186 return (nPoints > 0) ? ret /
static_cast<float>(nPoints) : T{};
192 constexpr auto max = std::numeric_limits<dcs::TimeStampType>::max();
194 for (
const auto& sensor :
data) {
195 const auto time = sensor.data.size() ? sensor.data.front().time :
max;
196 firstTime = std::min(firstTime,
time);
201 if (roundToInterval) {
202 firstTime -= (firstTime % fitInterval);
211 constexpr auto min = 0;
213 for (
const auto& sensor :
data) {
214 const auto time = sensor.data.size() ? sensor.data.back().time : 0;
242 static constexpr
int SensorsPerSide = 9;
244 static const
std::unordered_map<
std::
string,
int> SensorNameMap;
252 {-150.34f, -205.04f},
261 {-175.82f, -183.66f},
267 static constexpr auto&
getSensorPosition(
const size_t sensor) {
return SensorPosition[sensor]; }
303 raw[SensorNameMap.at(sensor.data())].fill(
time, temperature);
328 bool makeFit(TLinearFitter& fitter,
const int nDim, std::vector<double>& xVals, std::vector<double>& temperatures);
343 static constexpr size_t SidePos = 7;
344 static constexpr size_t SectorPos = 8;
345 static constexpr size_t ROCPos = 11;
346 static constexpr size_t GEMPos = 14;
347 static constexpr size_t ElectrodePos = 15;
376 const auto sideOffset = (sensor[SidePos] ==
'A') ? 0 : SECTORSPERSIDE;
377 const auto sector = std::atoi(sensor.substr(SectorPos, 2).data());
378 return sector + sideOffset;
383 if (sensor[ROCPos] ==
'I') {
384 return GEMstack::IROCgem;
386 const auto orocType = int(sensor[ROCPos + 1] -
'0');
387 return static_cast<GEMstack>(orocType);
393 const int sector = getSector(sensor);
394 const auto stack = getStack(sensor);
395 const auto rocOffset = int(
stack != GEMstack::IROCgem);
396 const auto gem = int(sensor[GEMPos + rocOffset] -
'0');
397 const bool isTop = sensor[ElectrodePos + rocOffset] ==
'T';
399 const int electrode = 2 * (gem - 1) + !isTop;
401 const int index = stackID.getIndex() * 2 * GEMSPERSTACK +
electrode;
403 const auto type = sensor.back();
407 }
else if (
type ==
'U') {
415 const int sector = getSector(sensor);
416 const auto stack = getStack(sensor);
451 static constexpr size_t SensorPos = 4;
452 static constexpr size_t TypePosGC = 7;
453 static constexpr size_t TypePosAn = 15;
466 if (sensor[SensorPos] ==
'G') {
467 switch (sensor[TypePosGC]) {
469 if (sensor[TypePosGC + 1] ==
'E') {
489 LOGP(warning,
"Unknown gas sensor {}", sensor);
493 switch (sensor[TypePosAn]) {
501 LOGP(warning,
"Unknown gas sensor {}", sensor);
512 argon.sortAndClean();
515 h2oSensor.sortAndClean();
516 o2Sensor.sortAndClean();
533 neon.append(
other.neon);
534 co2.append(
other.co2);
536 argon.append(
other.argon);
537 h2o.append(
other.h2o);
539 h2oSensor.append(
other.h2oSensor);
540 o2Sensor.append(
other.o2Sensor);
580 void sortAndClean(
float pMin = 800,
float pMax = 1100);
603 static void setAliases(TTree*
tree);
610 std::pair<std::vector<float>, std::vector<TimeStampType>> mCavernAtmosPressure1Buff{};
611 std::pair<std::vector<float>, std::vector<TimeStampType>> mCavernAtmosPressure2Buff{};
612 std::pair<std::vector<float>, std::vector<TimeStampType>> mSurfaceAtmosPressureBuff{};
614 std::pair<std::vector<float>, std::vector<TimeStampType>> mPressure12Buff{};
615 std::pair<std::vector<float>, std::vector<TimeStampType>> mPressure1SBuff{};
616 std::pair<std::vector<float>, std::vector<TimeStampType>> mPressure2SBuff{};
618 std::pair<std::vector<float>, std::vector<TimeStampType>> mRobPressureBuff{};
o2::raw::RawFileWriter * raw
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual Show related Highlight grid Show only individual collision Color clusters belonging to track objects Set line Enable drawing TPC data Enable drawing TOF data Enable drawing magnetic field Set field line step count Invert colors configStandalone Heavy OpenGL display display_heavy Show tracks with ITS contribution Show tracks with TOF contribution Enable propagation of loopers Show clusters at nominal x of pad row for early transformed data Split CE tracks when they cross the central electrode(-1=for triggered data)") AddOption(markClusters
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual sector
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
configStandalone Reconstruction rec_tpc float
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * value
GLint GLint GLsizei GLint GLenum GLenum type
GLboolean GLboolean GLboolean GLboolean a
void doAppend(std::vector< dcs::DataPointVector< T > > &a, const std::vector< dcs::DataPointVector< T > > &b)
dcs::TimeStampType getMinTime(const std::vector< dcs::DataPointVector< T > > &data, const bool roundToInterval, dcs::TimeStampType fitInterval)
void doClear(std::vector< dcs::DataPointVector< T > > &dataVector)
const T getAverageValueForTime(const std::vector< dcs::DataPointVector< T > > &dpVec, const TimeStampType from, const TimeStampType until, const long range)
void doSortAndClean(std::vector< dcs::DataPointVector< T > > &dataVector)
dcs::TimeStampType getMaxTime(const std::vector< dcs::DataPointVector< T > > &data)
Global TPC definitions and constants.
GEMstack
TPC GEM stack types.
Enum< T >::Iterator begin(Enum< T >)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
GEM stack identification.
std::vector< DPType > data
void fill(const TimeStampType time, const T &value)
auto getPairOfVector() const
convert data points to a vector of pairs: pair.first -> data and pair.second -> time
void fill(const DPType &dataPoint)
const T getAverageValueForTime(const TimeStampType from, const TimeStampType until, const long range) const
void append(const DataPointVector< T > &other)
ClassDefNV(DataPointVector, 1)
const std::pair< T, long > getSumAndPoints(const TimeStampType from, const TimeStampType until, const long range) const
calculate average value between from and unil, extending the range by +- range elements
const T & getValueForTime(const TimeStampType timeStamp) const
const T getAverageValueForTime(const TimeStampType timeStamp, const long range) const
calculate average value for timeStamp, extending the range by +- range elements
bool equalTime(const DataPoint &other) const
bool operator<(const TimeStampType timeStamp) const
DataPoint operator/(const DataType denom) const
DataPoint operator+(const DataPoint &other) const
bool operator<(const DataPoint &other) const
void fill(std::string_view sensor, const TimeStampType time, const DataType value)
void append(const Gas &other)
std::vector< RawDPsF > voltages
voltages per GEM stack, counting is IROCs GEM1 top, bottom, GEM2 top, bottom, .. O1 ....
static const std::unordered_map< StackState, std::string > StackStateNameMap
map state to string
std::vector< RawDPsState > states
HV state per sector.
std::vector< RawDPsF > currents
currents per GEM stack, counting is IROCs GEM1 top, bottom, GEM2 top, bottom, .. O1 ....
static GEMstack getStack(std::string_view sensor)
static int getSector(std::string_view sensor)
void fillStatus(std::string_view sensor, const TimeStampType time, const uint32_t value)
Fill stack status information.
void append(const HV &other)
void fillUI(std::string_view sensor, const TimeStampType time, const DataType value)
Fill voltage and current information.
Stats cavernAtmosPressure2S
rolling statistics of cavernAtmosPressure2/surfaceAtmosPressure
Stats cavernAtmosPressure1S
rolling statistics of cavernAtmosPressure/surfaceAtmosPressure
std::vector< uint8_t > isOk
bit mask of valid sensors: cavernBit 0, cavern2Bit = 1, surfaceBit = 2
Stats cavernAtmosPressure2
rolling statistics of cavern sensor 2
std::vector< float > robustPressure
combined robust pressure value that should be used
std::vector< ULong64_t > time
time stamps of all pressure values
Stats cavernAtmosPressure12
rolling statistics of cavernAtmosPressure/cavernAtmosPressure2
ClassDefNV(RobustPressure, 2)
Stats cavernAtmosPressure
rolling statistics of cavern sensor 1
TimeStampType timeIntervalRef
reference time interval used for normalization of pressure sensors
Stats surfaceAtmosPressure
rolling statistics of surface sensor
TimeStampType timeInterval
time interval used for rolling statistics
Stats operator+(const Stats &other) const
Stats operator/(const DataType val) const
DataType getMeanTempRaw()
StatsDPs statsA
statistics fit values per integration time A-Side
void append(const Temperature &other)
StatsDPs statsC
statistics fit values per integration time C-Side
static constexpr auto & getSensorPosition(const size_t sensor)
std::vector< RawDPsF > raw
raw temperature values from DCS for
void fill(std::string_view sensor, const TimeStampType time, const DataType temperature)
const Stats & getStats(const Side s, const TimeStampType timeStamp) const
VectorOfTObjectPtrs other
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))