Project
Loading...
Searching...
No Matches
Quadrant.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 "Quadrant.h"
13
14#include "LV.h"
17#include "MCHConditions/Side.h"
18#include <array>
19#include <fmt/core.h>
20#include <set>
21
23{
24Cathode lvAliasToCathode(std::string_view alias)
25{
26 const auto chamber = aliasToChamber(alias);
27 const auto side = aliasToSide(alias);
28 const auto number = aliasToNumber(alias);
29 int base = (1 + toInt(chamber)) * 100;
30 if (isStation1(chamber)) {
31 // Station 1
32 if (side == Side::Left) {
33 switch (number) {
34 case 4:
35 return {Cathode{base + 1, Plane::NonBending}};
36 case 2:
37 return {Cathode{base + 1, Plane::Bending}};
38 case 3:
39 return {Cathode{base + 2, Plane::Bending}};
40 case 1:
41 return {Cathode{base + 2, Plane::NonBending}};
42 default:
43 throw std::invalid_argument(fmt::format("wrong alias {}", alias));
44 }
45 } else {
46 switch (number) {
47 case 4:
48 return {Cathode{base + 0, Plane::Bending}};
49 case 2:
50 return {Cathode{base + 0, Plane::NonBending}};
51 case 3:
52 return {Cathode{base + 3, Plane::NonBending}};
53 case 1:
54 return {Cathode{base + 3, Plane::Bending}};
55 default:
56 throw std::invalid_argument(fmt::format("wrong alias {}", alias));
57 }
58 }
59 } else if (isStation2(chamber)) {
60 // Station 2
61 if (side == Side::Left) {
62 switch (number) {
63 case 2:
64 return {Cathode{base + 1, Plane::NonBending}};
65 case 1:
66 return {Cathode{base + 1, Plane::Bending}};
67 case 4:
68 return {Cathode{base + 2, Plane::Bending}};
69 case 3:
70 return {Cathode{base + 2, Plane::NonBending}};
71 default:
72 throw std::invalid_argument(fmt::format("wrong alias {}", alias));
73 }
74 } else {
75 switch (number) {
76 case 2:
77 return {Cathode{base + 0, Plane::Bending}};
78 case 1:
79 return {Cathode{base + 0, Plane::NonBending}};
80 case 4:
81 return {Cathode{base + 3, Plane::NonBending}};
82 case 3:
83 return {Cathode{base + 3, Plane::Bending}};
84 default:
85 throw std::invalid_argument(fmt::format("wrong alias {}", alias));
86 }
87 }
88 } else {
89 throw std::invalid_argument(fmt::format("wrong alias {} (expecting station12 one", alias));
90 }
91}
92
93std::set<DsIndex> solarAliasToDsIndices(std::string_view alias)
94{
100 // lvid.type = dcs::MeasurementType::LV_V_FEE_ANALOG;
101 static const std::array<int, 4> crateToGroupSt1 = {4, 2, 3, 1};
102 static const std::array<int, 4> crateToGroupSt2 = {2, 1, 4, 3};
103
104 auto chamber = aliasToChamber(alias);
105 auto solarCrate = aliasToNumber(alias);
106
107 int group;
108 if (isStation1(chamber)) {
109 group = crateToGroupSt1[solarCrate - 1];
110 } else {
111 group = crateToGroupSt2[solarCrate - 1];
112 }
113
114 auto side = aliasToSide(alias);
115 auto lvAlias = fmt::format("MchHvLv{}/Chamber{}{}/Group{}an",
116 name(side),
117 toInt(chamber),
118 name(side),
119 group);
120
121 return lvAliasToDsIndices(lvAlias);
122}
123} // namespace o2::mch::dcs::quadrant
uint32_t side
Definition RawData.h:0
GLuint const GLchar * name
Definition glcorearb.h:781
GLboolean GLuint group
Definition glcorearb.h:3991
std::set< DsIndex > solarAliasToDsIndices(std::string_view alias)
Definition Quadrant.cxx:93
Cathode lvAliasToCathode(std::string_view alias)
Definition Quadrant.cxx:24
int toInt(Chamber chamber)
Definition Chamber.cxx:68
bool isStation1(Chamber chamber)
Definition Chamber.cxx:58
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
std::set< DsIndex > lvAliasToDsIndices(std::string_view alias)
Definition LV.cxx:35
bool isStation2(Chamber chamber)
Definition Chamber.cxx:63