Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding pattern mask classes #198

Merged
merged 42 commits into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
0296e5c
Merge branch 'jgalan_solar_flux' into jgalan_masks
jgalan May 5, 2022
6ffebaf
Adding a first version of TRestGridMask and TRestPatternMask
jgalan May 5, 2022
89d2df3
REST_MakeMetadata moving to private area
jgalan May 5, 2022
b4f8a27
TRestPatternMask::RotateAndTranslate. Bug fixed
jgalan May 6, 2022
b7da02d
TRestPatternMask::DrawMonteCarlo added. GetRegion is now pure virtual
jgalan May 9, 2022
6ad04f7
TRestGridMask::GetRegion implemented
jgalan May 9, 2022
e8fde35
Adding TRestGridMask montecarlo produced image
jgalan May 9, 2022
cf04c53
TRestGridMask fully documented
jgalan May 9, 2022
24fc9c5
TRestPatternMask is now fully documented
jgalan May 9, 2022
eacdf5d
Adding strippedmask.png
jgalan May 9, 2022
9ae70bb
TRestStrippedMask added
jgalan May 9, 2022
2636c87
Merge branch 'master' into jgalan_masks
jgalan May 9, 2022
652fd26
TRestMetadata::GetSearchPath. Adding examples directory to the search…
jgalan May 9, 2022
fa3c0e6
TRestXYZMask adding forgotten Getters, and minor fix
jgalan May 10, 2022
7705190
TRestRun::ReadFileInfo. Fixing a bug when the data member format must…
jgalan May 10, 2022
68458b4
TRestPatternMask. Fixing an issue with offset
jgalan May 13, 2022
33f4368
TRestPatternMask::PrintMetadata. Adding mask radius
jgalan May 13, 2022
1adc92e
masks.rml Adding TRestRingsMask definition
jgalan May 13, 2022
58a1b5b
Adding ringsmask.png image
jgalan May 13, 2022
d9353a8
Updating rings mask image
jgalan May 13, 2022
b32f5df
Updating masks.rml
jgalan May 13, 2022
51d866d
Merge branch 'master' into jgalan_masks
jgalan May 13, 2022
faffccf
TRestRingsMask added
jgalan May 13, 2022
c863d42
TRestRingsMask. Adding minor documentation fix
jgalan May 23, 2022
612fddf
Merge branch 'master' into jgalan_masks
jgalan May 23, 2022
545adc6
TRestSpiderMask added
jgalan May 23, 2022
41d651a
Merge branch 'master' into jgalan_masks
jgalan May 24, 2022
f3b155f
Merge branch 'master' into jgalan_masks
jgalan May 25, 2022
4a99623
Merge branch 'master' into jgalan_masks
jgalan May 26, 2022
4f0fddd
TRestPatternMask::DrawMonteCarlo. Color scheme updated. Labels size d…
jgalan May 26, 2022
b82569d
pull-submodules.py external is not excluded anymore
jgalan May 26, 2022
8188f18
TRestXYZMask adapted to new RESToutout scheme
jgalan May 26, 2022
fd5f775
TRestSpiderMask. First complete implementation
jgalan May 26, 2022
61b860d
Adding TRestSpiderMask documentation image
jgalan May 26, 2022
6b9e239
examples/masks.rml Adding spider mask examples
jgalan May 26, 2022
abd741a
TRestSpiderMask. Completing documentation
jgalan May 26, 2022
67be54f
Adding combined masks image
jgalan May 27, 2022
7dbb8ce
TRestPatternMask. Adding documentation image
jgalan May 27, 2022
6e13814
Merge branch 'master' into jgalan_masks
jgalan May 27, 2022
b7b674a
REST_MakeMetadata. Removing Initialize duplicate
jgalan May 27, 2022
1f9a8e5
TRestXYZMask adding overrides
jgalan May 27, 2022
7a43eeb
reformat-files.sh - now formatter uses 4 spaces instead of 2
lobis May 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added doc/doxygen/images/gridmask.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/doxygen/images/masks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/doxygen/images/ringsmask.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/doxygen/images/spidermask.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/doxygen/images/strippedmask.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions examples/masks.rml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0"?>
<masks>
<TRestGridMask name="strongback" verboseLevel="warning">
<parameter name="maskRadius" value="20"/>
<parameter name="offset" value="(5,5)mm"/>
<parameter name="rotationAngle" value="0.5"/>
<parameter name="gridGap" value="1cm"/>
<parameter name="gridThickness" value="2mm"/>
</TRestGridMask>
<TRestStrippedMask name="stripped" verboseLevel="warning">
<parameter name="maskRadius" value="2cm"/>
<parameter name="offset" value="(3,3)mm"/>
<parameter name="rotationAngle" value="0.5"/>
<parameter name="stripsGap" value="12mm"/>
<parameter name="stripsThickness" value="1.2mm"/>
</TRestStrippedMask>
<TRestRingsMask name="rings" verboseLevel="warning">
<parameter name="maskRadius" value="9cm"/>
<parameter name="offset" value="(3,3)mm"/>
<parameter name="rotationAngle" value="0.5"/>
<parameter name="ringsGap" value="12mm"/>
<parameter name="ringsThickness" value="9mm"/>
<parameter name="initialRadius" value="3cm"/>
<parameter name="nRings" value="5"/>
</TRestRingsMask>
<TRestSpiderMask name="spider1" verboseLevel="info">
<parameter name="maskRadius" value="20cm"/>
<parameter name="offset" value="(0,0)cm"/>
<parameter name="rotationAngle" value="10"/>
<parameter name="armsWidth" value="5deg"/>
<parameter name="armsSeparationAngle" value="80degrees"/>
<parameter name="initialRadius" value="12cm"/>
</TRestSpiderMask>
<TRestSpiderMask name="spider2" verboseLevel="info">
<parameter name="maskRadius" value="20cm"/>
<parameter name="offset" value="(0,0)cm"/>
<parameter name="rotationAngle" value="0"/>
<parameter name="armsWidth" value="5deg"/>
<parameter name="armsSeparationAngle" value="30degrees"/>
<parameter name="initialRadius" value="3cm"/>
</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"/>
</TRestSpiderMask>
</masks>
4 changes: 2 additions & 2 deletions macros/REST_MakeMetadata.C
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ Int_t REST_MakeMetadata(TString name) {
headerFile << " /// REMOVE MEMBER. A dummy member that will be NOT written to the ROOT file." << endl;
headerFile << " Double_t fDummyVar = 3.14; //!" << endl;
headerFile << endl;
headerFile << " void Initialize() override;" << endl;
headerFile << endl;
headerFile << "public:" << endl;
headerFile << " /// UPDATE Documentation of dummy getter" << endl;
headerFile << " Double_t GetDummy() { return fDummy;}" << endl;
Expand All @@ -83,8 +85,6 @@ Int_t REST_MakeMetadata(TString name) {
headerFile << " /// UPDATE Documentation of dummy setter" << endl;
headerFile << " void SetDummyVar( const Double_t &dummy) { fDummyVar = dummy;}" << endl;
headerFile << endl;
headerFile << " void Initialize() override;" << endl;
headerFile << endl;
headerFile << "public:" << endl;
headerFile << " void PrintMetadata() override;" << endl;
headerFile << endl;
Expand Down
2 changes: 1 addition & 1 deletion pull-submodules.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def print_help():
print_help()
sys.exit(1)

exclude_elems = ["userguide", "data", "external"]
exclude_elems = ["userguide", "data"]
for x in range(len(sys.argv) - 1):
if sys.argv[x + 1] == "--lfna":
lfna = True
Expand Down
8 changes: 4 additions & 4 deletions source/framework/core/inc/TRestProcessRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ class TRestProcessRunner : public TRestMetadata {

// self variables for processing
std::vector<TRestThread*> fThreads; //!
TFile* fOutputDataFile; //! the TFile pointer being used
TString fOutputDataFileName; //! indicates the name of the first file created as output data file. The actual
//! output file maybe changed if tree is too large
TTree* fEventTree; //!
TFile* fOutputDataFile; //! the TFile pointer being used
TString fOutputDataFileName; //! indicates the name of the first file created as output data file. The
//! actual output file maybe changed if tree is too large
TTree* fEventTree; //!
TRestAnalysisTree* fAnalysisTree; //!
ProcStatus fProcStatus; //!
Int_t fNBranches; //!
Expand Down
62 changes: 62 additions & 0 deletions source/framework/tools/inc/TRestGridMask.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*************************************************************************
* This file is part of the REST software framework. *
* *
* Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
* For more information see https://gifna.unizar.es/trex *
* *
* REST is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* REST is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have a copy of the GNU General Public License along with *
* REST in $REST_PATH/LICENSE. *
* If not, see https://www.gnu.org/licenses/. *
* For the list of contributors see $REST_PATH/CREDITS. *
*************************************************************************/

#ifndef REST_TRestGridMask
#define REST_TRestGridMask

#include <TRestPatternMask.h>

/// A class used to define a grid mask pattern
class TRestGridMask : public TRestPatternMask {
private:
void Initialize();

/// The periodity of the grid structure in mm
Double_t fGridGap = 1; //<

/// The width of the grid structure in mm
Double_t fGridThickness = 0.5; //<

/// It defines the maximum number of cells/regions in each axis
Int_t fModulus = 10; //<

public:
virtual Int_t GetRegion(Double_t x, Double_t y);

/// It returns the gap/periodicity of the grid in mm
Double_t GetGridGap() { return fGridGap; }

/// It returns the thickness of the grid in mm
Double_t GetGridThickness() { return fGridThickness; }

/// It returns the modulus used to define a finite set of ids
Int_t GetModulus() { return fModulus; }

void PrintMetadata();

TRestGridMask();
TRestGridMask(const char* cfgFileName, std::string name = "");
~TRestGridMask();

ClassDef(TRestGridMask, 1);
jgalan marked this conversation as resolved.
Show resolved Hide resolved
};
#endif
91 changes: 91 additions & 0 deletions source/framework/tools/inc/TRestPatternMask.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*************************************************************************
* This file is part of the REST software framework. *
* *
* Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
* For more information see https://gifna.unizar.es/trex *
* *
* REST is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* REST is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have a copy of the GNU General Public License along with *
* REST in $REST_PATH/LICENSE. *
* If not, see https://www.gnu.org/licenses/. *
* For the list of contributors see $REST_PATH/CREDITS. *
*************************************************************************/

#ifndef REST_TRestPatternMask
#define REST_TRestPatternMask

#include <TCanvas.h>

#include <TRestMetadata.h>

/// An abstract class used to encapsulate different mask pattern class definitions.
class TRestPatternMask : public TRestMetadata {
private:
/// It is used to introduce an offset on the pattern
TVector2 fOffset = TVector2(0, 0); //<

/// An angle (in radians) used to introduce a rotation to the pattern
Double_t fRotationAngle = 0; //<

/// The pattern type (Stripped/Grid/Spider/Rings)
std::string fPatternType = ""; //<

/// A canvas for drawing
TCanvas* fCanvas = nullptr; //!

protected:
/// The maximum mask radius in mm (if 0 it will be infinite)
Double_t fMaskRadius = 0;

/// It defines the mask type. To be called by the inherited class constructor.
void SetType(const std::string& type) { fPatternType = type; }

Int_t ApplyCommonMaskTransformation(Double_t& x, Double_t& y);

TRestPatternMask();
TRestPatternMask(const char* cfgFileName, std::string name = "");

public:
Bool_t HitsPattern(Double_t x, Double_t y);

virtual Int_t GetRegion(Double_t x, Double_t y) = 0;

/// It returns the mask pattern type
std::string GetType() { return fPatternType; }

/// It returns the rotation angle
Double_t GetRotationAngle() { return fRotationAngle; }

/// It returns the rotation angle
TVector2 GetOffset() { return fOffset; }

/// It returns the mask radius
Double_t GetMaskRadius() { return fMaskRadius; }

/// It defines the rotation angle
void SetRotationAngle(const Double_t& angle) { fRotationAngle = angle; }

/// It defines the pattern offset
void SetOffset(const TVector2& offset) { fOffset = offset; }

/// It defines the mask radius
void SetMaskRadius(const Double_t& radius) { fMaskRadius = radius; }

void PrintMetadata();

TCanvas* DrawMonteCarlo(Int_t nSamples = 10000);

~TRestPatternMask();

ClassDef(TRestPatternMask, 1);
jgalan marked this conversation as resolved.
Show resolved Hide resolved
};
#endif
86 changes: 86 additions & 0 deletions source/framework/tools/inc/TRestRingsMask.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*************************************************************************
* This file is part of the REST software framework. *
* *
* Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
* For more information see https://gifna.unizar.es/trex *
* *
* REST is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* REST is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have a copy of the GNU General Public License along with *
* REST in $REST_PATH/LICENSE. *
* If not, see https://www.gnu.org/licenses/. *
* For the list of contributors see $REST_PATH/CREDITS. *
*************************************************************************/

#ifndef REST_TRestRingsMask
#define REST_TRestRingsMask

#include <TRestPatternMask.h>

/// A class used to define a rings mask pattern
class TRestRingsMask : public TRestPatternMask {
private:
void Initialize();

/// The periodity of the rings structure in mm. Optionally used to initialize the rings.
Double_t fRingsGap = 0; //<

/// The width of the rings structure in mm. Optionally used to initialize the rings.
Double_t fRingsThickness = 0; //<

/// The number of rings inside the structure.
Int_t fNRings = 0; //<

/// The initial radius for the inner ring
Double_t fInitialRadius = 0; //<

/// A pair containing inner/outter radius for each ring
std::vector<std::pair<Double_t, Double_t>> fRingsRadii; //<

public:
void GenerateRings();

virtual Int_t GetRegion(Double_t x, Double_t y);

/// It returns the gap/periodicity of the rings in mm
Double_t GetRingsGap() { return fRingsGap; }

/// It returns the thickness of the rings in mm
Double_t GetRingsThickness() { return fRingsThickness; }

/// It returns the number of rings to be generated
Double_t GetNumberOfRings() { return fNRings; }

/// It returns the most inner ring radius
Double_t GetInitialRadius() { return fInitialRadius; }

/// It allows to redefine the inner and outter rings radii directly
void SetRadii(const std::vector<Double_t>& innerR, const std::vector<Double_t>& outterR) {
if (innerR.size() != outterR.size()) {
RESTWarning << "TRestRingsMask::SetRadii. Vectors have not the same size!" << RESTendl;
return;
}

for (int n = 0; n < innerR.size(); n++) {
std::pair<Double_t, Double_t> p(innerR[n], outterR[n]);
fRingsRadii.push_back(p);
}
}

void PrintMetadata();

TRestRingsMask();
TRestRingsMask(const char* cfgFileName, std::string name = "");
~TRestRingsMask();

ClassDef(TRestRingsMask, 1);
};
#endif
Loading