Project
Loading...
Searching...
No Matches
CathodeSegmentationCImpl4.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
14
17#include "o2mchmappingimpl4_export.h"
18#include <fstream>
19
20extern "C" {
21
22struct O2MCHMAPPINGIMPL4_EXPORT MchCathodeSegmentation {
27
28 std::unique_ptr<o2::mch::mapping::impl4::CathodeSegmentation> impl;
29};
30
31O2MCHMAPPINGIMPL4_EXPORT MchCathodeSegmentationHandle
38
39O2MCHMAPPINGIMPL4_EXPORT void mchCathodeSegmentationDestruct(
41{
42 delete sh;
43}
44
45O2MCHMAPPINGIMPL4_EXPORT int mchCathodeSegmentationId(
47{
48 // return segHandle->impl->getId();
49 return -1;
50}
51
52O2MCHMAPPINGIMPL4_EXPORT int mchCathodeSegmentationFindPadByPosition(
53 MchCathodeSegmentationHandle segHandle, double x, double y)
54{
55 return segHandle->impl->findPadByPosition(x, y);
56}
57
58O2MCHMAPPINGIMPL4_EXPORT int mchCathodeSegmentationFindPadByFEE(
59 MchCathodeSegmentationHandle segHandle, int dualSampaId, int dualSampaChannel)
60{
61 return segHandle->impl->findPadByFEE(dualSampaId, dualSampaChannel);
62}
63
65 MchDetectionElementHandler handler, void* clientData)
66{
67 for (auto detElemId : {100, 101, 102, 103, 200, 201, 202, 203, 300,
68 301, 302, 303, 400, 401, 402, 403, 500, 501,
69 502, 503, 504, 505, 506, 507, 508, 509, 510,
70 511, 512, 513, 514, 515, 516, 517, 600, 601,
71 602, 603, 604, 605, 606, 607, 608, 609, 610,
72 611, 612, 613, 614, 615, 616, 617, 700, 701,
73 702, 703, 704, 705, 706, 707, 708, 709, 710,
74 711, 712, 713, 714, 715, 716, 717, 718, 719,
75 720, 721, 722, 723, 724, 725, 800, 801, 802,
76 803, 804, 805, 806, 807, 808, 809, 810, 811,
77 812, 813, 814, 815, 816, 817, 818, 819, 820,
78 821, 822, 823, 824, 825, 900, 901, 902, 903,
79 904, 905, 906, 907, 908, 909, 910, 911, 912,
80 913, 914, 915, 916, 917, 918, 919, 920, 921,
81 922, 923, 924, 925, 1000, 1001, 1002, 1003, 1004,
82 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013,
83 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022,
84 1023, 1024, 1025}) {
85 handler(clientData, detElemId);
86 }
87}
88
89O2MCHMAPPINGIMPL4_EXPORT void mchCathodeSegmentationForEachDualSampa(
91 void* clientData)
92{
93 for (auto dualSampaId : segHandle->impl->dualSampaIds()) {
94 handler(clientData, dualSampaId);
95 }
96}
97
98O2MCHMAPPINGIMPL4_EXPORT void
100 MchDetectionElementHandler handler, void* clientData)
101{
102 for (auto detElemId : {100, 300, 500, 501, 502, 503, 504, 600, 601, 602, 700,
103 701, 702, 703, 704, 705, 706, 902, 903, 904, 905}) {
104 handler(clientData, detElemId);
105 }
106}
107
108O2MCHMAPPINGIMPL4_EXPORT int mchCathodeSegmentationIsPadValid(
109 MchCathodeSegmentationHandle segHandle, int catPadIndex)
110{
111 return segHandle->impl->isValid(catPadIndex);
112}
113
115 MchCathodeSegmentationHandle segHandle, int dualSampaId,
116 MchPadHandler handler, void* clientData)
117{
118 for (auto p : segHandle->impl->getCatPadIndices(dualSampaId)) {
119 handler(clientData, p);
120 }
121}
122
123O2MCHMAPPINGIMPL4_EXPORT double mchCathodeSegmentationPadPositionX(
124 MchCathodeSegmentationHandle segHandle, int catPadIndex)
125{
126 return segHandle->impl->padPositionX(catPadIndex);
127}
128
129O2MCHMAPPINGIMPL4_EXPORT double mchCathodeSegmentationPadPositionY(
130 MchCathodeSegmentationHandle segHandle, int catPadIndex)
131{
132 return segHandle->impl->padPositionY(catPadIndex);
133}
134
135O2MCHMAPPINGIMPL4_EXPORT double mchCathodeSegmentationPadSizeX(
136 MchCathodeSegmentationHandle segHandle, int catPadIndex)
137{
138 return segHandle->impl->padSizeX(catPadIndex);
139}
140
141O2MCHMAPPINGIMPL4_EXPORT double mchCathodeSegmentationPadSizeY(
142 MchCathodeSegmentationHandle segHandle, int catPadIndex)
143{
144 return segHandle->impl->padSizeY(catPadIndex);
145}
146
147O2MCHMAPPINGIMPL4_EXPORT int mchCathodeSegmentationPadDualSampaId(
148 MchCathodeSegmentationHandle segHandle, int catPadIndex)
149{
150 return segHandle->impl->padDualSampaId(catPadIndex);
151}
152
153O2MCHMAPPINGIMPL4_EXPORT int mchCathodeSegmentationPadDualSampaChannel(
154 MchCathodeSegmentationHandle segHandle, int catPadIndex)
155{
156 return segHandle->impl->padDualSampaChannel(catPadIndex);
157}
158
159O2MCHMAPPINGIMPL4_EXPORT void mchCathodeSegmentationForEachPadInArea(
160 MchCathodeSegmentationHandle segHandle, double xmin, double ymin, double xmax,
161 double ymax, MchPadHandler handler, void* clientData)
162{
163 for (auto p : segHandle->impl->getCatPadIndices(xmin, ymin, xmax, ymax)) {
164 handler(clientData, p);
165 }
166}
167
169 MchCathodeSegmentationHandle segHandle, int catPadIndex,
170 MchPadHandler handler, void* userData)
171{
172 for (auto p : segHandle->impl->getNeighbouringCatPadIndices(catPadIndex)) {
173 handler(userData, p);
174 }
175}
176} // extern "C"
bool isBendingPlane
o2::mch::mapping::CathodeSegmentation seg
O2MCHMAPPINGIMPL4_EXPORT int mchCathodeSegmentationFindPadByFEE(MchCathodeSegmentationHandle segHandle, int dualSampaId, int dualSampaChannel)
Find the pad connected to the given channel of the given dual sampa.
O2MCHMAPPINGIMPL4_EXPORT void mchCathodeSegmentationDestruct(MchCathodeSegmentationHandle sh)
Delete a segmentation handle.
O2MCHMAPPINGIMPL4_EXPORT double mchCathodeSegmentationPadPositionX(MchCathodeSegmentationHandle segHandle, int catPadIndex)
O2MCHMAPPINGIMPL4_EXPORT void mchCathodeSegmentationForEachPadInArea(MchCathodeSegmentationHandle segHandle, double xmin, double ymin, double xmax, double ymax, MchPadHandler handler, void *clientData)
O2MCHMAPPINGIMPL4_EXPORT double mchCathodeSegmentationPadSizeX(MchCathodeSegmentationHandle segHandle, int catPadIndex)
O2MCHMAPPINGIMPL4_EXPORT int mchCathodeSegmentationPadDualSampaChannel(MchCathodeSegmentationHandle segHandle, int catPadIndex)
O2MCHMAPPINGIMPL4_EXPORT void mchCathodeSegmentationForEachNeighbouringPad(MchCathodeSegmentationHandle segHandle, int catPadIndex, MchPadHandler handler, void *userData)
O2MCHMAPPINGIMPL4_EXPORT double mchCathodeSegmentationPadSizeY(MchCathodeSegmentationHandle segHandle, int catPadIndex)
O2MCHMAPPINGIMPL4_EXPORT int mchCathodeSegmentationFindPadByPosition(MchCathodeSegmentationHandle segHandle, double x, double y)
Find the pad at position (x,y) (in cm).
O2MCHMAPPINGIMPL4_EXPORT double mchCathodeSegmentationPadPositionY(MchCathodeSegmentationHandle segHandle, int catPadIndex)
O2MCHMAPPINGIMPL4_EXPORT int mchCathodeSegmentationId(MchCathodeSegmentationHandle segHandle)
O2MCHMAPPINGIMPL4_EXPORT int mchCathodeSegmentationIsPadValid(MchCathodeSegmentationHandle segHandle, int catPadIndex)
Return > 0 if catPadIndex is a valid one or <= 1 if not.
O2MCHMAPPINGIMPL4_EXPORT void mchCathodeSegmentationForEachDualSampa(MchCathodeSegmentationHandle segHandle, MchDualSampaHandler handler, void *clientData)
O2MCHMAPPINGIMPL4_EXPORT MchCathodeSegmentationHandle mchCathodeSegmentationConstruct(int detElemId, bool isBendingPlane)
Create a handle to a segmentation for a given plane of a detection element.
O2MCHMAPPINGIMPL4_EXPORT void mchCathodeSegmentationForEachPadInDualSampa(MchCathodeSegmentationHandle segHandle, int dualSampaId, MchPadHandler handler, void *clientData)
O2MCHMAPPINGIMPL4_EXPORT void mchCathodeSegmentationForOneDetectionElementOfEachSegmentationType(MchDetectionElementHandler handler, void *clientData)
O2MCHMAPPINGIMPL4_EXPORT int mchCathodeSegmentationPadDualSampaId(MchCathodeSegmentationHandle segHandle, int catPadIndex)
O2MCHMAPPINGIMPL4_EXPORT void mchCathodeSegmentationForEachDetectionElement(MchDetectionElementHandler handler, void *clientData)
void(* MchPadHandler)(void *clientData, int catPadIndex)
void(* MchDualSampaHandler)(void *clientData, int dualSampaId)
void(* MchDetectionElementHandler)(void *clientData, int detElemId)
int32_t i
GLint GLenum GLint x
Definition glcorearb.h:403
CathodeSegmentation * createCathodeSegmentation(int detElemId, bool isBendingPlane)
std::unique_ptr< o2::mch::mapping::impl4::CathodeSegmentation > impl
std::unique_ptr< o2::mch::mapping::impl3::CathodeSegmentation > impl
MchCathodeSegmentation(o2::mch::mapping::impl4::CathodeSegmentation *i)