Project
Loading...
Searching...
No Matches
Plane.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
12#include "MCHConditions/Plane.h"
13
17#include "MCHConditions/Side.h"
18#include <algorithm>
19#include <fmt/core.h>
20#include <stdexcept>
21
22namespace o2::mch::dcs
23{
24
25Plane aliasToPlane(std::string_view alias)
26{
27 auto chamber = aliasToChamber(alias);
28 if (isQuadrant(chamber)) {
29 // only in St12 can we get a dcs alias that is plane-dependent
30 // and only if the alias is for FEE LV
31 auto type = aliasToMeasurementType(alias);
32 if (type != MeasurementType::LV_V_FEE_ANALOG &&
33 type != MeasurementType::LV_V_FEE_DIGITAL) {
34 return Plane::Both;
35 }
36 auto number = aliasToNumber(alias);
37 auto side = aliasToSide(alias);
38 if (side == Side::Left) {
39 switch (number) {
40 case 1:
41 case 4:
42 return Plane::Bending;
43 case 2:
44 case 3:
45 return Plane::NonBending;
46 default:
47 throw std::invalid_argument(fmt::format("invalid number {} in alias={}", number, alias));
48 };
49 } else {
50 switch (number) {
51 case 2:
52 case 3:
53 return Plane::Bending;
54 case 1:
55 case 4:
56 return Plane::NonBending;
57 default:
58 throw std::invalid_argument(fmt::format("invalid number {} in alias={}", number, alias));
59 };
60 }
61 }
62 return Plane::Both;
63}
64
65std::string name(Plane p)
66{
67 switch (p) {
68 case Plane::Bending:
69 return "B";
70 case Plane::NonBending:
71 return "NB";
72 case Plane::Both:
73 return "";
74 }
75 return "INVALID";
76}
77} // namespace o2::mch::dcs
uint32_t side
Definition RawData.h:0
GLuint const GLchar * name
Definition glcorearb.h:781
GLint GLint GLsizei GLint GLenum GLenum type
Definition glcorearb.h:275
MeasurementType aliasToMeasurementType(std::string_view alias)
Side aliasToSide(std::string_view alias)
Definition Side.cxx:22
Chamber aliasToChamber(std::string_view alias)
Definition Chamber.cxx:100
std::optional< Chamber > chamber(int chamberId)
Definition Chamber.cxx:17
int aliasToNumber(std::string_view dcsAlias)
Definition Number.cxx:30
Plane aliasToPlane(std::string_view alias)
Definition Plane.cxx:25
bool isQuadrant(Chamber chamber)
Definition Chamber.cxx:44