Project
Loading...
Searching...
No Matches
Mapper.h
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#ifndef O2_MCH_RAW_ELECMAP_MAPPER_H
13#define O2_MCH_RAW_ELECMAP_MAPPER_H
14
18#include <array>
19#include <cstdint>
20#include <fmt/format.h>
21#include <functional>
22#include <gsl/span>
23#include <optional>
24#include <set>
25#include <stdexcept>
26#include <string>
27#include <vector>
28
29namespace o2::mch::raw
30{
31
38
42using Elec2DetMapper = std::function<std::optional<DsDetId>(DsElecId)>;
43template <typename T>
44Elec2DetMapper createElec2DetMapper(uint64_t timestamp = 0);
45
47using Det2ElecMapper = std::function<std::optional<DsElecId>(DsDetId id)>;
48template <typename T>
50
52using FeeLink2SolarMapper = std::function<std::optional<uint16_t>(FeeLinkId id)>;
53template <typename T>
55
57using Solar2FeeLinkMapper = std::function<std::optional<FeeLinkId>(uint16_t solarId)>;
58template <typename T>
61
63template <typename T>
64std::set<uint16_t> getSolarUIDs(int deid);
65
67template <typename T>
68std::set<uint16_t> getSolarUIDs();
69
71template <typename T>
72std::set<uint16_t> getSolarUIDsPerFeeId(uint16_t feeId);
73
75template <typename T>
76std::set<DsDetId> getDualSampas(uint16_t solarId);
77
79template <typename T>
80std::set<DsDetId> getDualSampasPerFeeId(uint16_t feeId);
81
85
91 static std::string sCruMap;
92 static std::string sFecMap;
93};
95
98template <typename T>
99std::set<DsElecId> getAllDs();
100
101extern std::array<int, 2> deIdsOfCH1R;
102extern std::array<int, 2> deIdsOfCH1L;
103extern std::array<int, 2> deIdsOfCH2R;
104extern std::array<int, 2> deIdsOfCH2L;
105extern std::array<int, 2> deIdsOfCH3R;
106extern std::array<int, 2> deIdsOfCH3L;
107extern std::array<int, 2> deIdsOfCH4R;
108extern std::array<int, 2> deIdsOfCH4L;
109extern std::array<int, 9> deIdsOfCH5R;
110extern std::array<int, 9> deIdsOfCH5L;
111extern std::array<int, 9> deIdsOfCH6R;
112extern std::array<int, 9> deIdsOfCH6L;
113extern std::array<int, 13> deIdsOfCH7R;
114extern std::array<int, 13> deIdsOfCH7L;
115extern std::array<int, 13> deIdsOfCH8R;
116extern std::array<int, 13> deIdsOfCH8L;
117extern std::array<int, 13> deIdsOfCH9R;
118extern std::array<int, 13> deIdsOfCH9L;
119extern std::array<int, 13> deIdsOfCH10R;
120extern std::array<int, 13> deIdsOfCH10L;
121
122// test whether all solars have a corresponding FeeLinkId
123// and the reverse as well.
124// @returns vector of error messages. If empty the check is ok
125template <typename T>
126std::vector<std::string> solar2FeeLinkConsistencyCheck();
127
129template <typename T>
130std::optional<uint16_t> solarIndex2Id(uint16_t solarIndex);
131
133template <typename T>
134std::optional<uint16_t> solarId2Index(uint16_t solarId);
135
136} // namespace o2::mch::raw
137
138#endif
A DsDetId is just a pair (detection element id, dual sampa id)
Definition DsDetId.h:22
std::optional< uint16_t > solarIndex2Id(uint16_t solarIndex)
std::array< int, 2 > deIdsOfCH1L
Definition Mapper.cxx:18
std::array< int, 9 > deIdsOfCH5L
Definition Mapper.cxx:26
std::array< int, 2 > deIdsOfCH2L
Definition Mapper.cxx:20
std::array< int, 9 > deIdsOfCH6R
Definition Mapper.cxx:27
std::array< int, 2 > deIdsOfCH3R
Definition Mapper.cxx:21
std::array< int, 2 > deIdsOfCH1R
Definition Mapper.cxx:17
std::array< int, 9 > deIdsOfCH5R
Definition Mapper.cxx:25
std::function< std::optional< DsDetId >(DsElecId)> Elec2DetMapper
Definition Mapper.h:42
std::array< int, 13 > deIdsOfCH7R
Definition Mapper.cxx:29
std::array< int, 13 > deIdsOfCH8R
Definition Mapper.cxx:31
std::optional< uint16_t > solarId2Index(uint16_t solarId)
std::array< int, 9 > deIdsOfCH6L
Definition Mapper.cxx:28
std::set< DsElecId > getAllDs()
std::array< int, 2 > deIdsOfCH3L
Definition Mapper.cxx:22
Solar2FeeLinkMapper createSolar2FeeLinkMapper()
std::set< DsDetId > getDualSampasPerFeeId(uint16_t feeId)
List of Dual Sampa handled by a given FeeId.
std::array< int, 2 > deIdsOfCH2R
Definition Mapper.cxx:19
std::vector< std::string > solar2FeeLinkConsistencyCheck()
std::set< DsDetId > getDualSampas(uint16_t solarId)
List of Dual Sampa handled by a given Solar.
FeeLink2SolarMapper createFeeLink2SolarMapper()
Det2ElecMapper createDet2ElecMapper()
std::function< std::optional< DsElecId >(DsDetId id)> Det2ElecMapper
From (deId,dsId) to (solarId,groupId,index)
Definition Mapper.h:47
std::array< int, 13 > deIdsOfCH8L
Definition Mapper.cxx:32
Elec2DetMapper createElec2DetMapper(uint64_t timestamp=0)
std::array< int, 13 > deIdsOfCH10L
Definition Mapper.cxx:36
std::array< int, 13 > deIdsOfCH9L
Definition Mapper.cxx:34
std::set< uint16_t > getSolarUIDsPerFeeId(uint16_t feeId)
List of Solar Unique Ids for a given FeeId.
std::array< int, 13 > deIdsOfCH10R
Definition Mapper.cxx:35
std::array< int, 2 > deIdsOfCH4L
Definition Mapper.cxx:24
std::function< std::optional< uint16_t >(FeeLinkId id)> FeeLink2SolarMapper
From (feeId,linkId) to solarId.
Definition Mapper.h:52
std::array< int, 13 > deIdsOfCH9R
Definition Mapper.cxx:33
std::function< std::optional< FeeLinkId >(uint16_t solarId)> Solar2FeeLinkMapper
From solarId to (feeId,linkId)
Definition Mapper.h:57
std::array< int, 2 > deIdsOfCH4R
Definition Mapper.cxx:23
std::array< int, 13 > deIdsOfCH7L
Definition Mapper.cxx:30
std::set< uint16_t > getSolarUIDs()
List of Solar Unique Ids for all MCH.