Project
Loading...
Searching...
No Matches
ChamberHV.cxx
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
16
18
20
21namespace o2
22{
23namespace mid
24{
25
26std::vector<std::pair<uint64_t, double>> getValues(const std::unordered_map<o2::dcs::DataPointIdentifier, std::vector<o2::dcs::DataPointValue>>& dpMap, std::string alias)
27{
28 union Converter {
29 uint64_t raw_data;
30 double value;
31 } converter;
32 std::vector<std::pair<uint64_t, double>> values;
33 for (auto& dp : dpMap) {
34 if (alias == dp.first.get_alias()) {
35 for (auto& dpVal : dp.second) {
36 converter.raw_data = dpVal.payload_pt1;
37 values.emplace_back(dpVal.get_epoch_time(), converter.value);
38 }
39 }
40 }
41 return values;
42}
43
44double getAverage(std::vector<std::pair<uint64_t, double>>& values)
45{
46 double num = 0., den = 0.;
47 for (size_t ival = 1; ival < values.size(); ++ival) {
48 double delta = values[ival].first - values[ival - 1].first;
49 num += values[ival - 1].second * delta;
50 den += delta;
51 }
52 return (den > 0.) ? num / den : num;
53}
54
55void ChamberHV::setHV(const std::unordered_map<o2::dcs::DataPointIdentifier, std::vector<o2::dcs::DataPointValue>>& dpMap)
56{
57 for (int deId = 0; deId < detparams::NDetectionElements; ++deId) {
58 auto alias = detElemId2DCSAlias(deId, dcs::MeasurementType::HV_V);
59 auto values = getValues(dpMap, alias);
60 auto hv = getAverage(values);
61 setHV(deId, hv);
62 }
63}
64
66{
67 ChamberHV hv;
68 for (int ide = 0; ide < detparams::NDetectionElements; ++ide) {
69 hv.setHV(ide, 9600.);
70 }
71
72 return hv;
73}
74
75} // namespace mid
76} // namespace o2
HV values for MID RPCs.
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
double num
void setHV(int deId, double hv)
Sets the HV for detection element.
Definition ChamberHV.h:42
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLenum GLsizei GLsizei GLint * values
Definition glcorearb.h:1576
constexpr int NDetectionElements
Number of RPCs.
ChamberHV createDefaultChamberHV()
Creates the default chamber voltages.
Definition ChamberHV.cxx:65
double getAverage(std::vector< std::pair< uint64_t, double > > &values)
Definition ChamberHV.cxx:44
std::vector< std::pair< uint64_t, double > > getValues(const std::unordered_map< o2::dcs::DataPointIdentifier, std::vector< o2::dcs::DataPointValue > > &dpMap, std::string alias)
Definition ChamberHV.cxx:26
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...