23#ifndef RestCore_TRestDetectorReadoutModule
24#define RestCore_TRestDetectorReadoutModule
31#include "TRestDetectorReadoutChannel.h"
32#include "TRestDetectorReadoutMapping.h"
52 std::vector<TRestDetectorReadoutChannel>
69 auto coords = xyPhysical -
fOrigin;
78 TVector2 coords(xMod, yMod);
174 Bool_t
isInside(
const TVector2& position);
185 Bool_t
isInsidePixel(Int_t channel, Int_t pixel,
const TVector2& position);
192 TVector2
GetPixelVertex(Int_t channel, Int_t pixel, Int_t vertex);
209 void Print(Int_t DetailLevel = 0);
Int_t GetDaqID() const
Returns the corresponding daq channel id.
TRestDetectorReadoutModule()
Default TRestDetectorReadoutModule constructor.
std::vector< TRestDetectorReadoutChannel > fReadoutChannel
Bool_t isInside(Double_t x, Double_t y)
Determines if the position x,y relative to the readout plane are inside this readout module.
void DisableWarnings()
Disables warning output.
void SetSize(const TVector2 &size)
Sets the module size by definition using TVector2 input.
Int_t GetModuleID() const
Returns the module id.
TVector2 TransformToPlaneCoordinates(Double_t xMod, Double_t yMod) const
TVector2 GetPixelCenter(Int_t channel, Int_t pixel)
Returns the center pixel position for a given channel and pixel indexes.
Int_t GetMinDaqID() const
Returns the minimum daq id number.
*default REST_Warning in TRestDetectorReadout will enable it *void Initialize()
TRestDetectorReadoutModule initialization.
Double_t GetTolerance() const
Gets the tolerance for independent pixel overlaps.
TVector2 GetSize() const
Returns the module size (x, y) in mm.
TVector2 fOrigin
The module (x, y) position relative to the readout plane position.
TVector2 GetModuleCoordinates(const TVector2 &p) const
TRestDetectorReadoutChannel * GetChannel(size_t n)
Returns a pointer to a readout channel by index.
TVector2 GetPixelOrigin(Int_t channel, Int_t pixel)
Returns the pixel origin (left-bottom) position for a given channel and pixel indexes.
TVector2 fSize
The module (x, y) size. All pixels should be contained within this size.
void SetModuleID(Int_t modID)
Sets the module by id definition.
Bool_t GetPixelTriangle(Int_t channel, Int_t pixel)
Returns the pixel type for a given channel and pixel indexes.
Int_t FindChannel(const TVector2 &position)
Returns the channel index corresponding to the absolute coordinates (absX, absY), but relative to the...
Bool_t isInsidePixel(Int_t channel, Int_t pixel, const TVector2 &position)
Determines if the position TVector2 pos is found at a specific pixel id inside the readout channel gi...
TVector2 GetOrigin() const
Returns the module origin position.
Double_t GetRotation() const
Returns the module rotation in degrees.
void EnableWarnings()
Enables warning output.
std::string fName
The assigned module name.
TVector2 GetPixelVertex(Int_t channel, Int_t pixel, Int_t vertex)
Returns any of the pixel vertex position for a given channel and pixel indexes.
TVector2 GetPlaneCoordinates(const TVector2 &p)
TRestDetectorReadoutMapping * GetMapping()
Returns a pointer to the readout mapping.
void AddChannel(TRestDetectorReadoutChannel &rChannel)
Adds a new channel to the module.
Bool_t isInsideChannel(Int_t channel, Double_t x, Double_t y)
Determines if the position x,y is found in any of the pixels of the readout channel index given.
TVector2 GetVertex(int n) const
Returns the coordinates of the specified vertex index n. The physical coordinates relative to the rea...
Bool_t isInside(const TVector2 &position)
Determines if the position TVector2 pos relative to the readout plane are inside this readout module.
void SetTolerance(Double_t tolerance)
Sets the tolerance for independent pixel overlaps.
void SetRotation(Double_t rotation)
Sets the module rotation in degrees.
const char * GetName() const
Returns the module name.
Double_t fRotation
The rotation of the module around the module origin (fModuleOriginX, fModuleOriginY) in radians.
TVector2 TransformToModuleCoordinates(const TVector2 &xyPhysical) const
Int_t GetMaxDaqID() const
Returns the maximum daq id number.
TRestDetectorReadoutMapping fMapping
The readout module uniform grid mapping.
void SetMinMaxDaqIDs()
Initializes the max and min values for the daq channel number.
Int_t fId
The module id given by the readout definition.
void SetName(const std::string &name)
Sets the name of the readout module.
virtual ~TRestDetectorReadoutModule()
Default TRestDetectorReadoutModule destructor.
void Draw()
Not implemented.
void Print(Int_t DetailLevel=0)
Prints the module details and channels if fullDetail is enabled.
void SetOrigin(const TVector2 &origin)
Sets the module origin by definition using TVector2 input.
size_t GetNumberOfChannels() const
Returns the total number of channels defined inside the module.
Bool_t isDaqIDInside(Int_t daqID)
Determines if a given daqID number is in the range of the module.
void DoReadoutMapping(Int_t nodes=0)
Starts the readout mapping initialization. This process is computationally expensive but it greatly o...
std::pair< Int_t, Int_t > fDaqIdRange
The minimum and maximum daq channel ids associated to the module.
Int_t DaqToReadoutChannel(Int_t daqChannel)
Returns the physical readout channel index for a given daq id channel number.
TVector2 GetDistanceToModule(const TVector2 &position)
Creates a TVector2 with shortest norm going from the given position pos to the module....
A class to store the readout pixel definition used in TRestDetectorReadoutChannel.