Project
Loading...
Searching...
No Matches
DCSNamer.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
14#include <array>
15#include <fmt/printf.h>
16#include <iostream>
17#include <set>
18#include <optional>
19#include <stdexcept>
20#include <fmt/format.h>
21
22namespace
23{
24const std::string detPrefix = "MID";
25
26// Run2 (0..71) vs Run3 (11xx, 12xx, 13xx, 14xx) detection element ids
27//
28// INSIDE: 0..35
29//
30// 1100,1101,1102,1103,1104,
31// 4, 5, 6, 7, 8,
32// 1114,1115,1116,1117,
33// 0, 1, 2, 3,
34// 1200,1201,1202,1203,1204,
35// 17, 16, 15, 14, 13,
36// 1214,1215,1216,1217,
37// 9, 10, 11, 12,
38// 1300,1301,1302,1303,1304,
39// 26, 25, 24, 23, 22,
40// 1314,1315,1316,1317,
41// 18, 19, 20, 21,
42// 1400,1401,1402,1403,1404,
43// 35, 34, 33, 32, 31,
44// 1414,1415,1416,1417,
45// 27, 28, 29, 30,
46//
47// OUTSIDE : 36..71
48//
49// 1105,1106,1107,1108,1109,
50// 44, 43, 42, 41, 40,
51// 1110,1111,1112,1113,
52// 39, 38, 37, 36
53// 1205,1206,1207,1208,1209,
54// 53, 52, 51, 50, 49,
55// 1210,1211,1212,1213,
56// 48, 47, 46, 45,
57// 1305,1306,1307,1308,1309,
58// 62, 61, 60, 59,
59// 1310,1311,1312,1313,
60// 58, 57, 56, 55, 54,
61// 1405,1406,1407,1408,1409,
62// 71, 70, 69, 68, 67,
63// 1410,1411,1412,1413,
64// 66, 65, 64, 63,
65
66std::string sideName(o2::mid::dcs::Side side)
67{
69 return "INSIDE";
70 }
72 return "OUTSIDE";
73 }
74 return "INVALID";
75}
76
77std::string measurementName(o2::mid::dcs::MeasurementType m)
78{
79 switch (m) {
81 return "vEff";
83 return "actual.iMon";
84 }
85 return "INVALID";
86}
87
88} // namespace
89
90namespace o2::mid::dcs
91{
92std::optional<ID> detElemId2DCS(int deId)
93{
94 if (deId < 0 || deId > 71) {
95 return std::nullopt;
96 }
97 int chamberId = detparams::getChamber(deId);
98 int id = 1 + detparams::getRPCLine(deId);
100
101 switch (chamberId) {
102 case 0:
103 chamberId = 11;
104 break;
105 case 1:
106 chamberId = 12;
107 break;
108 case 2:
109 chamberId = 21;
110 break;
111 case 3:
112 chamberId = 22;
113 break;
114 default:
115 throw std::runtime_error(fmt::format("invalid chamberId={} : expected between 0 and 3", chamberId));
116 }
117
118 return std::optional<ID>{{id, side, chamberId}};
119}
120
122{
123 auto id = detElemId2DCS(deId);
124 return fmt::format("{}_{}_MT{}_RPC{}_HV.", detPrefix, sideName(id->side), id->chamberId, id->number) + measurementName(type);
125}
126
127std::vector<std::string> aliases(std::vector<MeasurementType> types)
128{
129
130 std::vector<std::string> aliases;
131 for (auto& type : types) {
132 for (auto deId = 0; deId < detparams::NDetectionElements; ++deId) {
133 aliases.emplace_back(detElemId2DCSAlias(deId, type));
134 }
135 }
136 return aliases;
137}
138} // namespace o2::mid::dcs
Useful detector parameters for MID.
uint32_t side
Definition RawData.h:0
const GLfloat * m
Definition glcorearb.h:4066
GLsizei GLenum GLenum * types
Definition glcorearb.h:2516
GLint GLint GLsizei GLint GLenum GLenum type
Definition glcorearb.h:275
GLuint id
Definition glcorearb.h:650
std::optional< ID > detElemId2DCS(int deId)
Definition DCSNamer.cxx:92
std::string detElemId2DCSAlias(int deId, MeasurementType type)
Converts the detection element ID into a DCS alias.
Definition DCSNamer.cxx:121
std::vector< std::string > aliases(std::vector< MeasurementType > types={ MeasurementType::HV_V, MeasurementType::HV_I})
Definition DCSNamer.cxx:127
constexpr int NDetectionElements
Number of RPCs.
bool isRightSide(int deId)