Class constructor.
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 }