Belle II Software development
PixelPositions.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10#include <vector>
11
12namespace Belle2 {
17 namespace TOP {
18
23
24 public:
25
29 struct PixelData {
30 double xc = 0;
31 double yc = 0;
32 double Dx = 0;
33 double Dy = 0;
34 int ID = 0;
35 unsigned pmtType = 0;
41 {}
42
50 PixelData(double x, double y, double a, double b):
51 xc(x), yc(y), Dx(a), Dy(b)
52 {}
53 };
54
55
60 explicit PixelPositions(int moduleID);
61
66 int getModuleID() const {return m_moduleID;}
67
72 unsigned getNumPixels() const {return m_pixels.size();}
73
78 unsigned getNumPixelRows() const {return m_NRows;}
79
84 unsigned getNumPixelColumns() const {return m_NColumns;}
85
91 const PixelData& get(int pixelID) const;
92
97 const std::vector<PixelData>& getPixels() const {return m_pixels;}
98
106 int pixelID(unsigned row, unsigned col) const {return col + row * m_NColumns + 1;}
107
108 private:
109
110 int m_moduleID = 0;
111 unsigned m_NRows = 0;
112 unsigned m_NColumns = 0;
113 std::vector<PixelData> m_pixels;
116 };
117
118 //--- inline functions ------------------------------------------------------------
119
120 inline const PixelPositions::PixelData& PixelPositions::get(int pixelID) const
121 {
122 unsigned k = pixelID - 1;
123 if (k < m_pixels.size()) return m_pixels[k];
124 return m_invalid;
125 }
126
127 } // namespace TOP
129} // namespace Belle2
Pixel positions and dimensions in module local frame.
const std::vector< PixelData > & getPixels() const
Returns pixel data of entire module.
std::vector< PixelData > m_pixels
pixel positions and sizes, index = pixelID - 1
int pixelID(unsigned row, unsigned col) const
Transforms pixel row and column to pixel ID Note: for convenience pixel row and column numbering star...
unsigned getNumPixelRows() const
Returns the number of pixel rows.
unsigned m_NColumns
number of pixel columns
int getModuleID() const
Returns slot ID.
unsigned getNumPixels() const
Returns number of pixels.
unsigned getNumPixelColumns() const
Returns the number of pixel columns.
PixelData m_invalid
invalid pixel data
unsigned m_NRows
number of pixel rows
const PixelData & get(int pixelID) const
Returns pixel data for given pixelID.
Abstract base class for different kinds of events.
position and size of a pixel
double yc
position of center in y
PixelData(double x, double y, double a, double b)
almost full constructor
double xc
position of center in x
unsigned pmtType
PMT type (see TOPPmtObsoleteData::EType for the defined types)