REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
TRestPatternMask Class Reference

Detailed Description

An abstract class used to encapsulate different mask pattern class definitions.

This pure abstract class will help to encapsulate different pattern masks. It defines common public methods TRestPatternMask::GetRegion and TRestPatternMask::HitsPattern that allow to identify the region were a (x,y) coordinate was found, or if has hitted the pattern structure defined at the inherited class.

Note
The mask will always be centered at (0,0). The offset applied in this class will only affect the pattern. Any global offset needs to be introduced externally.

The rotation members are stored in this class to allow a common definition of rotation and translation parameters for any pattern.

Parameters

The following parameters are common to any TRestPatternMask.

The inherited class should implement the pure abstract method TRestPatternMask::GetRegion integrating the logic to identify regions and the pattern mask. The inherited GetRegion method implementation should call TRestPatternMask::ApplyCommonMaskTransformation to define mask offset, rotation and radial limit.

Some examples are : TRestGridMask, TRestStrippedMask, TRestSpiderMask and TRestRingsMask. More details on each class documentation.


REST-for-Physics - Software for Rare Event Searches Toolkit

History of developments:

2022-May: First implementation of TRestPatternMask Javier Galan

Author
: Javier Galan - javie.nosp@m.r.ga.nosp@m.lan@u.nosp@m.niza.nosp@m.r.es

Definition at line 30 of file TRestPatternMask.h.

#include <TRestPatternMask.h>

Inheritance diagram for TRestPatternMask:
TRestMetadata TRestCombinedMask TRestGridMask TRestRingsMask TRestSpiderMask TRestStrippedMask

Public Member Functions

 ClassDefOverride (TRestPatternMask, 1)
 
TCanvas * DrawMonteCarlo (Int_t nSamples=10000)
 It generates a Monte Carlo with positions and paints them the returned canvas. Each unique region is associated with different colors. If there are too many colors, they might be repited for different region ids. More...
 
Double_t GetMaskRadius ()
 It returns the mask radius. More...
 
Int_t GetMaxRegions ()
 
TVector2 GetOffset ()
 It returns the rotation angle. More...
 
virtual Int_t GetRegion (Double_t &x, Double_t &y)
 To be implemented at the inherited class with the pattern and region identification logic. More...
 
Double_t GetRotationAngle ()
 It returns the rotation angle. More...
 
std::string GetType ()
 It returns the mask pattern type. More...
 
Bool_t HitsPattern (Double_t x, Double_t y)
 Returns true if the pattern was hit. If (x,y) it is inside a region then, the pattern was not hit by (x,y). More...
 
void PrintCommonPatternMembers ()
 Prints on screen the information about the metadata members without header. More...
 
virtual void PrintMask ()
 
virtual void PrintMaskMembers ()
 
void PrintMetadata () override
 Prints on screen the information about the metadata members of TRestPatternMask. More...
 
void SetMaskRadius (const Double_t &radius)
 It defines the mask radius. More...
 
void SetMaxRegions (Int_t regions)
 
void SetOffset (const TVector2 &offset)
 It defines the pattern offset. More...
 
void SetRotationAngle (const Double_t &angle)
 It defines the rotation angle. More...
 
 TRestPatternMask ()
 Default constructor. More...
 
 TRestPatternMask (const char *cfgFileName, std::string name="")
 Constructor loading data from a config file. More...
 
 ~TRestPatternMask ()
 Default destructor. More...
 

Protected Member Functions

Int_t ApplyCommonMaskTransformation (Double_t &x, Double_t &y)
 It produces an effective mask rotation and translation for the point x,y. More...
 
void SetType (const std::string &type)
 It defines the mask type. To be called by the inherited class constructor. More...
 

Protected Attributes

Double_t fMaskRadius = 0
 The maximum mask radius in mm (if 0 it will be infinite) More...
 
Int_t fMaxRegions = 100
 The maximum number of regions allowed in each mask. More...
 

Private Attributes

TCanvas * fCanvas = nullptr
 A canvas for drawing. More...
 
TVector2 fOffset = TVector2(0, 0)
 It is used to introduce an offset on the pattern. More...
 
std::string fPatternType = "None"
 The pattern type (None/Stripped/Grid/Spider/Rings) More...
 
Double_t fRotationAngle = 0
 An angle (in radians) used to introduce a rotation to the pattern. More...
 

Constructor & Destructor Documentation

◆ TRestPatternMask() [1/2]

TRestPatternMask::TRestPatternMask ( )

Default constructor.

Definition at line 84 of file TRestPatternMask.cxx.

◆ TRestPatternMask() [2/2]

TRestPatternMask::TRestPatternMask ( const char *  cfgFileName,
std::string  name = "" 
)

Constructor loading data from a config file.

If no configuration path is defined using TRestMetadata::SetConfigFilePath the path to the config file must be specified using full path, absolute or relative.

The default behaviour is that the config file must be specified with full path, absolute or relative.

Parameters
cfgFileNameA const char* giving the path to an RML file.
nameThe name of the specific metadata. It will be used to find the corresponding TRestAxionMagneticField section inside the RML.

Definition at line 100 of file TRestPatternMask.cxx.

◆ ~TRestPatternMask()

TRestPatternMask::~TRestPatternMask ( )

Default destructor.

Definition at line 107 of file TRestPatternMask.cxx.

Member Function Documentation

◆ ApplyCommonMaskTransformation()

Int_t TRestPatternMask::ApplyCommonMaskTransformation ( Double_t &  x,
Double_t &  y 
)
protected

It produces an effective mask rotation and translation for the point x,y.

Remark: The window is centered, it is just the pattern that we want to shift.

Definition at line 116 of file TRestPatternMask.cxx.

◆ DrawMonteCarlo()

TCanvas * TRestPatternMask::DrawMonteCarlo ( Int_t  nSamples = 10000)

It generates a Monte Carlo with positions and paints them the returned canvas. Each unique region is associated with different colors. If there are too many colors, they might be repited for different region ids.

Generating Montecarlo

Definition at line 165 of file TRestPatternMask.cxx.

◆ GetMaskRadius()

Double_t TRestPatternMask::GetMaskRadius ( )
inline

It returns the mask radius.

Definition at line 79 of file TRestPatternMask.h.

◆ GetMaxRegions()

Int_t TRestPatternMask::GetMaxRegions ( )
inline

Definition at line 57 of file TRestPatternMask.h.

◆ GetOffset()

TVector2 TRestPatternMask::GetOffset ( )
inline

It returns the rotation angle.

Definition at line 76 of file TRestPatternMask.h.

◆ GetRegion()

virtual Int_t TRestPatternMask::GetRegion ( Double_t &  x,
Double_t &  y 
)
inlinevirtual

To be implemented at the inherited class with the pattern and region identification logic.

Reimplemented in TRestCombinedMask, TRestGridMask, TRestRingsMask, TRestSpiderMask, and TRestStrippedMask.

Definition at line 64 of file TRestPatternMask.h.

◆ GetRotationAngle()

Double_t TRestPatternMask::GetRotationAngle ( )
inline

It returns the rotation angle.

Definition at line 73 of file TRestPatternMask.h.

◆ GetType()

std::string TRestPatternMask::GetType ( )
inline

It returns the mask pattern type.

Definition at line 70 of file TRestPatternMask.h.

◆ HitsPattern()

bool TRestPatternMask::HitsPattern ( Double_t  x,
Double_t  y 
)

Returns true if the pattern was hit. If (x,y) it is inside a region then, the pattern was not hit by (x,y).

Definition at line 134 of file TRestPatternMask.cxx.

◆ PrintCommonPatternMembers()

void TRestPatternMask::PrintCommonPatternMembers ( )

Prints on screen the information about the metadata members without header.

Definition at line 152 of file TRestPatternMask.cxx.

◆ PrintMask()

virtual void TRestPatternMask::PrintMask ( )
inlinevirtual

◆ PrintMaskMembers()

virtual void TRestPatternMask::PrintMaskMembers ( )
inlinevirtual

◆ PrintMetadata()

void TRestPatternMask::PrintMetadata ( )
overridevirtual

Prints on screen the information about the metadata members of TRestPatternMask.

Reimplemented from TRestMetadata.

Reimplemented in TRestRingsMask, TRestSpiderMask, and TRestStrippedMask.

Definition at line 142 of file TRestPatternMask.cxx.

◆ SetMaskRadius()

void TRestPatternMask::SetMaskRadius ( const Double_t &  radius)
inline

It defines the mask radius.

Definition at line 88 of file TRestPatternMask.h.

◆ SetMaxRegions()

void TRestPatternMask::SetMaxRegions ( Int_t  regions)
inline

Definition at line 59 of file TRestPatternMask.h.

◆ SetOffset()

void TRestPatternMask::SetOffset ( const TVector2 &  offset)
inline

It defines the pattern offset.

Definition at line 85 of file TRestPatternMask.h.

◆ SetRotationAngle()

void TRestPatternMask::SetRotationAngle ( const Double_t &  angle)
inline

It defines the rotation angle.

Definition at line 82 of file TRestPatternMask.h.

◆ SetType()

void TRestPatternMask::SetType ( const std::string &  type)
inlineprotected

It defines the mask type. To be called by the inherited class constructor.

Definition at line 52 of file TRestPatternMask.h.

Field Documentation

◆ fCanvas

TCanvas* TRestPatternMask::fCanvas = nullptr
private

A canvas for drawing.

Definition at line 42 of file TRestPatternMask.h.

◆ fMaskRadius

Double_t TRestPatternMask::fMaskRadius = 0
protected

The maximum mask radius in mm (if 0 it will be infinite)

Definition at line 46 of file TRestPatternMask.h.

◆ fMaxRegions

Int_t TRestPatternMask::fMaxRegions = 100
protected

The maximum number of regions allowed in each mask.

Definition at line 49 of file TRestPatternMask.h.

◆ fOffset

TVector2 TRestPatternMask::fOffset = TVector2(0, 0)
private

It is used to introduce an offset on the pattern.

Definition at line 33 of file TRestPatternMask.h.

◆ fPatternType

std::string TRestPatternMask::fPatternType = "None"
private

The pattern type (None/Stripped/Grid/Spider/Rings)

Definition at line 39 of file TRestPatternMask.h.

◆ fRotationAngle

Double_t TRestPatternMask::fRotationAngle = 0
private

An angle (in radians) used to introduce a rotation to the pattern.

Definition at line 36 of file TRestPatternMask.h.


The documentation for this class was generated from the following files: