REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestStrippedMask.cxx
1/*************************************************************************
2 * This file is part of the REST software framework. *
3 * *
4 * Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
5 * For more information see https://gifna.unizar.es/trex *
6 * *
7 * REST is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * REST is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have a copy of the GNU General Public License along with *
18 * REST in $REST_PATH/LICENSE. *
19 * If not, see https://www.gnu.org/licenses/. *
20 * For the list of contributors see $REST_PATH/CREDITS. *
21 *************************************************************************/
22
106
107#include "TRestStrippedMask.h"
108
109#include "TRandom3.h"
110
111ClassImp(TRestStrippedMask);
112
117
132TRestStrippedMask::TRestStrippedMask(const char* cfgFileName, std::string name)
133 : TRestPatternMask(cfgFileName) {
134 Initialize();
135
137
139}
140
145
151 SetSectionName(this->ClassName());
152 SetType("Stripped");
153}
154
163Int_t TRestStrippedMask::GetRegion(Double_t& x, Double_t& y) {
164 if (TRestPatternMask::GetRegion(x, y)) return 0;
165
166 Double_t xEval = fStripsThickness / 2. + x;
167
168 Int_t xcont = 0;
169 if (xEval > 0) {
170 while (xEval > fStripsGap) {
171 xEval -= fStripsGap;
172 xcont++;
173 }
174 } else {
175 while (xEval < 0) {
176 xEval += fStripsGap;
177 xcont--;
178 }
179 }
180
181 if (xEval < fStripsThickness) return 0;
182
183 xcont = xcont % fModulus;
184 if (xcont < 0) xcont += fModulus;
185
186 return 1 + xcont % fMaxRegions;
187}
188
194
196 RESTMetadata << "++++" << RESTendl;
197}
198
205 RESTMetadata << "----" << RESTendl;
207}
208
214 RESTMetadata << " - Strips gap : " << fStripsGap << " mm" << RESTendl;
215 RESTMetadata << " - Strips thickness : " << fStripsThickness << " mm" << RESTendl;
216}
endl_t RESTendl
Termination flag object for TRestStringOutput.
Int_t LoadConfigFromFile(const std::string &configFilename, const std::string &sectionName="")
Give the file name, find out the corresponding section. Then call the main starter.
TRestStringOutput::REST_Verbose_Level GetVerboseLevel()
returns the verboselevel in type of REST_Verbose_Level enumerator
void SetSectionName(std::string sName)
set the section name, clear the section content
std::string fConfigFileName
Full name of the rml file.
An abstract class used to encapsulate different mask pattern class definitions.
void SetType(const std::string &type)
It defines the mask type. To be called by the inherited class constructor.
Int_t fMaxRegions
The maximum number of regions allowed in each mask.
void PrintMetadata() override
Prints on screen the information about the metadata members of TRestPatternMask.
virtual Int_t GetRegion(Double_t &x, Double_t &y)
To be implemented at the inherited class with the pattern and region identification logic.
void PrintCommonPatternMembers()
Prints on screen the information about the metadata members without header.
@ REST_Info
+show most of the information for each steps
A class used to define a stripped mask pattern.
TRestStrippedMask()
Default constructor.
Double_t fStripsThickness
The width of the stripped structure in mm.
void PrintMask() override
Prints on screen the information about the metadata members of TRestRingsMask, including common patte...
Double_t fStripsGap
The periodity of the stripped structure in mm.
Int_t fModulus
It defines the maximum number of cells/regions in each axis.
void PrintMaskMembers() override
Prints on screen the information about the metadata members of TRestRingsMask, excluding common metad...
void Initialize() override
Function to initialize input/output event members and define the section name.
void PrintMetadata() override
Prints on screen the complete information about the metadata members from this class.
virtual Int_t GetRegion(Double_t &x, Double_t &y) override
It returns a number identifying the region where the particle with coordinates (x,...
~TRestStrippedMask()
Default destructor.