Belle II Software  release-06-02-00
PhotonState.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 
11 #include <top/reconstruction_cpp/RaytracerBase.h>
12 #include <top/reconstruction_cpp/func.h>
13 #include <TVector3.h>
14 
15 namespace Belle2 {
20  namespace TOP {
21 
25  class PhotonState {
26 
27  public:
28 
32  enum EType {
36  c_Prism = 3
37  };
38 
43  {}
44 
50  PhotonState(const TVector3& position, const TVector3& direction);
51 
59  PhotonState(const TVector3& position, double kx, double ky, double kz);
60 
68  PhotonState(const TVector3& position, const TVector3& trackDir, double thc, double fic);
69 
73  PhotonState& flipKy() {m_ky = -m_ky; return *this;}
74 
79  static void setMaxPropagationLen(double maxLen) {s_maxLen = maxLen;}
80 
85  TVector3 getPosition() const {return TVector3(m_x, m_y, m_z);}
86 
91  double getX() const {return m_x;}
92 
97  double getY() const {return m_y;}
98 
103  double getZ() const {return m_z;}
104 
110  double getUnfoldedX(double x) const {return func::unfold(x, m_nx, m_A);}
111 
117  double getUnfoldedY(double y) const {return (func::unfold(y - m_y0, m_ny, m_B) + m_y0);}
118 
123  double getXD() const {return getUnfoldedX(m_x);}
124 
129  double getYD() const {return m_yD;}
130 
135  double getZD() const {return m_zD;}
136 
141  TVector3 getDirection() const {return TVector3(m_kx, m_ky, m_kz);}
142 
147  double getKx() const {return m_kx;}
148 
153  double getKy() const {return m_ky;}
154 
159  double getKz() const {return m_kz;}
160 
165  double getPropagationLen() const {return m_propLen;}
166 
171  int getNx() const {return m_nx;}
172 
177  int getNy() const {return m_ny;}
178 
183  double getA() const {return m_A;}
184 
190  double getB() const {return m_B;}
191 
196  EType getSegmentType() const {return m_type;}
197 
202  bool getPropagationStatus() const {return m_status;}
203 
209  bool getTotalReflStatus(double cosTotal) const
210  {
211  return ((m_nx == 0 or m_cosx < cosTotal) and (m_ny == 0 or m_cosy < cosTotal));
212  }
213 
219  bool isInside(const RaytracerBase::BarSegment& bar) const;
220 
227  bool isInside(const RaytracerBase::BarSegment& bar, const RaytracerBase::Mirror& mirror) const;
228 
234  bool isInside(const RaytracerBase::Prism& prism) const;
235 
241  void propagate(const RaytracerBase::BarSegment& bar);
242 
254 
261  void propagateExact(const RaytracerBase::BarSegment& bar, const RaytracerBase::Mirror& mirror);
262 
268  void propagate(const RaytracerBase::Prism& prism);
269 
270  private:
271 
272  double m_x = 0;
273  double m_y = 0;
274  double m_z = 0;
275  double m_kx = 0;
276  double m_ky = 0;
277  double m_kz = 0;
278  double m_propLen = 0;
279  int m_nx = 0;
280  int m_ny = 0;
281  double m_cosx = 0;
282  double m_cosy = 0;
283  double m_A = 0;
284  double m_B = 0;
285  double m_y0 = 0;
286  double m_yD = 0;
287  double m_zD = 0;
289  bool m_status = false;
291  static double s_maxLen;
293  };
294 
295  } // namespace TOP
297 } // namespace Belle2
298 
State of the Cerenkov photon in the quartz optics.
Definition: PhotonState.h:25
double m_y0
origin in y for unfolding
Definition: PhotonState.h:285
EType m_type
quartz segment type at last propagation step
Definition: PhotonState.h:288
PhotonState & flipKy()
Changes sign of direction y component.
Definition: PhotonState.h:73
double getZD() const
Returns detection position z in unfolded prism.
Definition: PhotonState.h:135
double m_cosy
maximal cosine of impact angle to surface in y
Definition: PhotonState.h:282
double getPropagationLen() const
Returns total propagation length since initial position.
Definition: PhotonState.h:165
int m_nx
signed number of reflections in x at last propagation step
Definition: PhotonState.h:279
double getUnfoldedY(double y) const
Unfolds the position in y.
Definition: PhotonState.h:117
double getX() const
Returns position in x.
Definition: PhotonState.h:91
double m_zD
unfolded prism detection position in z
Definition: PhotonState.h:287
double getKy() const
Returns direction in y.
Definition: PhotonState.h:153
void propagate(const RaytracerBase::BarSegment &bar)
Propagate photon to the exit of bar segment.
Definition: PhotonState.cc:81
double m_x
position in x
Definition: PhotonState.h:272
static double s_maxLen
maximal allowed propagation length
Definition: PhotonState.h:291
int getNx() const
Returns number of reflections in x at last propagation step.
Definition: PhotonState.h:171
double getYD() const
Returns detection position y in unfolded prism.
Definition: PhotonState.h:129
PhotonState()
Default constructor.
Definition: PhotonState.h:42
double m_ky
direction in y
Definition: PhotonState.h:276
double getA() const
Returns width (dimension in x) of the quartz segment at last propagation step.
Definition: PhotonState.h:183
double m_A
width of the quartz segment (dimension in x) for unfolding
Definition: PhotonState.h:283
bool getTotalReflStatus(double cosTotal) const
Returns total internal reflection status.
Definition: PhotonState.h:209
double m_cosx
maximal cosine of impact angle to surface in x
Definition: PhotonState.h:281
int m_ny
signed number of reflections in y at last propagation step
Definition: PhotonState.h:280
double m_kx
direction in x
Definition: PhotonState.h:275
double getZ() const
Returns position in z.
Definition: PhotonState.h:103
double m_yD
unfolded prism detection position in y
Definition: PhotonState.h:286
double m_B
thickness of the quartz segment (dimension in y) for unfolding
Definition: PhotonState.h:284
TVector3 getPosition() const
Returns position as 3D vector.
Definition: PhotonState.h:85
bool m_status
propagation status
Definition: PhotonState.h:289
double getY() const
Returns position in y.
Definition: PhotonState.h:97
int getNy() const
Returns number of reflections in y at last propagation step.
Definition: PhotonState.h:177
void propagateSemiLinear(const RaytracerBase::BarSegment &bar, const RaytracerBase::Mirror &mirror)
Propagate photon to the mirror and reflect it using semi-linear mirror optics.
Definition: PhotonState.cc:109
bool getPropagationStatus() const
Returns propagation status.
Definition: PhotonState.h:202
double m_z
position in z
Definition: PhotonState.h:274
static void setMaxPropagationLen(double maxLen)
Sets maximal allowed propagation length.
Definition: PhotonState.h:79
double getB() const
Returns thickness (dimension in y) of the quartz segment at last propagation step.
Definition: PhotonState.h:190
EType
enumerator for the type of quartz segments
Definition: PhotonState.h:32
@ c_BarSegment
bar segment
Definition: PhotonState.h:34
@ c_MirrorSegment
mirror segment
Definition: PhotonState.h:35
double getKz() const
Returns direction in z.
Definition: PhotonState.h:159
double m_y
position in y
Definition: PhotonState.h:273
EType getSegmentType() const
Returns the type of the quartz segment at last propagation.
Definition: PhotonState.h:196
double m_propLen
propagation length since initial position
Definition: PhotonState.h:278
void propagateExact(const RaytracerBase::BarSegment &bar, const RaytracerBase::Mirror &mirror)
Propagate photon to the mirror and reflect it using exact mirror optics.
Definition: PhotonState.cc:175
double getKx() const
Returns direction in x.
Definition: PhotonState.h:147
double getUnfoldedX(double x) const
Unfolds the position in x.
Definition: PhotonState.h:110
bool isInside(const RaytracerBase::BarSegment &bar) const
Checks if photon is inside the bar segment (including surface).
Definition: PhotonState.cc:50
double m_kz
direction in z
Definition: PhotonState.h:277
TVector3 getDirection() const
Returns direction as 3D unit vector.
Definition: PhotonState.h:141
double getXD() const
Returns detection position x in unfolded prism.
Definition: PhotonState.h:123
double unfold(double x, int nx, double A)
unfold a coordinate.
Definition: func.h:29
Abstract base class for different kinds of events.
bar segment data in module local frame.
Definition: RaytracerBase.h:49
spherical mirror data in module local frame.
Definition: RaytracerBase.h:79
prism data in module local frame.