Project
Loading...
Searching...
No Matches
Mapper.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
13
14#include "HV.h"
15#include "LV.h"
22#include "Quadrant.h"
23#include "Slat.h"
24#include <limits>
25#include <map>
26#include <vector>
27
28namespace o2::mch::dcs
29{
30
31std::set<DsIndex> solarAliasToDsIndices(std::string_view alias)
32{
33 const auto chamber = aliasToChamber(alias);
34 if (dcs::isQuadrant(chamber)) {
35 return dcs::quadrant::solarAliasToDsIndices(alias);
36 } else {
37 return dcs::slat::solarAliasToDsIndices(alias);
38 }
39}
40
41std::set<DsIndex> aliasToDsIndices(std::string_view alias)
42{
43 auto m = aliasToMeasurementType(alias);
44 switch (m) {
45 case dcs::MeasurementType::HV_I:
46 case dcs::MeasurementType::HV_V:
47 return hvAliasToDsIndices(alias);
48 case dcs::MeasurementType::LV_V_FEE_ANALOG:
49 case dcs::MeasurementType::LV_V_FEE_DIGITAL:
50 return lvAliasToDsIndices(alias);
51 case dcs::MeasurementType::LV_V_SOLAR:
52 return solarAliasToDsIndices(alias);
53 default:
54 return {};
55 }
56}
57
58std::set<DsIndex> getDsIndices(const std::set<dcs::Cathode>& cathodes)
59{
60 std::set<DsIndex> dsIndices;
61 for (const auto& cathode : cathodes) {
62 auto deId = cathode.deId;
63 if (!constants::isValidDetElemId(deId)) {
64 continue;
65 }
66 bool bending = cathode.plane == dcs::Plane::Bending;
67 bool checkPlane = cathode.plane != dcs::Plane::Both;
68 if (checkPlane) {
70 const auto& plane = bending ? seg.bending() : seg.nonBending();
71 for (auto i = 0; i < plane.nofDualSampas(); i++) {
72 auto index = o2::mch::getDsIndex({deId, plane.dualSampaId(i)});
73 dsIndices.emplace(index);
74 }
75 } else {
77 seg.forEachDualSampa([&dsIndices, deId](int dualSampaId) {
78 auto index = o2::mch::getDsIndex({deId, dualSampaId});
79 dsIndices.emplace(index);
80 });
81 }
82 }
83 return dsIndices;
84}
85
86std::set<DsIndex> getDsIndices(dcs::Chamber ch, dcs::Plane plane)
87{
88 std::set<dcs::Cathode> cathodes;
89 for (auto deid : constants::deIdsForAllMCH) {
90 if (deid / 100 - 1 == toInt(ch)) {
91 Cathode cathode{deid, plane};
92 cathodes.insert(cathode);
93 }
94 }
95 return getDsIndices(cathodes);
96}
97
98std::set<DsIndex> getDsIndices(const std::set<int>& solarIds)
99{
100 std::set<o2::mch::DsIndex> dualSampas;
101 for (const auto& solarId : solarIds) {
102 auto dsDetIds = o2::mch::raw::getDualSampas<o2::mch::raw::ElectronicMapperGenerated>(solarId);
103 for (const auto& dsDetId : dsDetIds) {
104 auto index = o2::mch::getDsIndex(dsDetId);
105 dualSampas.emplace(index);
106 }
107 }
108 return dualSampas;
109}
110
111} // namespace o2::mch::dcs
o2::mch::mapping::CathodeSegmentation seg
int32_t i
void forEachDualSampa(std::function< void(int dualSampaId)> func) const
Loop over dual sampas of this detection element.
A Segmentation lets you find pads of a detection element and then inspect those pads.
const GLfloat * m
Definition glcorearb.h:4066
GLuint index
Definition glcorearb.h:781
std::set< DsIndex > aliasToDsIndices(std::string_view alias)
Definition Mapper.cxx:41
MeasurementType aliasToMeasurementType(std::string_view alias)
int toInt(Chamber chamber)
Definition Chamber.cxx:68
Chamber aliasToChamber(std::string_view alias)
Definition Chamber.cxx:100
std::set< DsIndex > hvAliasToDsIndices(std::string_view alias)
Definition HV.cxx:39
std::optional< Chamber > chamber(int chamberId)
Definition Chamber.cxx:17
std::set< DsIndex > getDsIndices(const std::set< dcs::Cathode > &cathodes)
Definition Mapper.cxx:58
std::set< DsIndex > solarAliasToDsIndices(std::string_view alias)
Definition Mapper.cxx:31
std::set< DsIndex > lvAliasToDsIndices(std::string_view alias)
Definition LV.cxx:35
O2MCHMAPPINGIMPL3_EXPORT const Segmentation & segmentation(int detElemId)
DsIndex getDsIndex(const o2::mch::raw::DsDetId &dsDetId)
Definition DsIndex.cxx:79