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