Belle II Software  release-08-01-10
RaytracerBase.cc
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 #include <top/reconstruction_cpp/RaytracerBase.h>
10 #include <top/geometry/TOPGeometryPar.h>
11 #include <framework/logging/Logger.h>
12 #include <algorithm>
13 
14 namespace Belle2 {
19  namespace TOP {
20 
22  A(bar.getWidth()), B(bar.getThickness()), zL(zLeft), reflectivity(bar.getSurfaceReflectivity(3.0)),
23  sigmaAlpha(bar.getSigmaAlpha())
24  {
25  zR = zL + bar.getFullLength();
26  }
27 
28 
30  A(module.getBarWidth()), B(module.getBarThickness()), reflectivity(module.getSurfaceReflectivity(3.0)),
31  sigmaAlpha(module.getSigmaAlpha())
32 
33  {
34  zL = -module.getBarLength() / 2;
35  zR = module.getBarLength() / 2;
36  }
37 
38 
40  xc(module.getMirrorSegment().getXc()), yc(module.getMirrorSegment().getYc()),
41  zc(module.getMirrorSegment().getZc()), R(module.getMirrorSegment().getRadius()),
42  reflectivity(module.getMirrorSegment().getMirrorReflectivity(3.0))
43  {
44  zc += (module.getBarLength() - module.getMirrorSegment().getFullLength()) / 2;
45  zb = zc + R;
46  double Ah = std::max(module.getMirrorSegment().getWidth(), module.getBarWidth()) / 2;
47  double Bh = std::max(module.getMirrorSegment().getThickness(), module.getBarThickness()) / 2;
48  zb = std::min(zb, zc + sqrt(pow(R, 2) - pow(xc - Ah, 2) - pow(yc - Bh, 2)));
49  zb = std::min(zb, zc + sqrt(pow(R, 2) - pow(xc + Ah, 2) - pow(yc - Bh, 2)));
50  zb = std::min(zb, zc + sqrt(pow(R, 2) - pow(xc - Ah, 2) - pow(yc + Bh, 2)));
51  zb = std::min(zb, zc + sqrt(pow(R, 2) - pow(xc + Ah, 2) - pow(yc + Bh, 2)));
52  }
53 
54 
56  A(module.getPrism().getWidth()), B(module.getPrism().getThickness())
57  {
58  yUp = B / 2;
59  const auto& prism = module.getPrism();
60  yDown = yUp - prism.getExitThickness();
61  zR = -module.getBarLength() / 2;
62  zL = zR - prism.getLength();
63  zFlat = zL + prism.getFlatLength();
64  const auto& pmtArray = module.getPMTArray();
65  // a call to prism.getFilterThickness is added for backward compatibility
66  double filterThickness = pmtArray.getFilterThickness() + prism.getFilterThickness();
67  double cookieThickness = pmtArray.getCookieThickness();
68  double pmtWindow = pmtArray.getPMT().getWinThickness();
69  zD = zL - filterThickness - cookieThickness - pmtWindow;
70  slope = (-B / 2 - yDown) / (zR - zFlat);
71 
72  k0 = prism.getK0();
73  unfoldedWindows = prism.getUnfoldedWindows();
74  for (auto& w : unfoldedWindows) w.z0 += zR;
75  }
76 
77 
78  RaytracerBase::RaytracerBase(int moduleID, EGeometry geometry, EOptics optics):
79  m_moduleID(moduleID), m_geometry(geometry), m_optics(optics)
80  {
81  const auto* geo = TOPGeometryPar::Instance()->getGeometry();
82  if (not geo->isModuleIDValid(moduleID)) {
83  B2FATAL("TOP::RaytracerBase: invalid slot number, moduleID = " << moduleID);
84  return;
85  }
86  const auto& module = geo->getModule(moduleID);
87 
88  m_prism = Prism(module);
89  m_mirror = Mirror(module);
90 
91  if (geometry == c_Unified) {
92  m_bars.push_back(BarSegment(module));
93  } else {
94  m_bars.push_back(BarSegment(module.getBarSegment2(), m_prism.zR));
95  m_bars.push_back(BarSegment(module.getBarSegment1(), m_bars.back().zR));
96  m_bars.push_back(BarSegment(module.getMirrorSegment(), m_bars.back().zR));
97  }
98  }
99 
100  void RaytracerBase::setMirrorCenter(double xc, double yc)
101  {
102  m_mirror.xc = xc;
103  m_mirror.yc = yc;
104 
105  double zc = m_mirror.zc;
106  double R = m_mirror.R;
107  double zb = zc + R;
108  double Ah = m_bars.back().A / 2;
109  double Bh = m_bars.back().B / 2;
110  zb = std::min(zb, zc + sqrt(pow(R, 2) - pow(xc - Ah, 2) - pow(yc - Bh, 2)));
111  zb = std::min(zb, zc + sqrt(pow(R, 2) - pow(xc + Ah, 2) - pow(yc - Bh, 2)));
112  zb = std::min(zb, zc + sqrt(pow(R, 2) - pow(xc - Ah, 2) - pow(yc + Bh, 2)));
113  zb = std::min(zb, zc + sqrt(pow(R, 2) - pow(xc + Ah, 2) - pow(yc + Bh, 2)));
114  m_mirror.zb = zb;
115  }
116 
117 
118  } // TOP
120 } // Belle2
121 
122 
double R
typedef autogenerated by FFTW
Geometry parameters of a quartz bar segment.
double getFullLength() const
Returns bar segment length including glue.
Geometry parameters of a module (optical components + positioning)
Definition: TOPGeoModule.h:31
void setMirrorCenter(double xc, double yc)
Sets the mirror center-of-curvature.
EOptics m_optics
spherical mirror optics
EGeometry
Treatement of quartz geometry.
Definition: RaytracerBase.h:33
@ c_Unified
single bar with average width and thickness
Definition: RaytracerBase.h:34
EOptics
Treatement of spherical mirror optics.
Definition: RaytracerBase.h:41
Mirror m_mirror
spherical mirror geometry data
RaytracerBase(int moduleID, EGeometry geometry=c_Unified, EOptics optics=c_SemiLinear)
Constructor.
const Prism & getPrism() const
Returns geometry data of prism.
Prism m_prism
prism geometry data
EGeometry m_geometry
quartz geometry
std::vector< BarSegment > m_bars
geometry data of bar segments
const TOPGeometry * getGeometry() const
Returns pointer to geometry object using basf2 units.
static TOPGeometryPar * Instance()
Static method to obtain the pointer to its instance.
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
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
double yc
center of curvature in y
Definition: RaytracerBase.h:82
double xc
center of curvature in x
Definition: RaytracerBase.h:81
double zb
minimum of mirror surface in z
Definition: RaytracerBase.h:85
double zc
center of curvature in z
Definition: RaytracerBase.h:83
prism data in module local frame.
std::vector< TOPGeoPrism::UnfoldedWindow > unfoldedWindows
unfolded prism exit windows
double yDown
minimal y of exit window
double slope
slope of slanted surface (dy/dz)
double yUp
maximal y of exit window
double zFlat
z where flat continues to slanted surface
double zR
maximal z, i.e position of prism-bar joint
double B
thickness at bar (dimension in y)
double zD
detector (photo-cathode) position
int k0
index of true prism in the vector 'unfoldedWindows'