Project
Loading...
Searching...
No Matches
CreateSegmentation.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 <map>
13#include <fmt/format.h>
15#include "o2mchmappingimpl4_export.h"
16namespace
17{
18const std::map<int, int> deId2SameType{
19 {100, 100},
20 {101, 100},
21 {102, 100},
22 {103, 100},
23 {200, 100},
24 {201, 100},
25 {202, 100},
26 {203, 100},
27 {300, 300},
28 {301, 300},
29 {302, 300},
30 {303, 300},
31 {400, 300},
32 {401, 300},
33 {402, 300},
34 {403, 300},
35 {500, 500},
36 {501, 501},
37 {502, 502},
38 {503, 503},
39 {504, 504},
40 {505, 504},
41 {506, 503},
42 {507, 502},
43 {508, 501},
44 {509, 500},
45 {510, 501},
46 {511, 502},
47 {512, 503},
48 {513, 504},
49 {514, 504},
50 {515, 503},
51 {516, 502},
52 {517, 501},
53 {600, 600},
54 {601, 601},
55 {602, 602},
56 {603, 503},
57 {604, 504},
58 {605, 504},
59 {606, 503},
60 {607, 602},
61 {608, 601},
62 {609, 600},
63 {610, 601},
64 {611, 602},
65 {612, 503},
66 {613, 504},
67 {614, 504},
68 {615, 503},
69 {616, 602},
70 {617, 601},
71 {700, 700},
72 {701, 701},
73 {702, 702},
74 {703, 703},
75 {704, 704},
76 {705, 705},
77 {706, 706},
78 {707, 706},
79 {708, 705},
80 {709, 704},
81 {710, 703},
82 {711, 702},
83 {712, 701},
84 {713, 700},
85 {714, 701},
86 {715, 702},
87 {716, 703},
88 {717, 704},
89 {718, 705},
90 {719, 706},
91 {720, 706},
92 {721, 705},
93 {722, 704},
94 {723, 703},
95 {724, 702},
96 {725, 701},
97 {800, 700},
98 {801, 701},
99 {802, 702},
100 {803, 703},
101 {804, 704},
102 {805, 705},
103 {806, 706},
104 {807, 706},
105 {808, 705},
106 {809, 704},
107 {810, 703},
108 {811, 702},
109 {812, 701},
110 {813, 700},
111 {814, 701},
112 {815, 702},
113 {816, 703},
114 {817, 704},
115 {818, 705},
116 {819, 706},
117 {820, 706},
118 {821, 705},
119 {822, 704},
120 {823, 703},
121 {824, 702},
122 {825, 701},
123 {900, 700},
124 {901, 701},
125 {902, 902},
126 {903, 903},
127 {904, 904},
128 {905, 905},
129 {906, 705},
130 {907, 705},
131 {908, 905},
132 {909, 904},
133 {910, 903},
134 {911, 902},
135 {912, 701},
136 {913, 700},
137 {914, 701},
138 {915, 902},
139 {916, 903},
140 {917, 904},
141 {918, 905},
142 {919, 705},
143 {920, 705},
144 {921, 905},
145 {922, 904},
146 {923, 903},
147 {924, 902},
148 {925, 701},
149 {1000, 700},
150 {1001, 701},
151 {1002, 902},
152 {1003, 903},
153 {1004, 904},
154 {1005, 905},
155 {1006, 705},
156 {1007, 705},
157 {1008, 905},
158 {1009, 904},
159 {1010, 903},
160 {1011, 902},
161 {1012, 701},
162 {1013, 700},
163 {1014, 701},
164 {1015, 902},
165 {1016, 903},
166 {1017, 904},
167 {1018, 905},
168 {1019, 705},
169 {1020, 705},
170 {1021, 905},
171 {1022, 904},
172 {1023, 903},
173 {1024, 902},
174 {1025, 701}};
175
176} // namespace
177
178namespace
179{
180std::map<int, o2::mch::mapping::Segmentation*> createSegmentations()
181{
182 std::map<int, o2::mch::mapping::Segmentation*> segs;
183 for (auto deid : {100,
184 300,
185 500,
186 501,
187 502,
188 503,
189 504,
190 600,
191 601,
192 602,
193 700,
194 701,
195 702,
196 703,
197 704,
198 705,
199 706,
200 902,
201 903,
202 904,
203 905}) {
204 segs.emplace(deid, new o2::mch::mapping::Segmentation(deid));
205 };
206 return segs;
207} // namespace
208
209} // namespace
210
211namespace o2::mch::mapping
212{
213
214O2MCHMAPPINGIMPL4_EXPORT
215const Segmentation& segmentation(int detElemId)
216{
217 static auto segs = createSegmentations();
218 auto refDeForThatSegmentation = deId2SameType.find(detElemId);
219 return *(segs[refDeForThatSegmentation->second]);
220}
221} // namespace o2::mch::mapping
A Segmentation lets you find pads of a detection element and then inspect those pads.
O2MCHMAPPINGIMPL3_EXPORT const Segmentation & segmentation(int detElemId)