Class constructor.
21 :
23 {
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();
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
77 for (
size_t i = 0; i <
m_pixels.size(); i++) {
80 int pmtID = mapper.getPmtID(
pixelID);
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.