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 TRestRadialStrippedMask 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.
 
Int_t GetMaxRegions ()
 
TVector2 GetOffset ()
 It returns the rotation angle.
 
virtual Int_t GetRegion (Double_t &x, Double_t &y)
 To be implemented at the inherited class with the pattern and region identification logic.
 
Double_t GetRotationAngle ()
 It returns the rotation angle.
 
std::string GetType ()
 It returns the mask pattern type.
 
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).
 
void PrintCommonPatternMembers ()
 Prints on screen the information about the metadata members without header.
 
virtual void PrintMask ()
 
virtual void PrintMaskMembers ()
 
void PrintMetadata () override
 Prints on screen the information about the metadata members of TRestPatternMask.
 
void SetMaskRadius (const Double_t &radius)
 It defines the mask radius.
 
void SetMaxRegions (Int_t regions)
 
void SetOffset (const TVector2 &offset)
 It defines the pattern offset.
 
void SetRotationAngle (const Double_t &angle)
 It defines the rotation angle.
 
 TRestPatternMask ()
 Default constructor.
 
 TRestPatternMask (const char *cfgFileName, std::string name="")
 Constructor loading data from a config file. More...
 
 ~TRestPatternMask ()
 Default destructor.
 

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.
 

Protected Attributes

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

Private Attributes

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

Constructor & Destructor Documentation

◆ TRestPatternMask()

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.

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.


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