Belle II Software  release-08-01-10
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 <Math/Vector3D.h>
14 #include <Math/Point3D.h>
15 
16 
17 namespace Belle2 {
22  namespace TOP {
23 
27  class PhotonState {
28 
29  public:
30 
34  enum EType {
38  c_Prism = 3
39  };
40 
45  {}
46 
52  PhotonState(const ROOT::Math::XYZPoint& position, const ROOT::Math::XYZVector& direction);
53 
61  PhotonState(const ROOT::Math::XYZPoint& position, double kx, double ky, double kz);
62 
70  PhotonState(const ROOT::Math::XYZPoint& position, const ROOT::Math::XYZVector& trackDir, double thc, double fic);
71 
75  PhotonState& flipKy() {m_ky = -m_ky; return *this;}
76 
81  static void setMaxPropagationLen(double maxLen) {s_maxLen = maxLen;}
82 
87  ROOT::Math::XYZPoint getPosition() const {return ROOT::Math::XYZPoint(m_x, m_y, m_z);}
88 
93  double getX() const {return m_x;}
94 
99  double getY() const {return m_y;}
100 
105  double getZ() const {return m_z;}
106 
112  double getUnfoldedX(double x) const {return func::unfold(x, m_nx, m_A);}
113 
119  double getUnfoldedY(double y) const {return (func::unfold(y - m_y0, m_ny, m_B) + m_y0);}
120 
125  double getXD() const {return getUnfoldedX(m_x);}
126 
131  double getYD() const {return m_yD;}
132 
137  double getZD() const {return m_zD;}
138 
143  ROOT::Math::XYZVector getDirection() const {return ROOT::Math::XYZVector(m_kx, m_ky, m_kz);}
144 
149  double getKx() const {return m_kx;}
150 
155  double getKy() const {return m_ky;}
156 
161  double getKz() const {return m_kz;}
162 
167  double getPropagationLen() const {return m_propLen;}
168 
173  int getNx() const {return m_nx;}
174 
179  int getNy() const {return m_ny;}
180 
185  double getA() const {return m_A;}
186 
192  double getB() const {return m_B;}
193 
198  EType getSegmentType() const {return m_type;}
199 
204  bool getPropagationStatus() const {return m_status;}
205 
211  bool getTotalReflStatus(double cosTotal) const
212  {
213  return ((m_nx == 0 or m_cosx < cosTotal) and (m_ny == 0 or m_cosy < cosTotal));
214  }
215 
221  bool isInside(const RaytracerBase::BarSegment& bar) const;
222 
229  bool isInside(const RaytracerBase::BarSegment& bar, const RaytracerBase::Mirror& mirror) const;
230 
236  bool isInside(const RaytracerBase::Prism& prism) const;
237 
243  void propagate(const RaytracerBase::BarSegment& bar);
244 
256 
263  void propagateExact(const RaytracerBase::BarSegment& bar, const RaytracerBase::Mirror& mirror);
264 
270  void propagate(const RaytracerBase::Prism& prism);
271 
272  private:
273 
274  double m_x = 0;
275  double m_y = 0;
276  double m_z = 0;
277  double m_kx = 0;
278  double m_ky = 0;
279  double m_kz = 0;
280  double m_propLen = 0;
281  int m_nx = 0;
282  int m_ny = 0;
283  double m_cosx = 0;
284  double m_cosy = 0;
285  double m_A = 0;
286  double m_B = 0;
287  double m_y0 = 0;
288  double m_yD = 0;
289  double m_zD = 0;
291  bool m_status = false;
293  static double s_maxLen;
295  };
296 
297  } // namespace TOP
299 } // namespace Belle2
300 
State of the Cerenkov photon in the quartz optics.
Definition: PhotonState.h:27
double m_y0
origin in y for unfolding
Definition: PhotonState.h:287
EType m_type
quartz segment type at last propagation step
Definition: PhotonState.h:290
PhotonState & flipKy()
Changes sign of direction y component.
Definition: PhotonState.h:75
double getZD() const
Returns detection position z in unfolded prism.
Definition: PhotonState.h:137
double m_cosy
maximal cosine of impact angle to surface in y
Definition: PhotonState.h:284
double getPropagationLen() const
Returns total propagation length since initial position.
Definition: PhotonState.h:167
int m_nx
signed number of reflections in x at last propagation step
Definition: PhotonState.h:281
double getUnfoldedY(double y) const
Unfolds the position in y.
Definition: PhotonState.h:119
double getX() const
Returns position in x.
Definition: PhotonState.h:93
double m_zD
unfolded prism detection position in z
Definition: PhotonState.h:289
ROOT::Math::XYZPoint getPosition() const
Returns position as 3D vector.
Definition: PhotonState.h:87
double getKy() const
Returns direction in y.
Definition: PhotonState.h:155
ROOT::Math::XYZVector getDirection() const
Returns direction as 3D unit vector.
Definition: PhotonState.h:143
void propagate(const RaytracerBase::BarSegment &bar)
Propagate photon to the exit of bar segment.
Definition: PhotonState.cc:82
double m_x
position in x
Definition: PhotonState.h:274
static double s_maxLen
maximal allowed propagation length
Definition: PhotonState.h:293
int getNx() const
Returns number of reflections in x at last propagation step.
Definition: PhotonState.h:173
double getYD() const
Returns detection position y in unfolded prism.
Definition: PhotonState.h:131
PhotonState()
Default constructor.
Definition: PhotonState.h:44
double m_ky
direction in y
Definition: PhotonState.h:278
double getA() const
Returns width (dimension in x) of the quartz segment at last propagation step.
Definition: PhotonState.h:185
double m_A
width of the quartz segment (dimension in x) for unfolding
Definition: PhotonState.h:285
bool getTotalReflStatus(double cosTotal) const
Returns total internal reflection status.
Definition: PhotonState.h:211
double m_cosx
maximal cosine of impact angle to surface in x
Definition: PhotonState.h:283
int m_ny
signed number of reflections in y at last propagation step
Definition: PhotonState.h:282
double m_kx
direction in x
Definition: PhotonState.h:277
double getZ() const
Returns position in z.
Definition: PhotonState.h:105
double m_yD
unfolded prism detection position in y
Definition: PhotonState.h:288
double m_B
thickness of the quartz segment (dimension in y) for unfolding
Definition: PhotonState.h:286
bool m_status
propagation status
Definition: PhotonState.h:291
double getY() const
Returns position in y.
Definition: PhotonState.h:99
int getNy() const
Returns number of reflections in y at last propagation step.
Definition: PhotonState.h:179
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:110
bool getPropagationStatus() const
Returns propagation status.
Definition: PhotonState.h:204
double m_z
position in z
Definition: PhotonState.h:276
static void setMaxPropagationLen(double maxLen)
Sets maximal allowed propagation length.
Definition: PhotonState.h:81
double getB() const
Returns thickness (dimension in y) of the quartz segment at last propagation step.
Definition: PhotonState.h:192
EType
enumerator for the type of quartz segments
Definition: PhotonState.h:34
@ c_BarSegment
bar segment
Definition: PhotonState.h:36
@ c_MirrorSegment
mirror segment
Definition: PhotonState.h:37
double getKz() const
Returns direction in z.
Definition: PhotonState.h:161
double m_y
position in y
Definition: PhotonState.h:275
EType getSegmentType() const
Returns the type of the quartz segment at last propagation.
Definition: PhotonState.h:198
double m_propLen
propagation length since initial position
Definition: PhotonState.h:280
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:176
double getKx() const
Returns direction in x.
Definition: PhotonState.h:149
double getUnfoldedX(double x) const
Unfolds the position in x.
Definition: PhotonState.h:112
bool isInside(const RaytracerBase::BarSegment &bar) const
Checks if photon is inside the bar segment (including surface).
Definition: PhotonState.cc:51
double m_kz
direction in z
Definition: PhotonState.h:279
double getXD() const
Returns detection position x in unfolded prism.
Definition: PhotonState.h:125
double unfold(double x, int nx, double A)
unfold a coordinate.
Definition: func.h:31
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:80
prism data in module local frame.