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

Detailed Description

A class used to define a rings mask pattern.

This class defines a set of rings limited by an inner/outter radii.

The rings radii can be initialized by a set of specific metadata parameters defined inside this class.

The rings pattern is centered in (0,0) and it can be shifted using the offset defined inside TRestPatternMask. It must be noted that it is the pattern that will be shifted and not the mask.

Specific rings metadata parameters

Note
Those parameters can be used to define the generation of a periodic ring pattern. However, it is possible to define any arbitrary ring structure using the method TRestRingsMask::GenerateRings. In that case, the previous parametersr should be left undefined.

Common pattern metadata parameters

On top of the metadata class parameters, we may define common pattern parameters to induce an offset and rotation to the pattern.

Examples

Mask pattern RML definitions can be found inside the file REST_PATH/examples/masks.rml.

The following definition ilustrates a complete RML implementation of a TRestRingsMask.

<TRestRingsMask name="rings" verboseLevel="warning">
<parameter name="maskRadius" value="9cm" />
<parameter name="offset" value="(3,3)mm" />
<parameter name="ringsGap" value="12mm" />
<parameter name="ringsThickness" value="10mm" />
<parameter name="initialRadius" value="3cm" />
<parameter name="nRings" value="5" />
A class used to define a rings mask pattern.

The basic use of this class is provided by the TRestRingsMask::GetRegion method. For example:

TRestRingsMask mask("masks.rml", "rings");
Int_t id = mask.GetRegion( 12.5, 4.3 );
std::cout << "Region id is : " << id << endl;

The following figure may be generated using the TRestPatternMask::DrawMonteCarlo method.

TRestRingsMask mask("masks.rml", "rings");
mask.GenerateRings();
TCanvas *c = mask.DrawMonteCarlo(30000);
c->Draw();
c->Print("output.png");


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

History of developments:

2022-05: First implementation of TRestRingsMask Javier Galan

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

Definition at line 29 of file TRestRingsMask.h.

#include <TRestRingsMask.h>

Inheritance diagram for TRestRingsMask:
TRestPatternMask TRestMetadata

Public Member Functions

 ClassDefOverride (TRestRingsMask, 1)
 
void GenerateRings ()
 It will initialize the variable fRingsRadii using the number of radius, initial radius, the rings gap and thickness. More...
 
Double_t GetInitialRadius ()
 It returns the most inner ring radius. More...
 
Double_t GetNumberOfRings ()
 It returns the number of rings to be generated. More...
 
virtual Int_t GetRegion (Double_t &x, Double_t &y) override
 It returns a number identifying the region where the particle with coordinates (x,y) felt in. The method returns 0 if the particle hits the pattern. More...
 
Double_t GetRingsGap ()
 It returns the gap/periodicity of the rings in mm. More...
 
Double_t GetRingsThickness ()
 It returns the thickness of the rings in mm. More...
 
void PrintMask () override
 Prints on screen the information about the metadata members of TRestRingsMask, including common pattern headers, but without common metadata headers. More...
 
void PrintMaskMembers () override
 Prints on screen the information about the metadata members of TRestRingsMask, excluding common metadata headers. More...
 
void PrintMetadata () override
 Prints on screen the information about the metadata members from this class. More...
 
void PrintRings ()
 Prints on screen the information about the metadata members of TRestRingsMask, excluding common metadata headers. More...
 
void SetRadii (const std::vector< Double_t > &innerR, const std::vector< Double_t > &outterR)
 It allows to redefine the inner and outter rings radii directly. More...
 
 TRestRingsMask ()
 Default constructor. More...
 
 TRestRingsMask (const char *cfgFileName, std::string name="")
 Constructor loading data from a config file. More...
 
 ~TRestRingsMask ()
 Default destructor. More...
 
- Public Member Functions inherited from TRestPatternMask
 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...
 

Private Member Functions

void Initialize () override
 Function to initialize input/output event members and define the section name. More...
 

Private Attributes

Double_t fInitialRadius = 0
 The initial radius for the inner ring. More...
 
Int_t fNRings = 0
 The number of rings inside the structure. More...
 
Double_t fRingsGap = 0
 The periodity of the rings structure in mm. Optionally used to initialize the rings. More...
 
std::vector< std::pair< Double_t, Double_t > > fRingsRadii
 A pair containing inner/outter radius for each ring. More...
 
Double_t fRingsThickness = 0
 The width of the rings structure in mm. Optionally used to initialize the rings. More...
 

Additional Inherited Members

- Protected Member Functions inherited from TRestPatternMask
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 inherited from TRestPatternMask
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...
 

Constructor & Destructor Documentation

◆ TRestRingsMask() [1/2]

TRestRingsMask::TRestRingsMask ( )

Default constructor.

Definition at line 120 of file TRestRingsMask.cxx.

◆ TRestRingsMask() [2/2]

TRestRingsMask::TRestRingsMask ( 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 TRestRingsMask section inside the RML.

Definition at line 136 of file TRestRingsMask.cxx.

◆ ~TRestRingsMask()

TRestRingsMask::~TRestRingsMask ( )

Default destructor.

Definition at line 147 of file TRestRingsMask.cxx.

Member Function Documentation

◆ GenerateRings()

void TRestRingsMask::GenerateRings ( )

It will initialize the variable fRingsRadii using the number of radius, initial radius, the rings gap and thickness.

Definition at line 184 of file TRestRingsMask.cxx.

◆ GetInitialRadius()

Double_t TRestRingsMask::GetInitialRadius ( )
inline

It returns the most inner ring radius.

Definition at line 63 of file TRestRingsMask.h.

◆ GetNumberOfRings()

Double_t TRestRingsMask::GetNumberOfRings ( )
inline

It returns the number of rings to be generated.

Definition at line 60 of file TRestRingsMask.h.

◆ GetRegion()

Int_t TRestRingsMask::GetRegion ( Double_t &  x,
Double_t &  y 
)
overridevirtual

It returns a number identifying the region where the particle with coordinates (x,y) felt in. The method returns 0 if the particle hits the pattern.

The particle will be counter-rotated to emulate the mask rotation using the method TRestPatternMask::RotateAndTranslate.

Reimplemented from TRestPatternMask.

Definition at line 168 of file TRestRingsMask.cxx.

◆ GetRingsGap()

Double_t TRestRingsMask::GetRingsGap ( )
inline

It returns the gap/periodicity of the rings in mm.

Definition at line 54 of file TRestRingsMask.h.

◆ GetRingsThickness()

Double_t TRestRingsMask::GetRingsThickness ( )
inline

It returns the thickness of the rings in mm.

Definition at line 57 of file TRestRingsMask.h.

◆ Initialize()

void TRestRingsMask::Initialize ( )
overrideprivatevirtual

Function to initialize input/output event members and define the section name.

Reimplemented from TRestMetadata.

Definition at line 153 of file TRestRingsMask.cxx.

◆ PrintMask()

void TRestRingsMask::PrintMask ( )
overridevirtual

Prints on screen the information about the metadata members of TRestRingsMask, including common pattern headers, but without common metadata headers.

Reimplemented from TRestPatternMask.

Definition at line 209 of file TRestRingsMask.cxx.

◆ PrintMaskMembers()

void TRestRingsMask::PrintMaskMembers ( )
overridevirtual

Prints on screen the information about the metadata members of TRestRingsMask, excluding common metadata headers.

Reimplemented from TRestPatternMask.

Definition at line 219 of file TRestRingsMask.cxx.

◆ PrintMetadata()

void TRestRingsMask::PrintMetadata ( )
overridevirtual

Prints on screen the information about the metadata members from this class.

Reimplemented from TRestPatternMask.

Definition at line 198 of file TRestRingsMask.cxx.

◆ PrintRings()

void TRestRingsMask::PrintRings ( )

Prints on screen the information about the metadata members of TRestRingsMask, excluding common metadata headers.

Definition at line 247 of file TRestRingsMask.cxx.

◆ SetRadii()

void TRestRingsMask::SetRadii ( const std::vector< Double_t > &  innerR,
const std::vector< Double_t > &  outterR 
)
inline

It allows to redefine the inner and outter rings radii directly.

Definition at line 66 of file TRestRingsMask.h.

Field Documentation

◆ fInitialRadius

Double_t TRestRingsMask::fInitialRadius = 0
private

The initial radius for the inner ring.

Definition at line 43 of file TRestRingsMask.h.

◆ fNRings

Int_t TRestRingsMask::fNRings = 0
private

The number of rings inside the structure.

Definition at line 40 of file TRestRingsMask.h.

◆ fRingsGap

Double_t TRestRingsMask::fRingsGap = 0
private

The periodity of the rings structure in mm. Optionally used to initialize the rings.

Definition at line 34 of file TRestRingsMask.h.

◆ fRingsRadii

std::vector<std::pair<Double_t, Double_t> > TRestRingsMask::fRingsRadii
private

A pair containing inner/outter radius for each ring.

Definition at line 46 of file TRestRingsMask.h.

◆ fRingsThickness

Double_t TRestRingsMask::fRingsThickness = 0
private

The width of the rings structure in mm. Optionally used to initialize the rings.

Definition at line 37 of file TRestRingsMask.h.


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