Project
Loading...
Searching...
No Matches
DetectionElements.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_CONSTANTS_DETECTION_ELEMENTS_H
13#define O2_MCH_CONSTANTS_DETECTION_ELEMENTS_H
14
15#include <algorithm>
16#include <array>
17#include <optional>
18#include <unordered_map>
19
21{
22
23inline std::array<int, 156> deIdsForAllMCH = {
24 100, 101, 102, 103,
25 200, 201, 202, 203,
26 300, 301, 302, 303,
27 400, 401, 402, 403,
28 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517,
29 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617,
30 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725,
31 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825,
32 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925,
33 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025};
34
35inline bool isValidDetElemId(int deId)
36{
37 return std::find(begin(deIdsForAllMCH), end(deIdsForAllMCH), deId) != deIdsForAllMCH.end();
38}
39
41inline std::optional<int> deId2DeIndex(int deId)
42{
44 return std::nullopt;
45 }
46 static const std::unordered_map<int, int> id2ix = {
47 {100, 0},
48 {200, 4},
49 {300, 8},
50 {400, 12},
51 {500, 16},
52 {600, 34},
53 {700, 52},
54 {800, 78},
55 {900, 104},
56 {1000, 130},
57 {1025, 155}};
58
59 int firstDeOfChamber = 100 * (deId / 100);
60 auto firstIndexOfChamber = id2ix.find(firstDeOfChamber);
61 return firstIndexOfChamber->second + (deId - firstDeOfChamber);
62}
63
64} // namespace o2::mch::constants
65
66#endif
GLuint GLuint end
Definition glcorearb.h:469
std::array< int, 156 > deIdsForAllMCH
std::optional< int > deId2DeIndex(int deId)
bool isValidDetElemId(int deId)