Project
Loading...
Searching...
No Matches
CathodeSegmentationContours.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
18using namespace o2::mch::contour;
19
20namespace o2
21{
22namespace mch
23{
24namespace mapping
25{
26
28
30{
31 std::vector<Polygon<double>> polygons;
32
33 for (auto& contour : getDualSampaContours(seg)) {
34 for (auto& p : contour.getPolygons()) {
35 polygons.push_back(p);
36 }
37 }
38
39 return o2::mch::contour::createContour(polygons);
40}
41
42std::vector<std::vector<int>> getPadChannels(const CathodeSegmentation& seg)
43{
44 std::vector<std::vector<int>> dualSampaPads;
45
46 for (auto i = 0; i < seg.nofDualSampas(); ++i) {
47 std::vector<int> pads;
48 seg.forEachPadInDualSampa(seg.dualSampaId(i), [&pads, &seg](int catPadIndex) {
49 double x = seg.padPositionX(catPadIndex);
50 double y = seg.padPositionY(catPadIndex);
51 double dx = seg.padSizeX(catPadIndex) / 2.0;
52 double dy = seg.padSizeY(catPadIndex) / 2.0;
53
54 pads.emplace_back(seg.padDualSampaChannel(catPadIndex));
55 });
56 dualSampaPads.push_back(pads);
57 }
58
59 return dualSampaPads;
60}
61
62std::vector<Polygon<double>> getPadPolygons(const CathodeSegmentation& seg, int dualSampaId)
63{
64 std::vector<Polygon<double>> pads;
65 seg.forEachPadInDualSampa(dualSampaId, [&pads, &seg](int catPadIndex) {
66 double x = seg.padPositionX(catPadIndex);
67 double y = seg.padPositionY(catPadIndex);
68 double dx = seg.padSizeX(catPadIndex) / 2.0;
69 double dy = seg.padSizeY(catPadIndex) / 2.0;
70
71 pads.emplace_back(Polygon<double>{
72 {x - dx, y - dy}, {x + dx, y - dy}, {x + dx, y + dy}, {x - dx, y + dy}, {x - dx, y - dy}});
73 });
74 return pads;
75}
76
77std::vector<std::vector<Polygon<double>>> getPadPolygons(const CathodeSegmentation& seg)
78{
79 std::vector<std::vector<Polygon<double>>> dualSampaPads;
80
81 for (auto i = 0; i < seg.nofDualSampas(); ++i) {
82 dualSampaPads.push_back(getPadPolygons(seg, seg.dualSampaId(i)));
83 }
84
85 return dualSampaPads;
86}
87
89{
90 auto padPolygons = getPadPolygons(seg, dualSampaId);
91 return o2::mch::contour::createContour(padPolygons);
92}
93
94std::vector<o2::mch::contour::Contour<double>> getDualSampaContours(const CathodeSegmentation& seg)
95{
96 std::vector<o2::mch::contour::Contour<double>> contours;
97 for (auto i = 0; i < seg.nofDualSampas(); ++i) {
99 }
100 return contours;
101}
102
103} // namespace mapping
104} // namespace mch
105} // namespace o2
o2::mch::mapping::CathodeSegmentation seg
int32_t i
A CathodeSegmentation lets you find pads on a given plane (cathode) of a detection element and then i...
int dualSampaId(int dualSampaIndex) const
double padSizeY(int catPadIndex) const
double padSizeX(int catPadIndex) const
void forEachPadInDualSampa(int dualSampaId, CALLABLE &&func) const
double padPositionY(int catPadIndex) const
double padPositionX(int catPadIndex) const
GLint GLenum GLint x
Definition glcorearb.h:403
Contour< T > createContour(const std::vector< Polygon< T > > &polygons)
std::vector< o2::mch::contour::Contour< double > > getDualSampaContours(const CathodeSegmentation &seg)
o2::mch::contour::BBox< double > getBBox(const CathodeSegmentation &seg)
o2::mch::contour::Contour< double > getDualSampaContour(const CathodeSegmentation &seg, int dualSampaId)
std::vector< std::vector< o2::mch::contour::Polygon< double > > > getPadPolygons(const CathodeSegmentation &seg)
std::vector< std::vector< int > > getPadChannels(const CathodeSegmentation &seg)
o2::mch::contour::Contour< double > getEnvelop(const CathodeSegmentation &seg)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...