44 #include "TRestDetectorReadoutPixel.h"
46 #include <TRestMetadata.h>
70 TVector2 center(0, 0);
71 TVector2 origin(fPixelOriginX, fPixelOriginY);
72 TVector2 oppositeVertex = GetVertex(2);
75 center = (oppositeVertex - origin) / 4. + origin;
77 center = (origin + oppositeVertex) / 2.;
88 TVector2 vertex(0, 0);
89 TVector2 origin(fPixelOriginX, fPixelOriginY);
93 else if (n % 4 == 1) {
94 vertex.Set(fPixelSizeX, 0);
95 vertex = vertex.Rotate(fRotation * TMath::Pi() / 180.);
97 vertex = vertex + origin;
98 }
else if (n % 4 == 2) {
99 vertex.Set(fPixelSizeX, fPixelSizeY);
100 vertex = vertex.Rotate(fRotation * TMath::Pi() / 180.);
102 vertex = vertex + origin;
103 }
else if (n % 4 == 3) {
104 vertex.Set(0, fPixelSizeY);
105 vertex = vertex.Rotate(fRotation * TMath::Pi() / 180.);
107 vertex = vertex + origin;
117 const auto pos = TransformToPixelCoordinates(inputPosition);
118 Double_t
const x = pos.X();
119 if (pos.X() >= -fTolerance && pos.X() <= fPixelSizeX + fTolerance)
121 if (fTriangle && pos.Y() >= -fTolerance &&
122 pos.Y() <= fPixelSizeY + fTolerance -
123 x * (fPixelSizeY / fPixelSizeX))
125 if (!fTriangle && pos.Y() >= -fTolerance &&
126 pos.Y() <= fPixelSizeY + fTolerance)
139 TVector2 pos(pixel.X() - fPixelOriginX, pixel.Y() - fPixelOriginY);
140 pos = pos.Rotate(-fRotation * TMath::Pi() / 180.);
148 std::cout <<
" ## Pixel position : (" << GetOriginX() <<
"," << GetOriginY() <<
") mm size : ("
149 << GetSizeX() <<
"," << GetSizeY() <<
") mm" << std::endl;
150 std::cout <<
" rotation : " << fRotation <<
" degrees"
153 std::cout <<
"triangle" << std::endl;
155 std::cout <<
"rectangle" << std::endl;
A class to store the readout pixel definition used in TRestDetectorReadoutChannel.
TVector2 GetCenter() const
Returns the center TVector2 position of the pixel.
Bool_t IsInside(const 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.
TRestDetectorReadoutPixel()
TRestDetectorReadoutPixel default constructor.