Project
Loading...
Searching...
No Matches
CathodeSegmentationImpl4.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_Impl4_CATHODESEGMENTATION_H
16#define O2_MCH_MAPPING_Impl4_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#include <map>
25
26namespace o2
27{
28namespace mch
29{
30namespace mapping
31{
32namespace impl4
33{
34
36{
37 public:
38 static constexpr int InvalidCatPadIndex{-1};
39
40 using Point =
41 boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>;
42 using Box = boost::geometry::model::box<Point>;
43 using Value = std::pair<Box, unsigned>;
44
45 CathodeSegmentation(int segType, bool isBendingPlane,
46 std::vector<PadGroup> padGroups,
47 std::vector<PadGroupType> padGroupTypes,
48 std::vector<std::pair<float, float>> padSizes);
49
51 std::vector<int> getCatPadIndices(int dualSampaId) const;
52
55 std::vector<int> getCatPadIndices(double xmin, double ymin, double xmax,
56 double ymax) const;
57
60 std::vector<int> getNeighbouringCatPadIndices(int catPadIndex) const;
61
62 std::set<int> dualSampaIds() const { return mDualSampaIds; }
63
64 int findPadByPosition(double x, double y) const;
65
66 int findPadByFEE(int dualSampaId, int dualSampaChannel) const;
67
68 bool hasPadByPosition(double x, double y) const
69 {
71 }
72
73 bool hasPadByFEE(int dualSampaId, int dualSampaChannel) const
74 {
75 return findPadByFEE(dualSampaId, dualSampaChannel) != InvalidCatPadIndex;
76 }
77
78 friend std::ostream& operator<<(std::ostream& os,
80
81 double padPositionX(int catPadIndex) const;
82
83 double padPositionY(int catPadIndex) const;
84
85 double padSizeX(int catPadIndex) const;
86
87 double padSizeY(int catPadIndex) const;
88
89 int padDualSampaId(int catPadIndex) const;
90
91 int padDualSampaChannel(int catPadIndex) const;
92
93 bool isValid(int catPadIndex) const;
94
95 private:
96 int dualSampaIndex(int dualSampaId) const;
97
98 void fillRtree();
99
100 std::ostream& showPad(std::ostream& out, int index) const;
101
102 const PadGroup& padGroup(int catPadIndex) const;
103
104 const PadGroupType& padGroupType(int catPadIndex) const;
105
106 double squaredDistance(int catPadIndex, double x, double y) const;
107
108 std::vector<int> catPadIndices(int dualSampaId) const;
109
110 private:
111 int mSegType;
112 bool mIsBendingPlane;
113 std::vector<PadGroup> mPadGroups;
114 std::set<int> mDualSampaIds;
115 std::vector<PadGroupType> mPadGroupTypes;
116 std::vector<std::pair<float, float>> mPadSizes;
117 boost::geometry::index::rtree<Value, boost::geometry::index::quadratic<8>>
118 mRtree;
119 std::vector<int> mCatPadIndex2PadGroupIndex;
120 std::vector<int> mCatPadIndex2PadGroupTypeFastIndex;
121 std::vector<int> mPadGroupIndex2CatPadIndexIndex;
122 std::map<int, std::vector<int>> mDualSampaId2CatPadIndices;
123};
124
126 bool isBendingPlane);
127} // namespace impl4
128} // namespace mapping
129} // namespace mch
130} // namespace o2
131#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 > getNeighbouringCatPadIndices(int catPadIndex) const
boost::geometry::model::point< double, 2, boost::geometry::cs::cartesian > Point
bool hasPadByFEE(int dualSampaId, int dualSampaChannel) const
std::vector< int > getCatPadIndices(int dualSampaId) const
Return the list of catPadIndices for the pads of the given dual sampa.
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 ...