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

Detailed Description

A class used to define and generate a combined structure mask.

This class is used to generate a combined mask structure by combining any of the predefined existing masks inheriting from TRestPatternMask.

The implementation of TRestCombinedMask::GetRegion method will use the region ids of each internal mask to generate a new unique region id.

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 TRestCombinedMask.

<TRestCombinedMask name="combined3" verboseLevel="info">
...
...
A class used to define and generate a combined structure mask.
A class used to define a rings mask pattern.
A class used to define and generate a spider structure mask.

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

TRestCombinedMask mask("masks.rml", "combined");
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, using the combined definition.

TRestCombinedMask mask("masks.rml", "combined");
TCanvas *c = mask.DrawMonteCarlo(30000);
c->Draw();
c->Print("combined.png");


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

History of developments:

2022-06: First implementation of TRestCombinedMask 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 TRestCombinedMask.h.

#include <TRestCombinedMask.h>

Inheritance diagram for TRestCombinedMask:
TRestPatternMask TRestMetadata

Public Member Functions

void AddMask (TRestPatternMask *mask)
 
 ClassDefOverride (TRestCombinedMask, 1)
 
TRestPatternMask *const & GetMask (unsigned int index) const
 
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...
 
void InitFromConfigFile () override
 Implements class initialization through RML. More...
 
void Initialize () override
 Function to initialize input/output event members and define the section name. More...
 
void PrintMask () override
 Prints on screen the information about the metadata members from this class, including common pattern headers, but without common metadata headers. More...
 
void PrintMaskMembers () override
 Prints on screen the information about the metadata members from this class excluding common metadata headers and any formatting. More...
 
void PrintMetadata () override
 Prints on screen the complete information about the metadata members from this class. More...
 
 TRestCombinedMask ()
 Default constructor. More...
 
 TRestCombinedMask (const char *cfgFileName, std::string name="")
 Constructor loading data from a config file. More...
 
 ~TRestCombinedMask ()
 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 Attributes

std::vector< TRestPatternMask * > fMasks
 

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

◆ TRestCombinedMask() [1/2]

TRestCombinedMask::TRestCombinedMask ( )

Default constructor.

Definition at line 96 of file TRestCombinedMask.cxx.

◆ TRestCombinedMask() [2/2]

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

Definition at line 112 of file TRestCombinedMask.cxx.

◆ ~TRestCombinedMask()

TRestCombinedMask::~TRestCombinedMask ( )

Default destructor.

Definition at line 124 of file TRestCombinedMask.cxx.

Member Function Documentation

◆ AddMask()

void TRestCombinedMask::AddMask ( TRestPatternMask mask)
inline

Definition at line 36 of file TRestCombinedMask.h.

◆ GetMask()

TRestPatternMask *const & TRestCombinedMask::GetMask ( unsigned int  index) const
inline

Definition at line 38 of file TRestCombinedMask.h.

◆ GetRegion()

Int_t TRestCombinedMask::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::ApplyCommonMaskTransformation

Reimplemented from TRestPatternMask.

Definition at line 148 of file TRestCombinedMask.cxx.

◆ InitFromConfigFile()

void TRestCombinedMask::InitFromConfigFile ( )
overridevirtual

Implements class initialization through RML.

Reimplemented from TRestMetadata.

Definition at line 173 of file TRestCombinedMask.cxx.

◆ Initialize()

void TRestCombinedMask::Initialize ( )
overridevirtual

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

Reimplemented from TRestMetadata.

Definition at line 130 of file TRestCombinedMask.cxx.

◆ PrintMask()

void TRestCombinedMask::PrintMask ( )
overridevirtual

Prints on screen the information about the metadata members from this class, including common pattern headers, but without common metadata headers.

Reimplemented from TRestPatternMask.

Definition at line 207 of file TRestCombinedMask.cxx.

◆ PrintMaskMembers()

void TRestCombinedMask::PrintMaskMembers ( )
overridevirtual

Prints on screen the information about the metadata members from this class excluding common metadata headers and any formatting.

Reimplemented from TRestPatternMask.

Definition at line 216 of file TRestCombinedMask.cxx.

◆ PrintMetadata()

void TRestCombinedMask::PrintMetadata ( )
overridevirtual

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

Reimplemented from TRestMetadata.

Definition at line 189 of file TRestCombinedMask.cxx.

Field Documentation

◆ fMasks

std::vector<TRestPatternMask*> TRestCombinedMask::fMasks
private

Definition at line 31 of file TRestCombinedMask.h.


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