REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestDetectorReadoutMapping.h
1/*************************************************************************
2 * This file is part of the REST software framework. *
3 * *
4 * Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
5 * For more information see http://gifna.unizar.es/trex *
6 * *
7 * REST is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * REST is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have a copy of the GNU General Public License along with *
18 * REST in $REST_PATH/LICENSE. *
19 * If not, see http://www.gnu.org/licenses/. *
20 * For the list of contributors see $REST_PATH/CREDITS. *
21 *************************************************************************/
22
23#ifndef RestCore_TRestDetectorReadoutMapping
24#define RestCore_TRestDetectorReadoutMapping
25
26#include <TMatrixD.h>
27
28#include <iostream>
29
33 private:
34 Int_t fNodesX;
35 Int_t fNodesY;
36
37 Double_t fNetSizeX;
38 Double_t fNetSizeY;
39
40 TMatrixD fChannel;
42 TMatrixD fPixel;
44
45 public:
46 // Getters
48 inline Int_t GetNumberOfNodesX() const { return fNodesX; }
49
51 inline Int_t GetNumberOfNodesY() const { return fNodesY; }
52
54 Int_t GetChannelByNode(Int_t i, Int_t j) { return fChannel[i][j]; }
55
57 Int_t GetPixelByNode(Int_t i, Int_t j) { return fPixel[i][j]; }
58
59 Bool_t isNodeSet(Int_t i, Int_t j);
60
61 Bool_t AllNodesSet();
62
64
65 Int_t GetNodeX_ForChannelAndPixel(Int_t ch, Int_t px);
66
67 Int_t GetNodeY_ForChannelAndPixel(Int_t ch, Int_t px);
68
69 Int_t GetNodeX(Double_t x);
70
71 Int_t GetNodeY(Double_t y);
72
73 Double_t GetX(Int_t nodeX);
74
75 Double_t GetY(Int_t nodeY);
76
77 Int_t GetChannel(Double_t x, Double_t y);
78
79 Int_t GetPixel(Double_t x, Double_t y);
80
81 void SetNode(Int_t i, Int_t j, Int_t ch, Int_t pix);
82
83 void Initialize(Int_t nX, Int_t nY, Double_t sX, Double_t sY);
84
85 // Constructor
87 // Destructor
89
90 ClassDef(TRestDetectorReadoutMapping, 2);
91};
92#endif
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 fNodesY
The number of nodes in the y-axis.
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.
Double_t fNetSizeX
The size of the net/grid in the x-axis.
Int_t GetNodeY(Double_t y)
Gets the nodeY index corresponding to the y coordinate.
Int_t GetPixelByNode(Int_t i, Int_t j)
Gets the pixel id corresponding to a given node (i,j)
Int_t fNodesX
The number of nodes in the x-axis.
Double_t GetY(Int_t nodeY)
Gets the Y position of node (i,j)
Int_t GetNumberOfNodesX() const
Returns the number of nodes in X.
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.
Int_t GetChannelByNode(Int_t i, Int_t j)
Gets the channel id corresponding to a given node (i,j)
Int_t GetNumberOfNodesY() const
Returns the number of nodes in Y.
Double_t fNetSizeY
The size of the net/grid in the y-axis.