Belle II Software  release-06-01-15
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  {
24  zR = zL + bar.getFullLength();
25  }
26 
27 
29  A(module.getBarWidth()), B(module.getBarThickness()), reflectivity(module.getSurfaceReflectivity(3.0))
30 
31  {
32  zL = -module.getBarLength() / 2;
33  zR = module.getBarLength() / 2;
34  }
35 
36 
38  xc(module.getMirrorSegment().getXc()), yc(module.getMirrorSegment().getYc()),
39  zc(module.getMirrorSegment().getZc()), R(module.getMirrorSegment().getRadius()),
40  reflectivity(module.getMirrorSegment().getMirrorReflectivity(3.0))
41  {
42  zc += (module.getBarLength() - module.getMirrorSegment().getFullLength()) / 2;
43  zb = zc + R;
44  double Ah = std::max(module.getMirrorSegment().getWidth(), module.getBarWidth()) / 2;
45  double Bh = std::max(module.getMirrorSegment().getThickness(), module.getBarThickness()) / 2;
46  zb = std::min(zb, zc + sqrt(pow(R, 2) - pow(xc - Ah, 2) - pow(yc - Bh, 2)));
47  zb = std::min(zb, zc + sqrt(pow(R, 2) - pow(xc + Ah, 2) - pow(yc - Bh, 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  }
51 
52 
54  A(module.getPrism().getWidth()), B(module.getPrism().getThickness())
55  {
56  yUp = B / 2;
57  const auto& prism = module.getPrism();
58  yDown = yUp - prism.getExitThickness();
59  zR = -module.getBarLength() / 2;
60  zL = zR - prism.getLength();
61  zFlat = zL + prism.getFlatLength();
62  const auto& pmtArray = module.getPMTArray();
63  // a call to prism.getFilterThickness is added for backward compatibility
64  double filterThickness = pmtArray.getFilterThickness() + prism.getFilterThickness();
65  double cookieThickness = pmtArray.getCookieThickness();
66  double pmtWindow = pmtArray.getPMT().getWinThickness();
67  zD = zL - filterThickness - cookieThickness - pmtWindow;
68  slope = (-B / 2 - yDown) / (zR - zFlat);
69 
70  k0 = prism.getK0();
71  unfoldedWindows = prism.getUnfoldedWindows();
72  for (auto& w : unfoldedWindows) w.z0 += zR;
73  }
74 
75 
76  RaytracerBase::RaytracerBase(int moduleID, EGeometry geometry, EOptics optics):
77  m_moduleID(moduleID), m_geometry(geometry), m_optics(optics)
78  {
79  const auto* geo = TOPGeometryPar::Instance()->getGeometry();
80  if (not geo->isModuleIDValid(moduleID)) {
81  B2FATAL("TOP::RaytracerBase: invalid slot number, moduleID = " << moduleID);
82  return;
83  }
84  const auto& module = geo->getModule(moduleID);
85 
86  m_prism = Prism(module);
87  m_mirror = Mirror(module);
88 
89  if (geometry == c_Unified) {
90  m_bars.push_back(BarSegment(module));
91  } else {
92  m_bars.push_back(BarSegment(module.getBarSegment2(), m_prism.zR));
93  m_bars.push_back(BarSegment(module.getBarSegment1(), m_bars.back().zR));
94  m_bars.push_back(BarSegment(module.getMirrorSegment(), m_bars.back().zR));
95  }
96  }
97 
98 
99 
100  } // TOP
102 } // Belle2
103 
104 
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:30
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.
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
double yc
center of curvature in y
Definition: RaytracerBase.h:81
double xc
center of curvature in x
Definition: RaytracerBase.h:80
double zb
minimum of mirror surface in z
Definition: RaytracerBase.h:84
double zc
center of curvature in z
Definition: RaytracerBase.h:82
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'