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