9#include <top/dbobjects/TOPGeoPrism.h>
10#include <framework/gearbox/Unit.h>
11#include <framework/logging/Logger.h>
17using namespace ROOT::Math;
26 const XYVector& norm,
const XYVector& slanted):
27 y0(orig.X()), z0(orig.Y()), sy(dir.X()), sz(dir.Y()), ny(norm.X()), nz(norm.Y())
66 cout <<
" Exit window dimensions: " <<
getWidth() <<
" X "
76 cout <<
" Peel-off cookie regions: ";
81 cout <<
" ID = " << region.ID <<
", fraction = " << region.fraction
82 <<
", angle = " << region.angle /
Unit::deg <<
" deg"
86 cout <<
" Peel-off regions: None" << endl;
97 if (region.ID == ID) {
98 B2ERROR(
"TOPGeoPrism::appendPeelOffRegion: region already appended."
99 <<
LogVar(
"region ID", ID));
105 region.fraction = fraction;
106 region.angle = angle;
109 B2ERROR(
"TOPGeoPrism::appendPeelOffRegion: region doesn't fit into prism."
110 <<
LogVar(
"region ID", ID));
116 typedef std::pair<double, double>
Pair;
120 std::vector<Pair> contour;
122 region.fraction, region.angle,
134 XYVector points[2] = {XYVector(yUp, z), XYVector(yDown, z)};
137 XYVector normals[2] = {XYVector(1, 0), XYVector(-cos(alpha), sin(alpha))};
141 XYVector norm(0, -1);
142 auto slanted = normals[1];
153 const XYVector& orig,
const XYVector& surf,
const XYVector& norm,
154 const XYVector& slanted,
int k,
155 std::vector<UnfoldedWindow>& result)
const
157 XYVector rp[2] = {points[0], points[1]};
158 XYVector n[2] = {normals[0], normals[1]};
164 while (rp[k].Y() < 0) {
165 r -= 2 * ((r - rp[k]).Dot(n[k])) * n[k];
166 s -= 2 * s.Dot(n[k]) * n[k];
167 q -= 2 * q.Dot(n[k]) * n[k];
168 sl -= 2 * sl.Dot(n[k]) * n[k];
170 if (result.size() > 100) {
171 B2ERROR(
"TOPGeoPrism::reflect: too many reflections -> must be a bug");
175 rp[i] -= 2 * (rp[i] - rp[k]).Dot(n[k]) * n[k];
176 n[i] -= 2 * n[i].Dot(n[k]) * n[k];
const std::string & getName() const
get name of the optical surface
bool hasProperties() const
check if the material has at least one property
double getWidth() const
Returns bar segment width.
std::string m_material
bar segment material name
std::string m_brokenGlueMaterial
broken glue material name
GeoOpticalSurface m_surface
optical surface
double getThickness() const
Returns bar segment thickness.
float m_brokenFraction
fraction of broken (delaminated) glue
float m_thickness
bar segment thickness
double getSigmaAlpha() const
Returns geant4 parameter describing surface roughness.
const std::string & getMaterial() const
Returns bar segment material name.
const std::string & getVendor() const
Returns vendor's name.
float m_sigmaAlpha
geant4 parameter for surface roughness
float m_length
bar segment length
double getLength() const
Returns bar segment length.
float m_width
bar segment width
const std::string & getSerialNumber() const
Returns serial number.
const std::string & getPeelOffMaterial() const
Returns peel-off material.
double getPeelOffCenter(const PeelOffRegion ®ion) const
Returns peel-off offset in x of the given region.
float m_flatLength
length of the flat part at the bottom
double getFilterThickness() const
Returns wavelength filter thickness (filter on -z side).
float m_peelOffThickness
thickness of peel-off volume
std::vector< PeelOffRegion > m_peelOffRegions
peel-off regions
float m_peelOffSize
size in x of peel-off volume
double getExitThickness() const
Returns prism thickness at PMT side.
double getAngle() const
Returns prism angle.
double getPeelOffThickness() const
Returns peel-off thickness.
double getPeelOffSize() const
Returns cookie size in x (corresponding to 2x2 PMT)
const std::string & getFilterMaterial() const
Returns wavelength filter material name (filter on -z side) For backward compatibility,...
std::string m_peelOffMaterial
material name of peel-off volume
double getFlatLength() const
Returns the length of a flat surface at prism bottom.
std::vector< UnfoldedWindow > m_unfoldedWindows
cache for unfolded prism exit windows
float m_exitThickness
thickness at PMT side
static const double deg
degree to radians
Class to store variables with their name which were sent to the logging service.
void appendPeelOffRegion(unsigned ID, double fraction, double angle)
Appends peel-off cookie region.
bool isConsistent() const override
Check for consistency of data members.
void reflect(const ROOT::Math::XYVector *points, const ROOT::Math::XYVector *normals, const ROOT::Math::XYVector &orig, const ROOT::Math::XYVector &surf, const ROOT::Math::XYVector &norm, const ROOT::Math::XYVector &slanted, int k, std::vector< UnfoldedWindow > &result) const
Do unfolding.
std::vector< std::pair< double, double > > getPeelOffContour(const PeelOffRegion ®ion) const
Returns the x-y contour of the peel-off region.
void unfold() const
Unfold prism exit window.
UnfoldedWindow(const ROOT::Math::XYVector &orig, const ROOT::Math::XYVector &dir, const ROOT::Math::XYVector &norm, const ROOT::Math::XYVector &slanted)
constructor
virtual void printSurface(const GeoOpticalSurface &surface) const
Print the content of optical surface.
void constructContour(double A, double B, double fraction, double angle, std::vector< std::pair< double, double > > &contour) const
Construct a 2D contour.
virtual void print(const std::string &title) const
Print the content of the class.
void print(const std::string &title="Prism geometry parameters") const override
Print the content of the class.
std::pair< double, double > Pair
Shorthand for std::pair<double, double>
static std::string s_unitName
conversion unit name
Abstract base class for different kinds of events.
Parameters of peel-off cookie region (corresponds to 2x2 PMT's)
Unfolded prism exit window.
double nsz[2]
normals to upper [0] and slanted [1] surfaces, z component
double nsy[2]
normals to upper [0] and slanted [1] surfaces, y component
double sz
window surface direction in z
double sy
window surface direction in y