49 #include "TRestDetectorReadoutMapping.h"
78 Int_t nX = (Int_t)((x / fNetSizeX) * fNodesX);
79 if (nX >= fNodesX)
return fNodesX - 1;
87 Int_t nY = (Int_t)((y / fNetSizeY) * fNodesY);
88 if (nY >= fNodesY)
return fNodesY - 1;
96 return fChannel[GetNodeX(x)][GetNodeY(y)];
103 return fPixel[GetNodeX(x)][GetNodeY(y)];
111 for (
int i = 0; i < fNodesX; i++)
112 for (
int j = 0; j < fNodesY; j++) {
113 if (!isNodeSet(i, j)) counter++;
122 for (
int i = 0; i < fNodesX; i++)
123 for (
int j = 0; j < fNodesY; j++) {
124 if (fChannel[i][j] == ch && fPixel[i][j] == px)
return i;
133 for (
int i = 0; i < fNodesX; i++)
134 for (
int j = 0; j < fNodesY; j++) {
135 if (fChannel[i][j] == ch && fPixel[i][j] == px)
return j;
148 fChannel.ResizeTo(fNodesX, fNodesY);
149 fPixel.ResizeTo(fNodesX, fNodesY);
151 for (
int i = 0; i < fNodesX; i++)
152 for (
int j = 0; j < fNodesY; j++) {
170 if (fChannel[i][j] == -1 || fPixel[i][j] == -1)
return false;
178 for (
int i = 0; i < fNodesX; i++)
179 for (
int j = 0; j < fNodesY; j++) {
180 if (!isNodeSet(i, j)) {
181 cout <<
"Node : " << i <<
" , " << j <<
" is NOT set. Ch : " << fChannel[i][j]
182 <<
" Pix : " << fPixel[i][j] << endl;
Int_t GetChannel(Double_t x, Double_t y)
Gets the channel number corresponding to coordinates (x,y)
void Initialize(Int_t nX, Int_t nY, Double_t sX, Double_t sY)
Resets the matrix values and allocates memory for the given net size.
Int_t GetNodeX(Double_t x)
Gets the nodeX index corresponding to the x coordinate.
Int_t GetPixel(Double_t x, Double_t y)
Gets the pixel number corresponding to coordinates (x,y)
Int_t GetNodeX_ForChannelAndPixel(Int_t ch, Int_t px)
Finds the node index in X for a given channel and pixel ids.
Double_t GetX(Int_t nodeX)
Gets the X position of node (i,j)
void SetNode(Int_t i, Int_t j, Int_t ch, Int_t pix)
Sets the readout channel and pixel corresponding to a mapping node.
Bool_t AllNodesSet()
Checks if all the nodes in the net have been defined.
Int_t GetNumberOfNodesNotSet()
Returns the number of nodes that have not been initialized.
Bool_t isNodeSet(Int_t i, Int_t j)
Checks if the node (i,j) is defined.
Int_t GetNodeY(Double_t y)
Gets the nodeY index corresponding to the y coordinate.
Double_t GetY(Int_t nodeY)
Gets the Y position of node (i,j)
Int_t GetNodeY_ForChannelAndPixel(Int_t ch, Int_t px)
Finds the node index in Y for a given channel and pixel ids.
TRestDetectorReadoutMapping()
TRestDetectorReadoutMapping constructor.
~TRestDetectorReadoutMapping()
TRestDetectorReadoutMapping destructor.