Belle II Software  release-06-01-15
TOPGeoPrism.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/dbobjects/TOPGeoBarSegment.h>
12 #include <string>
13 #include <vector>
14 #include <utility>
15 #include <math.h>
16 #include <TVector2.h>
17 
18 namespace Belle2 {
27  class TOPGeoPrism: public TOPGeoBarSegment {
28  public:
29 
33  struct PeelOffRegion {
34  unsigned ID;
35  float fraction;
36  float angle;
37  };
38 
39 
43  struct UnfoldedWindow {
44  double y0 = 0;
45  double z0 = 0;
46  double sy = 0;
47  double sz = 0;
48  double ny = 0;
49  double nz = 0;
50  double nsy[2] = {0, 0};
51  double nsz[2] = {0, 0};
60  UnfoldedWindow(const TVector2& orig, const TVector2& dir, const TVector2& norm, const TVector2& slanted);
61  };
62 
63 
68  {}
69 
80  TOPGeoPrism(double width, double thickness, double length,
81  double exitThickness, double flatLength,
82  const std::string& material,
83  const std::string& name = "TOPPrism_"):
84  TOPGeoBarSegment(width, thickness, length, material, name),
85  m_exitThickness(exitThickness), m_flatLength(flatLength)
86  {}
87 
92  void setAngle(double angle)
93  {
94  m_flatLength = m_length - (m_exitThickness - m_thickness) / tan(angle);
95  }
96 
104  void setPeelOffRegions(double size, double offset, double thickness,
105  const std::string& material)
106  {
107  m_peelOffSize = size;
108  m_peelOffOffset = offset;
109  m_peelOffThickness = thickness;
110  m_peelOffMaterial = material;
111  }
112 
119  void appendPeelOffRegion(unsigned ID, double fraction, double angle);
120 
125  double getExitThickness() const {return m_exitThickness / s_unit;}
126 
131  double getFlatLength() const {return m_flatLength / s_unit;}
132 
137  double getFullFlatLength() const {return (m_flatLength + m_glueThickness) / s_unit;}
138 
143  double getAngle() const
144  {
145  return atan((m_exitThickness - m_thickness) / (m_length - m_flatLength));
146  }
147 
153  double getFilterThickness() const {return m_glueThickness / s_unit;}
154 
160  const std::string& getFilterMaterial() const {return m_glueMaterial;}
161 
166  double getGlueThickness() const override {return 0;}
167 
172  double getPeelOffSize() const {return m_peelOffSize / s_unit;}
173 
178  double getPeelOffThickness() const {return m_peelOffThickness / s_unit;}
179 
184  const std::string& getPeelOffMaterial() const {return m_peelOffMaterial;}
185 
190  const std::vector<PeelOffRegion>& getPeelOffRegions() const {return m_peelOffRegions;}
191 
197  double getPeelOffCenter(const PeelOffRegion& region) const
198  {
199  return (m_peelOffOffset - (region.ID - 1) * m_peelOffSize) / s_unit;
200  }
201 
207  std::vector<std::pair<double, double> > getPeelOffContour(const PeelOffRegion& region) const;
208 
214  const std::vector<UnfoldedWindow>& getUnfoldedWindows() const
215  {
216  if (m_unfoldedWindows.empty()) unfold();
217  return m_unfoldedWindows;
218  }
219 
224  int getK0() const
225  {
226  if (m_unfoldedWindows.empty()) unfold();
227  return m_k0;
228  }
229 
234  bool isConsistent() const override;
235 
240  void print(const std::string& title = "Prism geometry parameters") const override;
241 
242 
243  private:
244 
248  void setGlue(double, const std::string&) override {}
249 
253  void setGlueDelamination(double, double, const std::string&) override {}
254 
258  void unfold() const;
259 
271  void reflect(const TVector2* points, const TVector2* normals,
272  const TVector2& orig, const TVector2& surf, const TVector2& norm, const TVector2& slanted, int k,
273  std::vector<UnfoldedWindow>& result) const;
274 
275  float m_exitThickness = 0;
276  float m_flatLength = 0;
278  float m_peelOffSize = 0;
279  float m_peelOffOffset = 0;
280  float m_peelOffThickness = 0;
281  std::string m_peelOffMaterial;
282  std::vector<PeelOffRegion> m_peelOffRegions;
285  mutable std::vector<UnfoldedWindow> m_unfoldedWindows;
287  mutable int m_k0 = 0;
288 
291  };
292 
294 } // end namespace Belle2
Geometry parameters of a quartz bar segment.
float m_glueThickness
glue thickness
float m_thickness
bar segment thickness
std::string m_glueMaterial
glue material name
float m_length
bar segment length
Geometry parameters of prism.
Definition: TOPGeoPrism.h:27
double getFullFlatLength() const
Returns the length of a flat surface at prism bottom including filter.
Definition: TOPGeoPrism.h:137
double getPeelOffCenter(const PeelOffRegion &region) const
Returns peel-off offset in x of the given region.
Definition: TOPGeoPrism.h:197
const std::vector< UnfoldedWindow > & getUnfoldedWindows() const
Returns unfolded exit windows.
Definition: TOPGeoPrism.h:214
float m_flatLength
length of the flat part at the bottom
Definition: TOPGeoPrism.h:276
const std::string & getPeelOffMaterial() const
Returns peel-off material.
Definition: TOPGeoPrism.h:184
ClassDefOverride(TOPGeoPrism, 2)
do not write out
void setAngle(double angle)
Recalculates flatLength according to given prism angle.
Definition: TOPGeoPrism.h:92
double getFilterThickness() const
Returns wavelength filter thickness (filter on -z side).
Definition: TOPGeoPrism.h:153
float m_peelOffThickness
thickness of peel-off volume
Definition: TOPGeoPrism.h:280
std::vector< PeelOffRegion > m_peelOffRegions
peel-off regions
Definition: TOPGeoPrism.h:282
float m_peelOffSize
size in x of peel-off volume
Definition: TOPGeoPrism.h:278
double getGlueThickness() const override
Returns glue thickness (no glue on -z side)
Definition: TOPGeoPrism.h:166
double getExitThickness() const
Returns prism thickness at PMT side.
Definition: TOPGeoPrism.h:125
double getAngle() const
Returns prism angle.
Definition: TOPGeoPrism.h:143
double getPeelOffThickness() const
Returns peel-off thickness.
Definition: TOPGeoPrism.h:178
TOPGeoPrism()
Default constructor.
Definition: TOPGeoPrism.h:67
float m_peelOffOffset
offset in x of the peel-off volume ID = 1
Definition: TOPGeoPrism.h:279
void setPeelOffRegions(double size, double offset, double thickness, const std::string &material)
Sets parameters of the peel-off cookie volumes.
Definition: TOPGeoPrism.h:104
double getPeelOffSize() const
Returns cookie size in x (corresponding to 2x2 PMT)
Definition: TOPGeoPrism.h:172
std::string m_peelOffMaterial
material name of peel-off volume
Definition: TOPGeoPrism.h:281
double getFlatLength() const
Returns the length of a flat surface at prism bottom.
Definition: TOPGeoPrism.h:131
int m_k0
do not write out
Definition: TOPGeoPrism.h:287
int getK0() const
Returns index of true window in a vector of unfolded exit windows.
Definition: TOPGeoPrism.h:224
void setGlueDelamination(double, double, const std::string &) override
Disable setting the glue delamination, since there is no glue.
Definition: TOPGeoPrism.h:253
void setGlue(double, const std::string &) override
Disable setting the glue, since there is none.
Definition: TOPGeoPrism.h:248
TOPGeoPrism(double width, double thickness, double length, double exitThickness, double flatLength, const std::string &material, const std::string &name="TOPPrism_")
Useful constructor.
Definition: TOPGeoPrism.h:80
std::vector< UnfoldedWindow > m_unfoldedWindows
cache for unfolded prism exit windows
Definition: TOPGeoPrism.h:285
const std::vector< PeelOffRegion > & getPeelOffRegions() const
Returns peel-off cookie regions.
Definition: TOPGeoPrism.h:190
float m_exitThickness
thickness at PMT side
Definition: TOPGeoPrism.h:275
const std::string & getFilterMaterial() const
Returns wavelength filter material name (filter on -z side) For backward compatibility,...
Definition: TOPGeoPrism.h:160
void appendPeelOffRegion(unsigned ID, double fraction, double angle)
Appends peel-off cookie region.
Definition: TOPGeoPrism.cc:93
void reflect(const TVector2 *points, const TVector2 *normals, const TVector2 &orig, const TVector2 &surf, const TVector2 &norm, const TVector2 &slanted, int k, std::vector< UnfoldedWindow > &result) const
Do unfolding.
Definition: TOPGeoPrism.cc:151
bool isConsistent() const override
Check for consistency of data members.
Definition: TOPGeoPrism.cc:35
static double s_unit
conversion unit for length
Definition: TOPGeoBase.h:86
std::vector< std::pair< double, double > > getPeelOffContour(const PeelOffRegion &region) const
Returns the x-y contour of the peel-off region.
Definition: TOPGeoPrism.cc:117
void unfold() const
Unfold prism exit window.
Definition: TOPGeoPrism.cc:128
UnfoldedWindow(const TVector2 &orig, const TVector2 &dir, const TVector2 &norm, const TVector2 &slanted)
constructor
Definition: TOPGeoPrism.cc:24
void print(const std::string &title="Prism geometry parameters") const override
Print the content of the class.
Definition: TOPGeoPrism.cc:59
Abstract base class for different kinds of events.
Parameters of peel-off cookie region (corresponds to 2x2 PMT's)
Definition: TOPGeoPrism.h:33
float fraction
fraction of peel-off area
Definition: TOPGeoPrism.h:35
float angle
angle of peel-off area
Definition: TOPGeoPrism.h:36
unsigned ID
ID of the region (1-based)
Definition: TOPGeoPrism.h:34
Unfolded prism exit window.
Definition: TOPGeoPrism.h:43
double ny
normal to window surface, y component
Definition: TOPGeoPrism.h:48
double nsz[2]
normals to upper [0] and slanted [1] surfaces, z component
Definition: TOPGeoPrism.h:51
double nz
normal to window surface, z component
Definition: TOPGeoPrism.h:49
double nsy[2]
normals to upper [0] and slanted [1] surfaces, y component
Definition: TOPGeoPrism.h:50
double sz
window surface direction in z
Definition: TOPGeoPrism.h:47
double z0
window origin in z
Definition: TOPGeoPrism.h:45
double sy
window surface direction in y
Definition: TOPGeoPrism.h:46
double y0
window origin in y
Definition: TOPGeoPrism.h:44