Belle II Software development
InverseRaytracer Class Reference

Utility for solving inverse ray-tracing problem. More...

#include <InverseRaytracer.h>

Inheritance diagram for InverseRaytracer:
RaytracerBase

Classes

struct  CerenkovAngle
 Sine and cosine of Cerenkov angle. More...
 
struct  Solution
 Solution of inverse ray-tracing. More...
 

Public Types

enum  ErrorCodes {
  c_NoPhysicsSolution = -1 ,
  c_NoEquationSolution = -2 ,
  c_NoReflectionPoint = -3
}
 Error codes returned by solveDirect or solveReflected. More...
 
enum  EGeometry {
  c_Unified = 0 ,
  c_Segmented = 1
}
 Treatement of quartz geometry. More...
 
enum  EOptics {
  c_SemiLinear = 0 ,
  c_Exact = 1
}
 Treatement of spherical mirror optics. More...
 

Public Member Functions

 InverseRaytracer (int moduleID, double cosTotal)
 Class constructor.
 
void clear () const
 Clear the solutions to prepare for the new round.
 
int solveDirect (double xD, double zD, const TOPTrack::AssumedEmission &assumedEmission, const CerenkovAngle &cer, double step=0) const
 Solve inverse ray-tracing for direct photon.
 
int solveReflected (double xD, double zD, int Nxm, double xmMin, double xmMax, const TOPTrack::AssumedEmission &assumedEmission, const CerenkovAngle &cer, double step=0) const
 Solve inverse ray-tracing for reflected photon.
 
int solveForReflectionPoint (double xM, int Nxm, const TOPTrack::AssumedEmission &assumedEmission, const CerenkovAngle &cer) const
 Solve inverse ray-tracing for a given reflection point on the mirror.
 
double getCosTotal () const
 Returns cosine of total reflection angle.
 
std::vector< Solution > & getSolutions (unsigned i) const
 Returns the solutions of inverse ray-tracing.
 
bool getStatus () const
 Returns status.
 
bool getStatus (unsigned i) const
 Returns status.
 
bool isNymDifferent () const
 Checks if Nym differs between solutions front and back in at least one of the vectors.
 
PhotonState getReconstructedPhoton (const Solution &sol, double DFic=0) const
 Returns reconstructed photon at emission for a given solution of inverse raytracing.
 
int getModuleID () const
 Returns slot ID.
 
EGeometry getGeometry () const
 Returns quartz geometry treatement.
 
EOptics getOptics () const
 Returns treatement of spherical mirror optics.
 
const std::vector< BarSegment > & getBars () const
 Returns geometry data of bar segments.
 
const MirrorgetMirror () const
 Returns geometry data of spherical mirror.
 
const PrismgetPrism () const
 Returns geometry data of prism.
 
void setMirrorCenter (double xc, double yc)
 Sets the mirror center-of-curvature.
 

Static Public Member Functions

static void setMaxPropagationLen (double maxLen)
 Sets maximal allowed propagation length.
 

Protected Attributes

int m_moduleID = 0
 slot ID
 
EGeometry m_geometry = c_Unified
 quartz geometry
 
EOptics m_optics = c_SemiLinear
 spherical mirror optics
 
std::vector< BarSegmentm_bars
 geometry data of bar segments
 
Mirror m_mirror
 spherical mirror geometry data
 
Prism m_prism
 prism geometry data
 

Private Member Functions

bool solve (double dxdz, const CerenkovAngle &cer, const TOPTrack::TrackAngles &trk) const
 Solve inverse ray-tracing for unknown azimuthal Cerenkov angle.
 
bool findReflectionPoint (double xE, double zE, double xD, double zD, double xmMin, double xmMax, double &xM, double &zM, double &dxdz) const
 Finds reflection point on the mirror using semi-linear optics approximation.
 
double getDeltaXE (double x, double xe, double ze, double xd, double zd) const
 Returns the difference between input xe and the reflected position at given x.
 

Private Attributes

double m_cosTotal = 0
 cosine of total reflection angle
 
std::vector< Solutionm_solutions [2]
 storage for the two solutions
 
bool m_ok [2] = {false, false}
 status of solutions
 
ROOT::Math::XYZPoint m_emiPoint
 temporary storage of emission point
 
CerenkovAngle m_cer
 temporary storage of Cerenkov angle
 
TOPTrack::TrackAngles m_trk
 temporary storage of track polar and azimuthal angles
 

Static Private Attributes

static double s_maxLen = 10000
 maximal allowed propagation length
 

Detailed Description

Utility for solving inverse ray-tracing problem.

Definition at line 28 of file InverseRaytracer.h.

Member Enumeration Documentation

◆ EGeometry

enum EGeometry
inherited

Treatement of quartz geometry.

Enumerator
c_Unified 

single bar with average width and thickness

c_Segmented 

segmented bars

Definition at line 33 of file RaytracerBase.h.

33 {
34 c_Unified = 0,
35 c_Segmented = 1
36 };
@ c_Unified
single bar with average width and thickness
Definition: RaytracerBase.h:34
@ c_Segmented
segmented bars
Definition: RaytracerBase.h:35

◆ EOptics

enum EOptics
inherited

Treatement of spherical mirror optics.

Enumerator
c_SemiLinear 

semi-linear approximation

c_Exact 

exact optics

Definition at line 41 of file RaytracerBase.h.

41 {
42 c_SemiLinear = 0,
43 c_Exact = 1
44 };
@ c_SemiLinear
semi-linear approximation
Definition: RaytracerBase.h:42

◆ ErrorCodes

enum ErrorCodes

Error codes returned by solveDirect or solveReflected.

Enumerator
c_NoPhysicsSolution 

no physics solution

c_NoEquationSolution 

no solution of equation

c_NoReflectionPoint 

position on the mirror not found

Definition at line 35 of file InverseRaytracer.h.

35 {
39 };
@ c_NoEquationSolution
no solution of equation
@ c_NoReflectionPoint
position on the mirror not found
@ c_NoPhysicsSolution
no physics solution

Constructor & Destructor Documentation

◆ InverseRaytracer()

InverseRaytracer ( int  moduleID,
double  cosTotal 
)
inline

Class constructor.

Parameters
moduleIDslot ID
cosTotalcosine of total reflection angle

Definition at line 133 of file InverseRaytracer.h.

134 m_cosTotal(cosTotal)
135 {}
double m_cosTotal
cosine of total reflection angle
RaytracerBase(int moduleID, EGeometry geometry=c_Unified, EOptics optics=c_SemiLinear)
Constructor.

Member Function Documentation

◆ clear()

void clear ( ) const

Clear the solutions to prepare for the new round.

Definition at line 59 of file InverseRaytracer.cc.

60 {
61 m_solutions[0].clear();
62 m_solutions[1].clear();
63 m_ok[0] = false;
64 m_ok[1] = false;
65 }
std::vector< Solution > m_solutions[2]
storage for the two solutions
bool m_ok[2]
status of solutions

◆ findReflectionPoint()

bool findReflectionPoint ( double  xE,
double  zE,
double  xD,
double  zD,
double  xmMin,
double  xmMax,
double &  xM,
double &  zM,
double &  dxdz 
) const
private

Finds reflection point on the mirror using semi-linear optics approximation.

Parameters
xEunfolded emission position in x (unfolding w.r.t mirror)
zEemission position in z
xDunfolded detection position in x (unfolding w.r.t mirror)
zDdetection position in z
xmMinlower limit for search range in x
xmMaxupper limit for search range in x
xMreflection position in x [out]
zMreflection position in z [out]
dxdzphoton slope in x-z (dx/dz) before mirror [out]
Returns
true on success

Definition at line 313 of file InverseRaytracer.cc.

316 {
317 double xe = (xE - m_mirror.xc) / m_mirror.R;
318 double ze = (zE - m_mirror.zc) / m_mirror.R;
319 double xd = (xD - m_mirror.xc) / m_mirror.R;
320 double zd = (zD - m_mirror.zc) / m_mirror.R;
321
322 double x1 = (xmMin - m_mirror.xc) / m_mirror.R;
323 double y1 = getDeltaXE(x1, xe, ze, xd, zd);
324
325 double x2 = (xmMax - m_mirror.xc) / m_mirror.R;
326 double y2 = getDeltaXE(x2, xe, ze, xd, zd);
327
328 if (y1 * y2 > 0) return false; // no (single) solution
329
330 for (int i = 0; i < 20; i++) {
331 double x = (x1 + x2) / 2;
332 double y = getDeltaXE(x, xe, ze, xd, zd);
333 if (y * y1 < 0) {
334 x2 = x;
335 } else {
336 x1 = x;
337 y1 = y;
338 }
339 }
340 double x = (x1 + x2) / 2;
341 double z = sqrt(1 - x * x);
342 xM = x * m_mirror.R + m_mirror.xc;
343 zM = z * m_mirror.R + m_mirror.zc;
344
345 double kx = (x - xd);
346 double kz = (z - zd);
347 double s = 2 * (kx * x + kz * z);
348 kx -= s * x;
349 kz -= s * z;
350 dxdz = kx / kz;
351
352 return true;
353 }
double getDeltaXE(double x, double xe, double ze, double xd, double zd) const
Returns the difference between input xe and the reflected position at given x.
Mirror m_mirror
spherical mirror geometry data
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
double xc
center of curvature in x
Definition: RaytracerBase.h:81
double zc
center of curvature in z
Definition: RaytracerBase.h:83

◆ getBars()

const std::vector< BarSegment > & getBars ( ) const
inlineinherited

Returns geometry data of bar segments.

Returns
geometry data of bar segments

Definition at line 161 of file RaytracerBase.h.

161{return m_bars;}
std::vector< BarSegment > m_bars
geometry data of bar segments

◆ getCosTotal()

double getCosTotal ( ) const
inline

Returns cosine of total reflection angle.

Returns
cosine of total reflection angle at mean photon energy for beta = 1

Definition at line 191 of file InverseRaytracer.h.

191{return m_cosTotal;}

◆ getDeltaXE()

double getDeltaXE ( double  x,
double  xe,
double  ze,
double  xd,
double  zd 
) const
private

Returns the difference between input xe and the reflected position at given x.

This function is used to find the reflection point on the mirror. All arguments must be given in the mirror frame and in units of mirror radius.

Parameters
xposition in x on the mirror
xeunfolded emission position in x
zeemission position in z
xdunfolded detection position in x
zddetection position in z
Returns
the difference in units of mirror radius.

Definition at line 300 of file InverseRaytracer.cc.

301 {
302 double z = sqrt(1 - x * x);
303 double kx = (x - xd);
304 double kz = (z - zd);
305 double s = 2 * (kx * x + kz * z);
306 kx -= s * x;
307 kz -= s * z;
308
309 return x + (ze - z) * kx / kz - xe;
310 }

◆ getGeometry()

EGeometry getGeometry ( ) const
inlineinherited

Returns quartz geometry treatement.

Returns
quartz geometry treatement

Definition at line 149 of file RaytracerBase.h.

149{return m_geometry;}
EGeometry m_geometry
quartz geometry

◆ getMirror()

const Mirror & getMirror ( ) const
inlineinherited

Returns geometry data of spherical mirror.

Returns
geometry data of spherical mirror

Definition at line 167 of file RaytracerBase.h.

167{return m_mirror;}

◆ getModuleID()

int getModuleID ( ) const
inlineinherited

Returns slot ID.

Returns
slot ID

Definition at line 143 of file RaytracerBase.h.

143{return m_moduleID;}

◆ getOptics()

EOptics getOptics ( ) const
inlineinherited

Returns treatement of spherical mirror optics.

Returns
spherical mirror optics

Definition at line 155 of file RaytracerBase.h.

155{return m_optics;}
EOptics m_optics
spherical mirror optics

◆ getPrism()

const Prism & getPrism ( ) const
inlineinherited

Returns geometry data of prism.

Returns
geometry data of prism

Definition at line 173 of file RaytracerBase.h.

173{return m_prism;}
Prism m_prism
prism geometry data

◆ getReconstructedPhoton()

PhotonState getReconstructedPhoton ( const Solution sol,
double  DFic = 0 
) const

Returns reconstructed photon at emission for a given solution of inverse raytracing.

Parameters
solsolution of inverse raytracing
DFicadditional rotation angle around track (delta Cerenkov azimuthal angle)
Returns
reconstructed photon (note: usually meaningless if status is false!)

Definition at line 356 of file InverseRaytracer.cc.

357 {
358 if (DFic == 0) {
359 return PhotonState(m_emiPoint, sol.kx, sol.ky, sol.kz);
360 } else {
361 double cosDFic = cos(DFic);
362 double sinDFic = sin(DFic);
363 double cosFic = sol.cosFic * cosDFic - sol.sinFic * sinDFic;
364 double sinFic = sol.sinFic * cosDFic + sol.cosFic * sinDFic;
365 double a = m_trk.cosTh * m_cer.sinThc * cosFic + m_trk.sinTh * m_cer.cosThc;
366 double b = m_cer.sinThc * sinFic;
367 double kx = a * m_trk.cosFi - b * m_trk.sinFi;
368 double ky = a * m_trk.sinFi + b * m_trk.cosFi;
369 double kz = m_trk.cosTh * m_cer.cosThc - m_trk.sinTh * m_cer.sinThc * cosFic;
370 return PhotonState(m_emiPoint, kx, ky, kz);
371 }
372 }
ROOT::Math::XYZPoint m_emiPoint
temporary storage of emission point
CerenkovAngle m_cer
temporary storage of Cerenkov angle
TOPTrack::TrackAngles m_trk
temporary storage of track polar and azimuthal angles
double cosThc
cosine of Cerenkov angle
double sinFi
sine of azimuthal angle
Definition: TOPTrack.h:50
double cosFi
cosine of azimuthal angle
Definition: TOPTrack.h:49
double cosTh
cosine of polar angle
Definition: TOPTrack.h:47
double sinTh
sine of polar angle
Definition: TOPTrack.h:48

◆ getSolutions()

std::vector< Solution > & getSolutions ( unsigned  i) const
inline

Returns the solutions of inverse ray-tracing.

Parameters
ito select first (0) or second (1) solutions
Returns
a vector of solutions

Definition at line 198 of file InverseRaytracer.h.

198{return m_solutions[i % 2];}

◆ getStatus() [1/2]

bool getStatus ( ) const
inline

Returns status.

Returns
status

Definition at line 204 of file InverseRaytracer.h.

204{return (m_ok[0] or m_ok[1]);}

◆ getStatus() [2/2]

bool getStatus ( unsigned  i) const
inline

Returns status.

Parameters
ito select status of first (0) or second (1) solutions
Returns
status

Definition at line 211 of file InverseRaytracer.h.

211{return m_ok[i % 2];}

◆ isNymDifferent()

bool isNymDifferent ( ) const

Checks if Nym differs between solutions front and back in at least one of the vectors.

Returns
true if differs

Definition at line 259 of file InverseRaytracer.cc.

260 {
261 for (int i = 0; i < 2; i++) {
262 const auto& solutions = m_solutions[i];
263 if (m_ok[i] and solutions.back().Nym != solutions.front().Nym) return true;
264 }
265 return false;
266 }

◆ setMaxPropagationLen()

static void setMaxPropagationLen ( double  maxLen)
inlinestatic

Sets maximal allowed propagation length.

Parameters
maxLenmaximal allowed propagation length

Definition at line 141 of file InverseRaytracer.h.

141{s_maxLen = maxLen;}
static double s_maxLen
maximal allowed propagation length

◆ setMirrorCenter()

void setMirrorCenter ( double  xc,
double  yc 
)
inherited

Sets the mirror center-of-curvature.

Parameters
xccenter of curvature in x
yccenter of curvature in y

Definition at line 100 of file RaytracerBase.cc.

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 }
double R
typedef autogenerated by FFTW
double yc
center of curvature in y
Definition: RaytracerBase.h:82
double zb
minimum of mirror surface in z
Definition: RaytracerBase.h:85

◆ solve()

bool solve ( double  dxdz,
const CerenkovAngle cer,
const TOPTrack::TrackAngles trk 
) const
private

Solve inverse ray-tracing for unknown azimuthal Cerenkov angle.

Solutions are always two or none (very rare case, phic=0: the two are the same)

Parameters
dxdzphoton slope (dx/dz) in x-z projection
cersine and cosine of Cerenkov angle
trksine and cosine of track polar and azimuthal angles at photon emission
Returns
true if solutions exits

Definition at line 268 of file InverseRaytracer.cc.

269 {
270 double a = (dxdz * trk.cosTh - trk.cosFi * trk.sinTh) * cer.cosThc;
271 double b = (dxdz * trk.sinTh + trk.cosFi * trk.cosTh) * cer.sinThc;
272 double d = trk.sinFi * cer.sinThc;
273
274 double B = b * b + d * d;
275 if (B == 0) return false;
276
277 if (d == 0) {
278 double cfic = a / b;
279 if (std::abs(cfic) > 1) return false;
280 double sfic = sqrt(1 - cfic * cfic);
281 m_solutions[0].push_back(Solution(cfic, sfic));
282 m_solutions[1].push_back(Solution(cfic, -sfic));
283 } else {
284 double D = B - a * a;
285 if (D < 0) return false;
286 D = d * sqrt(D);
287 double ab = a * b;
288 double cfic = (ab + D) / B;
289 m_solutions[0].push_back(Solution(cfic, (b * cfic - a) / d));
290 cfic = (ab - D) / B;
291 m_solutions[1].push_back(Solution(cfic, (b * cfic - a) / d));
292 }
293 m_solutions[0].back().setDirection(cer, trk);
294 m_solutions[1].back().setDirection(cer, trk);
295
296 return true;
297 }

◆ solveDirect()

int solveDirect ( double  xD,
double  zD,
const TOPTrack::AssumedEmission assumedEmission,
const CerenkovAngle cer,
double  step = 0 
) const

Solve inverse ray-tracing for direct photon.

Parameters
xDunfolded position in x of photon at detection plane
zDposition of detection plane
assumedEmissionphoton emission position and track angles
cersine and cosine of Cerenkov angle
stepstep for numerical derivative calculation
Returns
index of solution or ErrorCode on fail

Definition at line 67 of file InverseRaytracer.cc.

70 {
71 const auto& emiPoint = assumedEmission.position;
72 const auto& trk = assumedEmission.trackAngles;
73 bool first = m_solutions[0].empty();
74 if (first) {
75 m_emiPoint = emiPoint;
76 m_cer = cer;
77 m_trk = trk;
78 }
79
80 double dx = xD - emiPoint.X();
81 double dz = zD - emiPoint.Z();
82
83 double dxdz = dx / dz;
84 if (not solve(dxdz, cer, trk)) return c_NoEquationSolution;
85
86 for (int i = 0; i < 2; i++) {
87 auto& sol = m_solutions[i].back();
88 sol.xD = xD;
89 sol.zD = zD;
90 sol.step = step;
91 sol.len = dz / sol.kz;
92 double dydz = sol.ky / sol.kz;
93 sol.yD = emiPoint.Y() + dydz * dz;
94 sol.yB = emiPoint.Y() + dydz * (m_prism.zR - emiPoint.Z());
95 if (first) {
96 m_ok[i] = true;
97 sol.setTotalReflStatus(m_bars[0].A, m_bars[0].B, m_cosTotal);
98 }
99 if (not sol.getStatus()) m_ok[i] = false;
100 }
101
102 if (not(m_ok[0] or m_ok[1])) return c_NoPhysicsSolution;
103
104 return m_solutions[0].size() - 1;
105 }
bool solve(double dxdz, const CerenkovAngle &cer, const TOPTrack::TrackAngles &trk) const
Solve inverse ray-tracing for unknown azimuthal Cerenkov angle.
double zR
maximal z, i.e position of prism-bar joint

◆ solveForReflectionPoint()

int solveForReflectionPoint ( double  xM,
int  Nxm,
const TOPTrack::AssumedEmission assumedEmission,
const CerenkovAngle cer 
) const

Solve inverse ray-tracing for a given reflection point on the mirror.

Parameters
xMposition in x of the reflection point on the mirror.
Nxmsigned number of reflections before mirror
assumedEmissionphoton emission position and track angles
cersine and cosine of Cerenkov angle
Returns
index of solution or ErrorCode on fail

Definition at line 192 of file InverseRaytracer.cc.

195 {
196 const auto& emiPoint = assumedEmission.position;
197 const auto& trk = assumedEmission.trackAngles;
198 bool first = m_solutions[0].empty();
199 if (first) {
200 m_emiPoint = emiPoint;
201 m_cer = cer;
202 m_trk = trk;
203 }
204
205 double A = m_bars[0].A;
206 double B = m_bars[0].B;
207
208 double zM = m_mirror.zc + sqrt(pow(m_mirror.R, 2) - pow(xM - m_mirror.xc, 2));
209 double dx = func::unfold(xM, Nxm, A) - emiPoint.X();
210 double dz = zM - emiPoint.Z();
211 double dxdz = dx / dz;
212
213 bool ok = solve(dxdz, cer, trk);
214 if (not ok) return c_NoEquationSolution;
215
216 double normX = (xM - m_mirror.xc) / m_mirror.R;
217 double normZ = (zM - m_mirror.zc) / m_mirror.R;
218 double zD = m_prism.zD;
219
220 for (int i = 0; i < 2; i++) {
221 auto& sol = m_solutions[i].back();
222 sol.zD = zD;
223 sol.Nxm = Nxm;
224
225 double len = (zM - emiPoint.Z()) / sol.kz;
226 if (len < 0) {
227 m_ok[i] = false;
228 continue;
229 }
230 sol.len = len;
231 int Nym = lround((emiPoint.Y() + len * sol.ky) / B);
232
233 double kx = func::unfold(sol.kx, Nxm);
234 double ky = func::unfold(sol.ky, Nym);
235 double kz = sol.kz;
236 double s = 2 * (kx * normX + kz * normZ);
237 kx -= s * normX;
238 kz -= s * normZ;
239
240 len = (zD - zM) / kz;
241 if (len < 0) {
242 m_ok[i] = false;
243 continue;
244 }
245 sol.len += len;
246
247 sol.xD = xM + len * kx;
248 sol.yD = m_mirror.yc + len * ky;
249 sol.yB = m_mirror.yc + (m_prism.zR - zM) / kz * ky;
250 sol.Nym = Nym;
251 m_ok[i] = sol.getStatus();
252 }
253
254 if (not(m_ok[0] or m_ok[1])) return c_NoPhysicsSolution;
255
256 return m_solutions[0].size() - 1;
257 }
double unfold(double x, int nx, double A)
unfold a coordinate.
Definition: func.h:31
double zD
detector (photo-cathode) position

◆ solveReflected()

int solveReflected ( double  xD,
double  zD,
int  Nxm,
double  xmMin,
double  xmMax,
const TOPTrack::AssumedEmission assumedEmission,
const CerenkovAngle cer,
double  step = 0 
) const

Solve inverse ray-tracing for reflected photon.

Parameters
xDunfolded position in x of photon at detection plane (unfolding w.r.t mirror)
zDposition of detection plane
Nxmsigned number of reflections before mirror
xmMinlower limit for the reflection point search range
xmMaxupper limit for the reflection point search range
assumedEmissionphoton emission position and track angles
cersine and cosine of Cerenkov angle
stepstep for numerical derivative calculation
Returns
index of solution or ErrorCode on fail

Definition at line 108 of file InverseRaytracer.cc.

111 {
112 const auto& emiPoint = assumedEmission.position;
113 const auto& trk = assumedEmission.trackAngles;
114 bool first = m_solutions[0].empty();
115 if (first) {
116 m_emiPoint = emiPoint;
117 m_cer = cer;
118 m_trk = trk;
119 }
120
121 double A = m_bars[0].A;
122 double B = m_bars[0].B;
123
124 double xM = 0;
125 double zM = 0;
126 double dxdz = 0;
127 if (Nxm % 2 == 0) {
128 double xE = func::unfold(emiPoint.X(), -Nxm, A);
129 double zE = emiPoint.Z();
130 bool ok = findReflectionPoint(xE, zE, xD, zD, xmMin, xmMax, xM, zM, dxdz);
131 if (not ok) return c_NoReflectionPoint;
132 } else {
133 double xE = func::unfold(emiPoint.X(), Nxm, A);
134 double zE = emiPoint.Z();
135 bool ok = findReflectionPoint(xE, zE, xD, zD, xmMin, xmMax, xM, zM, dxdz);
136 if (not ok) return c_NoReflectionPoint;
137 dxdz = -dxdz;
138 }
139
140 bool ok = solve(dxdz, cer, trk);
141 if (not ok) return c_NoEquationSolution;
142
143 double normX = (xM - m_mirror.xc) / m_mirror.R;
144 double normZ = (zM - m_mirror.zc) / m_mirror.R;
145
146 for (int i = 0; i < 2; i++) {
147 auto& sol = m_solutions[i].back();
148 sol.xD = xD;
149 sol.zD = zD;
150 sol.step = step;
151 sol.Nxm = Nxm;
152
153 double len = (zM - emiPoint.Z()) / sol.kz;
154 if (len < 0) {
155 m_ok[i] = false;
156 continue;
157 }
158 sol.len = len;
159 int Nym = lround((emiPoint.Y() + len * sol.ky) / B);
160
161 double kx = func::unfold(sol.kx, Nxm);
162 double ky = func::unfold(sol.ky, Nym);
163 double kz = sol.kz;
164 double s = 2 * (kx * normX + kz * normZ);
165 kx -= s * normX;
166 kz -= s * normZ;
167
168 len = (zD - zM) / kz;
169 if (len < 0) {
170 m_ok[i] = false;
171 continue;
172 }
173 sol.len += len;
174
175 sol.yD = m_mirror.yc + len * ky;
176 sol.yB = m_mirror.yc + (m_prism.zR - zM) / kz * ky;
177 sol.Nym = Nym;
178
179 if (first) {
180 m_ok[i] = true;
181 sol.setTotalReflStatus(A, B, m_cosTotal, kx, ky);
182 }
183 if (not sol.getStatus()) m_ok[i] = false;
184 }
185
186 if (not(m_ok[0] or m_ok[1])) return c_NoPhysicsSolution;
187
188 return m_solutions[0].size() - 1;
189 }
bool findReflectionPoint(double xE, double zE, double xD, double zD, double xmMin, double xmMax, double &xM, double &zM, double &dxdz) const
Finds reflection point on the mirror using semi-linear optics approximation.

Member Data Documentation

◆ m_bars

std::vector<BarSegment> m_bars
protectedinherited

geometry data of bar segments

Definition at line 188 of file RaytracerBase.h.

◆ m_cer

CerenkovAngle m_cer
mutableprivate

temporary storage of Cerenkov angle

Definition at line 272 of file InverseRaytracer.h.

◆ m_cosTotal

double m_cosTotal = 0
private

cosine of total reflection angle

Definition at line 268 of file InverseRaytracer.h.

◆ m_emiPoint

ROOT::Math::XYZPoint m_emiPoint
mutableprivate

temporary storage of emission point

Definition at line 271 of file InverseRaytracer.h.

◆ m_geometry

EGeometry m_geometry = c_Unified
protectedinherited

quartz geometry

Definition at line 185 of file RaytracerBase.h.

◆ m_mirror

Mirror m_mirror
protectedinherited

spherical mirror geometry data

Definition at line 189 of file RaytracerBase.h.

◆ m_moduleID

int m_moduleID = 0
protectedinherited

slot ID

Definition at line 184 of file RaytracerBase.h.

◆ m_ok

bool m_ok[2] = {false, false}
mutableprivate

status of solutions

Definition at line 270 of file InverseRaytracer.h.

◆ m_optics

EOptics m_optics = c_SemiLinear
protectedinherited

spherical mirror optics

Definition at line 186 of file RaytracerBase.h.

◆ m_prism

Prism m_prism
protectedinherited

prism geometry data

Definition at line 190 of file RaytracerBase.h.

◆ m_solutions

std::vector<Solution> m_solutions[2]
mutableprivate

storage for the two solutions

Definition at line 269 of file InverseRaytracer.h.

◆ m_trk

TOPTrack::TrackAngles m_trk
mutableprivate

temporary storage of track polar and azimuthal angles

Definition at line 273 of file InverseRaytracer.h.

◆ s_maxLen

double s_maxLen = 10000
staticprivate

maximal allowed propagation length

Definition at line 275 of file InverseRaytracer.h.


The documentation for this class was generated from the following files: