Project
Loading...
Searching...
No Matches
Slat.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#include "Slat.h"
17#include <vector>
18
19namespace o2::mch::dcs::slat
20{
21
22std::set<dcs::Cathode> lvAliasToCathode(std::string_view alias)
23{
24 std::vector<int> slats;
25 const auto chamber = aliasToChamber(alias);
26 const auto number = aliasToNumber(alias);
27 const auto side = aliasToSide(alias);
28 if (chamber == Chamber::Ch04 ||
30 switch (number) {
31 case 1:
32 slats.emplace_back(0);
33 slats.emplace_back(1);
34 slats.emplace_back(2);
35 break;
36 case 5:
37 slats.emplace_back(6);
38 slats.emplace_back(7);
39 slats.emplace_back(8);
40 break;
41 default:
42 slats.emplace_back(number + 1);
43 };
44 }
45 if (
50 switch (number) {
51 case 1:
52 slats.emplace_back(0);
53 slats.emplace_back(1);
54 slats.emplace_back(2);
55 slats.emplace_back(3);
56 break;
57 case 7:
58 slats.emplace_back(9);
59 slats.emplace_back(10);
60 slats.emplace_back(11);
61 slats.emplace_back(12);
62 break;
63 default:
64 slats.emplace_back(number + 2);
65 };
66 }
67 std::set<dcs::Cathode> cathodes;
68 for (const auto slat : slats) {
69 int deId = detElemId(chamber, side, slat);
70 cathodes.emplace(dcs::Cathode{deId, dcs::Plane::Bending});
71 cathodes.emplace(dcs::Cathode{deId, dcs::Plane::NonBending});
72 }
73 return cathodes;
74}
75
76std::set<DsIndex> solarAliasToDsIndices(std::string_view alias)
77{
85 int solarCrate = aliasToSolarCrate(alias);
86 static auto solarIds = raw::getSolarUIDs<raw::ElectronicMapperGenerated>();
87 std::set<DsIndex> dsIndices;
88 for (auto solarId : solarIds) {
89 if (solarId / 8 == solarCrate) {
90 auto dsDetIds = raw::getDualSampas<raw::ElectronicMapperGenerated>(solarId);
91 for (auto dsDetId : dsDetIds) {
92 auto index = getDsIndex(dsDetId);
93 dsIndices.emplace(index);
94 }
95 }
96 }
97 return dsIndices;
98}
99} // namespace o2::mch::dcs::slat
uint32_t side
Definition RawData.h:0
GLuint index
Definition glcorearb.h:781
int detElemId(Chamber chamber, Side side, int number)
std::set< dcs::Cathode > lvAliasToCathode(std::string_view alias)
Definition Slat.cxx:22
std::set< DsIndex > solarAliasToDsIndices(std::string_view alias)
Definition Slat.cxx:76
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
int aliasToSolarCrate(std::string_view alias)
DsIndex getDsIndex(const o2::mch::raw::DsDetId &dsDetId)
Definition DsIndex.cxx:79