Belle II Software development
PixelPositions Class Reference

Pixel positions and dimensions in module local frame. More...

#include <PixelPositions.h>

Classes

struct  PixelData
 position and size of a pixel More...
 

Public Member Functions

 PixelPositions (int moduleID)
 Class constructor.
 
int getModuleID () const
 Returns slot ID.
 
unsigned getNumPixels () const
 Returns number of pixels.
 
unsigned getNumPixelRows () const
 Returns the number of pixel rows.
 
unsigned getNumPixelColumns () const
 Returns the number of pixel columns.
 
const PixelDataget (int pixelID) const
 Returns pixel data for given pixelID.
 
const std::vector< PixelData > & getPixels () const
 Returns pixel data of entire module.
 
int pixelID (unsigned row, unsigned col) const
 Transforms pixel row and column to pixel ID Note: for convenience pixel row and column numbering starts with 0 here!
 

Private Attributes

int m_moduleID = 0
 slot ID
 
unsigned m_NRows = 0
 number of pixel rows
 
unsigned m_NColumns = 0
 number of pixel columns
 
std::vector< PixelDatam_pixels
 pixel positions and sizes, index = pixelID - 1
 
PixelData m_invalid
 invalid pixel data
 

Detailed Description

Pixel positions and dimensions in module local frame.

Definition at line 22 of file PixelPositions.h.

Constructor & Destructor Documentation

◆ PixelPositions()

PixelPositions ( int  moduleID)
explicit

Class constructor.

Parameters
moduleIDslot ID

Definition at line 21 of file PixelPositions.cc.

21 :
22 m_moduleID(moduleID)
23 {
24 const auto* geo = TOPGeometryPar::Instance()->getGeometry();
25 if (not geo->isModuleIDValid(moduleID)) {
26 B2FATAL("TOP::PixelPositions: invalid slot number, moduleID = " << moduleID);
27 return;
28 }
29
30 const auto& module = geo->getModule(moduleID);
31 const auto& pmtArray = module.getPMTArray();
32 m_NRows = pmtArray.getNumPixelRows();
33 m_NColumns = pmtArray.getNumPixelColumns();
34
35 const auto& prism = module.getPrism();
36 double Ah = prism.getWidth() / 2;
37 double yUp = prism.getThickness() / 2;
38 double yDown = yUp - prism.getExitThickness();
39
40 const auto& pmtArrayDispl = module.getPMTArrayDisplacement();
41 double x0 = pmtArrayDispl.getX();
42 double y0 = pmtArrayDispl.getY() + (yUp + yDown) / 2;
43
44 const auto& pmt = pmtArray.getPMT();
45 double a = pmt.getDx();
46 double b = pmt.getDy();
47
48 std::vector<double> xCenters;
49 for (unsigned aColumn = 1; aColumn <= pmtArray.getNumColumns(); aColumn++) {
50 for (unsigned pmtColumn = 1; pmtColumn <= pmt.getNumColumns(); pmtColumn++) {
51 xCenters.push_back(pmtArray.getX(aColumn) + pmt.getX(pmtColumn) + x0);
52 }
53 }
54
55 std::vector<double> yCenters;
56 for (unsigned aRow = 1; aRow <= pmtArray.getNumRows(); aRow++) {
57 for (unsigned pmtRow = 1; pmtRow <= pmt.getNumRows(); pmtRow++) {
58 yCenters.push_back(pmtArray.getY(aRow) + pmt.getY(pmtRow) + y0);
59 }
60 }
61
62 for (auto y : yCenters) {
63 double y1 = std::max(y - b / 2, yDown);
64 double y2 = std::min(y + b / 2, yUp);
65 double Dy = std::max(y2 - y1, 0.0);
66 double yc = (Dy > 0) ? (y1 + y2) / 2 : y;
67 for (auto x : xCenters) {
68 double x1 = std::max(x - a / 2, -Ah);
69 double x2 = std::min(x + a / 2, Ah);
70 double Dx = std::max(x2 - x1, 0.0);
71 double xc = (Dx > 0) ? (x1 + x2) / 2 : x;
72 m_pixels.push_back(PixelData(xc, yc, Dx, Dy));
73 }
74 }
75
76 const auto& mapper = TOPGeometryPar::Instance()->getChannelMapper();
77 for (size_t i = 0; i < m_pixels.size(); i++) {
78 int pixelID = i + 1;
79 m_pixels[i].ID = pixelID;
80 int pmtID = mapper.getPmtID(pixelID);
81 m_pixels[i].pmtType = TOPGeometryPar::Instance()->getPMTType(moduleID, pmtID);
82 }
83
84 }
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 m_NColumns
number of pixel columns
unsigned m_NRows
number of pixel rows
const TOPGeometry * getGeometry() const
Returns pointer to geometry object using basf2 units.
unsigned getPMTType(int moduleID, int pmtID) const
Returns PMT type at a given position.
const ChannelMapper & getChannelMapper() const
Returns default channel mapper (mapping of channels to pixels)
static TOPGeometryPar * Instance()
Static method to obtain the pointer to its instance.

Member Function Documentation

◆ get()

const PixelPositions::PixelData & get ( int  pixelID) const
inline

Returns pixel data for given pixelID.

Parameters
pixelIDpixel ID (1-based)
Returns
pixel data

Definition at line 120 of file PixelPositions.h.

121 {
122 unsigned k = pixelID - 1;
123 if (k < m_pixels.size()) return m_pixels[k];
124 return m_invalid;
125 }
PixelData m_invalid
invalid pixel data

◆ getModuleID()

int getModuleID ( ) const
inline

Returns slot ID.

Returns
slot ID

Definition at line 66 of file PixelPositions.h.

66{return m_moduleID;}

◆ getNumPixelColumns()

unsigned getNumPixelColumns ( ) const
inline

Returns the number of pixel columns.

Returns
number of pixel columns

Definition at line 84 of file PixelPositions.h.

84{return m_NColumns;}

◆ getNumPixelRows()

unsigned getNumPixelRows ( ) const
inline

Returns the number of pixel rows.

Returns
number of pixel rows

Definition at line 78 of file PixelPositions.h.

78{return m_NRows;}

◆ getNumPixels()

unsigned getNumPixels ( ) const
inline

Returns number of pixels.

Returns
number of pixels

Definition at line 72 of file PixelPositions.h.

72{return m_pixels.size();}

◆ getPixels()

const std::vector< PixelData > & getPixels ( ) const
inline

Returns pixel data of entire module.

Returns
vector of pixel data

Definition at line 97 of file PixelPositions.h.

97{return m_pixels;}

◆ pixelID()

int pixelID ( unsigned  row,
unsigned  col 
) const
inline

Transforms pixel row and column to pixel ID Note: for convenience pixel row and column numbering starts with 0 here!

Parameters
rowpixel row (0-based)
colpixel column (0-based)
Returns
pixelID (1-based)

Definition at line 106 of file PixelPositions.h.

106{return col + row * m_NColumns + 1;}

Member Data Documentation

◆ m_invalid

PixelData m_invalid
private

invalid pixel data

Definition at line 114 of file PixelPositions.h.

◆ m_moduleID

int m_moduleID = 0
private

slot ID

Definition at line 110 of file PixelPositions.h.

◆ m_NColumns

unsigned m_NColumns = 0
private

number of pixel columns

Definition at line 112 of file PixelPositions.h.

◆ m_NRows

unsigned m_NRows = 0
private

number of pixel rows

Definition at line 111 of file PixelPositions.h.

◆ m_pixels

std::vector<PixelData> m_pixels
private

pixel positions and sizes, index = pixelID - 1

Definition at line 113 of file PixelPositions.h.


The documentation for this class was generated from the following files: