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

Detailed Description

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

This class is used to generate a spider mask structure defined by arms distributed at a fixed angular period, defined by fArmsSeparationAngle,

The spider 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. The circular mask imposed by TRestPatternMask will still be centered at (0,0).

Specific spider metadata parameters

Note
Once those parameters have been initialized, and when using this class in a stand-alone mode, we need to call the method TRestSpiderMask::GenerateSpider in order to initialize the internal data members TRestSpiderMask::fPositiveRanges and TRestSpiderMask::fNegativeRanges that are effectively used inside the TRestSpiderMask::GetRegion calculation.

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

<TRestSpiderMask name="spider3" verboseLevel="info">
<parameter name="maskRadius" value="20cm"/>
<parameter name="offset" value="(0,0)cm"/>
<parameter name="rotationAngle" value="30deg"/>
<parameter name="armsWidth" value="5deg"/>
<parameter name="armsSeparationAngle" value="60degrees"/>
<parameter name="initialRadius" value="6cm"/>
A class used to define and generate a spider structure mask.

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

TRestSpiderMask mask("masks.rml", "spider");
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 spider1, spider2 and spider3 definitions.

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


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

History of developments:

2022-05: First implementation of TRestSpiderMask 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 TRestSpiderMask.h.

#include <TRestSpiderMask.h>

Inheritance diagram for TRestSpiderMask:
TRestPatternMask TRestMetadata

Public Member Functions

 ClassDefOverride (TRestSpiderMask, 2)
 
void GenerateSpider ()
 This method is used to initialize the spider arm angles data members that are used to determine if a particle hits the spider pattern. More...
 
Double_t GetArmsSeparationAngle ()
 It returns the gap/periodicity of the spider structure arms in radians. More...
 
Double_t GetArmsWidth ()
 It returns the angular width of each spider arm in radians. More...
 
Double_t GetInitialRadius ()
 It returns the inner ring radius that defines the inner start of the spider structure. 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...
 
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. More...
 
void PrintMetadata () override
 Prints on screen the complete information about the metadata members from this class. More...
 
 TRestSpiderMask ()
 Default constructor. More...
 
 TRestSpiderMask (const char *cfgFileName, std::string name="")
 Constructor loading data from a config file. More...
 
 ~TRestSpiderMask ()
 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 fArmsSeparationAngle = 0
 The angle between two consecutive spider arms measured in radians. More...
 
Double_t fArmsWidth = TMath::Pi() / 18. / 4.
 The width of each specific spider arm. Measured in radians. Default is 2.5 degrees. More...
 
Double_t fInitialRadius = 20.
 The spider structure will be effective from this radius, in mm. Default is from 20 mm. More...
 
Double_t fInternalRegionRadius = 0.
 Radius of an internal circular region defined inside the fInitialRadius. If 0, there will be no region. More...
 
std::vector< std::pair< Double_t, Double_t > > fNegativeRanges
 Used internally to define the forbidden (cosine) ang. ranges imposed by the spider structure (Pi,2Pi) More...
 
std::vector< std::pair< Double_t, Double_t > > fPositiveRanges
 Used internally to define the forbidden (cosine) angular ranges imposed by the spider structure (0,Pi) 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

◆ TRestSpiderMask() [1/2]

TRestSpiderMask::TRestSpiderMask ( )

Default constructor.

Definition at line 125 of file TRestSpiderMask.cxx.

◆ TRestSpiderMask() [2/2]

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

Definition at line 141 of file TRestSpiderMask.cxx.

◆ ~TRestSpiderMask()

TRestSpiderMask::~TRestSpiderMask ( )

Default destructor.

Definition at line 152 of file TRestSpiderMask.cxx.

Member Function Documentation

◆ GenerateSpider()

void TRestSpiderMask::GenerateSpider ( )

This method is used to initialize the spider arm angles data members that are used to determine if a particle hits the spider pattern.

Definition at line 216 of file TRestSpiderMask.cxx.

◆ GetArmsSeparationAngle()

Double_t TRestSpiderMask::GetArmsSeparationAngle ( )
inline

It returns the gap/periodicity of the spider structure arms in radians.

Definition at line 56 of file TRestSpiderMask.h.

◆ GetArmsWidth()

Double_t TRestSpiderMask::GetArmsWidth ( )
inline

It returns the angular width of each spider arm in radians.

Definition at line 59 of file TRestSpiderMask.h.

◆ GetInitialRadius()

Double_t TRestSpiderMask::GetInitialRadius ( )
inline

It returns the inner ring radius that defines the inner start of the spider structure.

Definition at line 62 of file TRestSpiderMask.h.

◆ GetRegion()

Int_t TRestSpiderMask::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 173 of file TRestSpiderMask.cxx.

◆ Initialize()

void TRestSpiderMask::Initialize ( )
overrideprivatevirtual

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

Reimplemented from TRestMetadata.

Definition at line 158 of file TRestSpiderMask.cxx.

◆ PrintMask()

void TRestSpiderMask::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 303 of file TRestSpiderMask.cxx.

◆ PrintMaskMembers()

void TRestSpiderMask::PrintMaskMembers ( )
overridevirtual

Prints on screen the information about the metadata members from this class, excluding common metadata headers.

Reimplemented from TRestPatternMask.

Definition at line 313 of file TRestSpiderMask.cxx.

◆ PrintMetadata()

void TRestSpiderMask::PrintMetadata ( )
overridevirtual

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

Reimplemented from TRestPatternMask.

Definition at line 292 of file TRestSpiderMask.cxx.

Field Documentation

◆ fArmsSeparationAngle

Double_t TRestSpiderMask::fArmsSeparationAngle = 0
private

The angle between two consecutive spider arms measured in radians.

Definition at line 33 of file TRestSpiderMask.h.

◆ fArmsWidth

Double_t TRestSpiderMask::fArmsWidth = TMath::Pi() / 18. / 4.
private

The width of each specific spider arm. Measured in radians. Default is 2.5 degrees.

Definition at line 36 of file TRestSpiderMask.h.

◆ fInitialRadius

Double_t TRestSpiderMask::fInitialRadius = 20.
private

The spider structure will be effective from this radius, in mm. Default is from 20 mm.

Definition at line 39 of file TRestSpiderMask.h.

◆ fInternalRegionRadius

Double_t TRestSpiderMask::fInternalRegionRadius = 0.
private

Radius of an internal circular region defined inside the fInitialRadius. If 0, there will be no region.

Definition at line 42 of file TRestSpiderMask.h.

◆ fNegativeRanges

std::vector<std::pair<Double_t, Double_t> > TRestSpiderMask::fNegativeRanges
private

Used internally to define the forbidden (cosine) ang. ranges imposed by the spider structure (Pi,2Pi)

Definition at line 48 of file TRestSpiderMask.h.

◆ fPositiveRanges

std::vector<std::pair<Double_t, Double_t> > TRestSpiderMask::fPositiveRanges
private

Used internally to define the forbidden (cosine) angular ranges imposed by the spider structure (0,Pi)

Definition at line 45 of file TRestSpiderMask.h.


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