REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestAxionWolterOptics.h
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 http://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 http://www.gnu.org/licenses/. *
20  * For the list of contributors see $REST_PATH/CREDITS. *
21  *************************************************************************/
22 
23 #ifndef _TRestAxionWolterOptics
24 #define _TRestAxionWolterOptics
25 #include <TRestAxionOptics.h>
26 #include <TRestRingsMask.h>
27 #include <TRestSpiderMask.h>
28 #include <TRestTools.h>
29 
30 #include <iostream>
31 
34  private:
36  std::vector<Double_t> fR1;
37 
39  std::vector<Double_t> fR2;
40 
42  std::vector<Double_t> fR3;
43 
45  std::vector<Double_t> fR4;
46 
48  std::vector<Double_t> fR5;
49 
51  std::vector<Double_t> fAlpha;
52 
54  std::vector<Double_t> fThickness;
55 
59  std::vector<Double_t> fXSep;
60 
62  TRestSpiderMask* fSpiderMask = nullptr; //<
63 
66 
69 
72 
74  std::vector<Double_t> fCosAlpha;
75 
77  std::vector<Double_t> fCosAlpha_3;
78 
80  std::vector<Double_t> fFrontVertex;
81 
83  std::vector<Double_t> fBackVertex;
84 
85  Int_t FirstMirrorReflection(const TVector3& pos, const TVector3& dir) override;
86  Int_t SecondMirrorReflection(const TVector3& pos, const TVector3& dir) override;
87 
88  public:
89  void Initialize() override;
90 
92  std::vector<Double_t> GetR1() {
93  std::vector<Double_t> r = TRestTools::GetColumnFromTable(fOpticsData, 0);
94  return r;
95  }
96 
98  std::vector<Double_t> GetR2() {
99  std::vector<Double_t> r = TRestTools::GetColumnFromTable(fOpticsData, 1);
100  return r;
101  }
102 
104  std::vector<Double_t> GetR3() {
105  std::vector<Double_t> r = TRestTools::GetColumnFromTable(fOpticsData, 2);
106  return r;
107  }
108 
110  std::vector<Double_t> GetR4() {
111  std::vector<Double_t> r = TRestTools::GetColumnFromTable(fOpticsData, 3);
112  return r;
113  }
114 
116  std::vector<Double_t> GetR5() {
117  std::vector<Double_t> r = TRestTools::GetColumnFromTable(fOpticsData, 4);
118  return r;
119  }
120 
122  std::vector<Double_t> GetAlpha() {
123  std::vector<Double_t> alpha = TRestTools::GetColumnFromTable(fOpticsData, 5);
124  for (auto& x : alpha) x = x * units("rad") / units("deg");
125  return alpha;
126  }
127 
129  std::vector<Double_t> GetThickness() {
130  std::vector<Double_t> t = TRestTools::GetColumnFromTable(fOpticsData, 7);
131  return t;
132  }
133 
135  Double_t GetEntrancePositionZ() override {
136  if (fCosAlpha.size() > 0) return -fMirrorLength * fCosAlpha[0] - 0.5 * fXSep[0];
137  return 0;
138  }
139 
141  Double_t GetExitPositionZ() override {
142  if (fCosAlpha_3.size() > 0) return fMirrorLength * fCosAlpha_3[0] + 0.5 * fXSep[0];
143  return 0;
144  }
145 
146  std::pair<Double_t, Double_t> GetRadialLimits() override {
147  std::pair<Double_t, Double_t> result(0, 0);
148  if (!fR1.empty()) {
149  result = {fR1.front(), fR1.back()};
150  }
151  return result;
152  }
153 
154  void SetMirror() override {
155  Double_t x = fEntrancePosition.X();
156  Double_t y = fEntrancePosition.Y();
158  }
159 
160  TPad* DrawMirrors() override;
161 
162  void PrintParameters();
163  void PrintSpider();
164  void PrintMetadata() override;
165  void InitFromConfigFile() override;
166 
168  TRestAxionWolterOptics(const char* cfgFileName, std::string name = "");
170 
171  ClassDefOverride(TRestAxionWolterOptics, 1);
172 };
173 #endif
An abstract class to define common optics parameters and methods.
Int_t fCurrentMirror
During the photon propagation it keeps track of the active mirror shell.
std::vector< std::vector< Double_t > > fOpticsData
The optics data table extracted from fOpticsFile.
Double_t fMirrorLength
The mirror length. If all mirrors got the same length. Otherwise will be zero.
TVector3 fEntrancePosition
The particle position at the optics plane entrance.
A class that calculates the reflection path of X-rays through a Wolter 1 telescope.
std::vector< Double_t > fXSep
std::vector< Double_t > fBackVertex
The Z-position of the cone vertex defined by the back mirrors.
TRestRingsMask * fEntranceRingsMask
The rings structure to be used at entrance as an optical opaque mask.
Double_t GetEntrancePositionZ() override
It returns the entrance Z-position defined by the optical axis.
std::vector< Double_t > fR3
Radius R3 in mm. See schematic figure.
std::vector< Double_t > fR4
Radius R4 in mm. See schematic figure.
std::vector< Double_t > fAlpha
Mirror angle (alpha) in radians. See schematic figure.
TRestAxionWolterOptics()
Default constructor.
std::vector< Double_t > GetR1()
It returns a vector with the values of R1.
std::vector< Double_t > fThickness
Mirror thickness in mm. See schematic figure.
void PrintSpider()
It prints out the spider mask common to all the optical planes.
void InitFromConfigFile() override
Initialization of TRestAxionWolterOptics field members through a RML file.
std::vector< Double_t > GetR2()
It returns a vector with the values of R2.
TRestRingsMask * fExitRingsMask
The rings structure to be used at entrance as an optical opaque mask.
Int_t SecondMirrorReflection(const TVector3 &pos, const TVector3 &dir) override
Implementation of first mirror interaction. It updates fSecondInteractionPosition and fExitDirection ...
TRestRingsMask * fMiddleRingsMask
The rings structure to be used at entrance as an optical opaque mask.
void PrintMetadata() override
Prints on screen the information about the metadata members of TRestAxionWolterOptics.
std::vector< Double_t > GetThickness()
It returns a vector with the values of mirror thickness.
std::vector< Double_t > GetR4()
It returns a vector with the values of R4.
void SetMirror() override
It must be implemented at the inherited optics, making use of fEntrancePosition.
std::vector< Double_t > fCosAlpha
Mirror pre-calculated cosine angle (alpha). See schematic figure.
std::vector< Double_t > GetAlpha()
It returns a vector with the values of alpha.
void PrintParameters()
It prints out the Wolter (relevant) parameters extracted from the optics data file,...
std::vector< Double_t > fR2
Radius R2 in mm. See schematic figure.
TPad * DrawMirrors() override
A method to to draw an optics schematic including the mirrors geometry.
std::vector< Double_t > fR5
Radius R5 in mm. See schematic figure.
Int_t FirstMirrorReflection(const TVector3 &pos, const TVector3 &dir) override
Implementation of first mirror interaction. It updates fFirstInteractionPosition and fMiddleDirection...
TRestSpiderMask * fSpiderMask
The spider structure to be used as an optical opaque mask (common to all planes)
std::vector< Double_t > fCosAlpha_3
Mirror pre-calculated cosine angle (alpha). See schematic figure.
std::vector< Double_t > fR1
Entrance radius R1 in mm. See schematic figure.
~TRestAxionWolterOptics()
Default destructor.
std::pair< Double_t, Double_t > GetRadialLimits() override
It returns the lower/higher radius range where photons are allowed.
void Initialize() override
Initialization of TRestAxionWolterOptics members.
std::vector< Double_t > GetR5()
It returns a vector with the values of R5.
std::vector< Double_t > fFrontVertex
The Z-position of the cone vertex defined by the front mirrors.
std::vector< Double_t > GetR3()
It returns a vector with the values of R3.
Double_t GetExitPositionZ() override
It returns the exit Z-position defined by the optical axis.
A class used to define a rings mask pattern.
virtual Int_t GetRegion(Double_t &x, Double_t &y) override
It returns a number identifying the region where the particle with coordinates (x,...
A class used to define and generate a spider structure mask.
static std::vector< T > GetColumnFromTable(const std::vector< std::vector< T >> &data, unsigned int column)
It returns a vector with the values extracted from the particular column inside the data table given ...
Definition: TRestTools.cxx:494