REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestDetectorReadoutPixel.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_TRestDetectorReadoutPixel
24#define RestCore_TRestDetectorReadoutPixel
25
26#include <TMath.h>
27#include <TVector2.h>
28
29#include <iostream>
30
33 private:
34 Double_t fPixelOriginX;
35 Double_t fPixelOriginY;
36
37 Double_t fPixelSizeX;
38 Double_t fPixelSizeY;
39
40 Double_t fRotation;
42
43 Bool_t fTriangle;
45
47 Double_t fTolerance = 1.e-6;
48
49 void Initialize();
50
51 protected:
52 public:
54 Double_t GetOriginX() const { return fPixelOriginX; }
55
57 Double_t GetOriginY() const { return fPixelOriginY; }
58
60 TVector2 GetOrigin() const { return {fPixelOriginX, fPixelOriginY}; }
61
63 Double_t GetRotation() const { return fRotation; }
64
66 inline Double_t GetSizeX() const { return fPixelSizeX; }
67
69 inline Double_t GetSizeY() const { return fPixelSizeY; }
70
72 TVector2 GetSize() { return {fPixelSizeX, fPixelSizeY}; }
73
75 Bool_t GetTriangle() const { return fTriangle; }
76
77 TVector2 GetCenter() const;
78
79 TVector2 GetVertex(int n) const;
80
82 void SetOrigin(Double_t x, Double_t y) {
83 fPixelOriginX = x;
84 fPixelOriginY = y;
85 }
86
88 void SetOrigin(const TVector2& origin) {
89 fPixelOriginX = origin.X();
90 fPixelOriginY = origin.Y();
91 }
92
94 void SetSize(Double_t sx, Double_t sy) {
95 fPixelSizeX = sx;
96 fPixelSizeY = sy;
97 }
98
100 void SetSize(const TVector2& size) {
101 fPixelSizeX = size.X();
102 fPixelSizeY = size.Y();
103 }
104
106 void SetRotation(Double_t rot) { fRotation = rot; }
107
109 void SetTriangle(Bool_t type) { fTriangle = type; }
110
112 void SetTolerance(Double_t tol) { fTolerance = tol; }
113
114 Bool_t isInside(TVector2 pos);
115 Bool_t isInside(Double_t x, Double_t y);
116
117 TVector2 TransformToPixelCoordinates(const TVector2& pixel) const;
118
119 void Print() const;
120
121 // Constructor
123 // Destructor
125
126 ClassDef(TRestDetectorReadoutPixel, 5);
127};
128
129#endif
A class to store the readout pixel definition used in TRestDetectorReadoutChannel.
TVector2 GetCenter() const
Returns the center TVector2 position of the pixel.
Double_t fPixelSizeY
The pixel y size.
Double_t fPixelOriginX
The pixel x-origin position, left-bottom corner.
void SetSize(Double_t sx, Double_t sy)
Sets the size of the pixel using the coordinate values sx,sy.
Double_t GetOriginX() const
Returns the x-coordinate pixel origin.
Double_t fTolerance
It will be initialized with the module parameter "pixelTolerance".
void SetOrigin(const TVector2 &origin)
Sets the origin of the pixel using a TVector2.
Double_t GetSizeX() const
Returns the pixel size in X.
void SetOrigin(Double_t x, Double_t y)
Sets the origin of the pixel using the coordinate values x,y.
Bool_t GetTriangle() const
Returns true if the pixel is a triangle.
void SetSize(const TVector2 &size)
Sets the size of the pixel using a TVector2.
TVector2 GetOrigin() const
Returns a TVector2 with the pixel origin.
TVector2 GetSize()
Returns a TVector2 with the pixel size.
void SetTriangle(Bool_t type)
Sets the type of the pixel.
Double_t GetOriginY() const
Returns the y-coordinate pixel origin.
void SetRotation(Double_t rot)
Sets the rotation angle of the pixel in degrees.
Bool_t isInside(TVector2 pos)
Determines if a given TVector2 pos coordinates are found inside the pixel. The coordinates are refere...
void Initialize()
Initializes the pixel members.
void Print() const
Prints on screen the pixel details, origin, size, rotation.
TVector2 GetVertex(int n) const
Returns the specified pixel vertex position.
TVector2 TransformToPixelCoordinates(const TVector2 &pixel) const
Transforms the coordinates given in a TVector2 to the internal pixel coordinate system....
virtual ~TRestDetectorReadoutPixel()
TRestDetectorReadoutPixel default destructor.
Double_t GetRotation() const
Returns the rotation angle in degrees.
void SetTolerance(Double_t tol)
Sets the value of the tolerance in mm. Used in IsInside method.
TRestDetectorReadoutPixel()
TRestDetectorReadoutPixel default constructor.
Double_t fPixelSizeX
The pixel x size.
Double_t fPixelOriginY
The pixel y-origin position, left-bottom corner.
Double_t GetSizeY() const
Returns the pixel size in Y.