Project
Loading...
Searching...
No Matches
CathodeSegmentationImpl3.h
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
15#ifndef O2_MCH_MAPPING_IMPL3_CATHODESEGMENTATION_H
16#define O2_MCH_MAPPING_IMPL3_CATHODESEGMENTATION_H
17
18#include "PadGroup.h"
19#include "PadGroupType.h"
20#include <vector>
21#include <set>
22#include <ostream>
23#include <boost/geometry/index/rtree.hpp>
24
25namespace o2
26{
27namespace mch
28{
29namespace mapping
30{
31namespace impl3
32{
33
35{
36 public:
37 static constexpr int InvalidCatPadIndex{-1};
38
39 using Point = boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>;
40 using Box = boost::geometry::model::box<Point>;
41 using Value = std::pair<Box, unsigned>;
42
43 CathodeSegmentation(int segType, bool isBendingPlane, std::vector<PadGroup> padGroups,
44 std::vector<PadGroupType> padGroupTypes, std::vector<std::pair<float, float>> padSizes);
45
47 std::vector<int> getCatPadIndexs(int dualSampaIds) const;
48
50 std::vector<int> getCatPadIndexs(double xmin, double ymin, double xmax, double ymax) const;
51
53 std::vector<int> getNeighbouringCatPadIndexs(int catPadIndex) const;
54
55 std::set<int> dualSampaIds() const { return mDualSampaIds; }
56
57 int findPadByPosition(double x, double y) const;
58
59 int findPadByFEE(int dualSampaId, int dualSampaChannel) const;
60
61 bool hasPadByPosition(double x, double y) const { return findPadByPosition(x, y) != InvalidCatPadIndex; }
62
63 bool hasPadByFEE(int dualSampaId, int dualSampaChannel) const
64 {
65 return findPadByFEE(dualSampaId, dualSampaChannel) != InvalidCatPadIndex;
66 }
67
68 friend std::ostream& operator<<(std::ostream& os, const CathodeSegmentation& seg);
69
70 double padPositionX(int catPadIndex) const;
71
72 double padPositionY(int catPadIndex) const;
73
74 double padSizeX(int catPadIndex) const;
75
76 double padSizeY(int catPadIndex) const;
77
78 int padDualSampaId(int catPadIndex) const;
79
80 int padDualSampaChannel(int catPadIndex) const;
81
82 bool isValid(int catPadIndex) const;
83
84 private:
85 int dualSampaIndex(int dualSampaId) const;
86
87 void fillRtree();
88
89 std::ostream& showPad(std::ostream& out, int index) const;
90
91 const PadGroup& padGroup(int catPadIndex) const;
92
93 const PadGroupType& padGroupType(int catPadIndex) const;
94
95 double squaredDistance(int catPadIndex, double x, double y) const;
96
97 private:
98 int mSegType;
99 bool mIsBendingPlane;
100 std::vector<PadGroup> mPadGroups;
101 std::set<int> mDualSampaIds;
102 std::vector<PadGroupType> mPadGroupTypes;
103 std::vector<std::pair<float, float>> mPadSizes;
104 boost::geometry::index::rtree<Value, boost::geometry::index::quadratic<8>> mRtree;
105 std::vector<int> mCatPadIndex2PadGroupIndex;
106 std::vector<int> mCatPadIndex2PadGroupTypeFastIndex;
107 std::vector<int> mPadGroupIndex2CatPadIndexIndex;
108};
109
111} // namespace impl3
112} // namespace mapping
113} // namespace mch
114} // namespace o2
115#endif
bool isBendingPlane
o2::mch::mapping::CathodeSegmentation seg
A CathodeSegmentation lets you find pads on a given plane (cathode) of a detection element and then i...
int findPadByFEE(int dualSampaId, int dualSampaChannel) const
std::vector< int > getCatPadIndexs(int dualSampaIds) const
Return the list of catPadIndexs for the pads of the given dual sampa.
std::vector< int > getNeighbouringCatPadIndexs(int catPadIndex) const
Return the list of catPadIndexs of the pads which are neighbours to catPadIndex.
bool hasPadByFEE(int dualSampaId, int dualSampaChannel) const
boost::geometry::model::point< double, 2, boost::geometry::cs::cartesian > Point
friend std::ostream & operator<<(std::ostream &os, const CathodeSegmentation &seg)
GLint GLenum GLint x
Definition glcorearb.h:403
GLuint index
Definition glcorearb.h:781
CathodeSegmentation * createCathodeSegmentation(int detElemId, bool isBendingPlane)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...