Jpp test-rotations-old-533-g2bdbdb559
the software that should make you happy
Loading...
Searching...
No Matches
JPHYSICS::JPDF::JRoot Class Reference

Auxiliary class to find solution(s) to $ z $ of the square root expression: More...

#include <JPDF.hh>

Public Member Functions

 JRoot (const double R, const double n, const double t)
 Determine solution(s) of quadratic equation.
 
double operator[] (const int i) const
 Get result by index.
 

Public Attributes

bool is_valid
 validity of solutions
 
double first
 most upstream solution
 
double second
 most downstream solution
 

Detailed Description

Auxiliary class to find solution(s) to $ z $ of the square root expression:

\begin{eqnarray*}
ct(z=0) & = & z + n \sqrt(z^2 + R^2)
\end{eqnarray*}

where $ n = 1/\cos(\theta_{c}) $ is the index of refraction.

Definition at line 1972 of file JPDF.hh.

Constructor & Destructor Documentation

◆ JRoot()

JPHYSICS::JPDF::JRoot::JRoot ( const double R,
const double n,
const double t )
inline

Determine solution(s) of quadratic equation.

Parameters
Rminimal distance of approach [m]
nindex of refraction
ttime at z = 0 [ns]

Definition at line 1981 of file JPDF.hh.

1983 :
1984 is_valid(false),
1985 first (0.0),
1986 second(0.0)
1987 {
1988 const double a = n*n - 1.0;
1989 const double b = 2*C*t;
1990 const double c = R*n * R*n - C*t * C*t;
1991
1992 const double q = b*b - 4*a*c;
1993
1994 if (q >= 0.0) {
1995
1996 first = (-b - sqrt(q)) / (2*a);
1997 second = (-b + sqrt(q)) / (2*a);
1998
1999 is_valid = C*t > second;
2000 }
2001 }
double first
most upstream solution
Definition JPDF.hh:2026
bool is_valid
validity of solutions
Definition JPDF.hh:2025
double second
most downstream solution
Definition JPDF.hh:2027
const int n
Definition JPolint.hh:791

Member Function Documentation

◆ operator[]()

double JPHYSICS::JPDF::JRoot::operator[] ( const int i) const
inline

Get result by index.

Parameters
iindex (0 or 1)
Returns
i == 0, first; i == 1, second; else throws exception

Definition at line 2010 of file JPDF.hh.

2011 {
2012 switch (i) {
2013
2014 case 0:
2015 return first;
2016
2017 case 1:
2018 return second;
2019
2020 default:
2021 THROW(JException, "JRoot::operator[] invalid index");
2022 }
2023 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.

Member Data Documentation

◆ is_valid

bool JPHYSICS::JPDF::JRoot::is_valid

validity of solutions

Definition at line 2025 of file JPDF.hh.

◆ first

double JPHYSICS::JPDF::JRoot::first

most upstream solution

Definition at line 2026 of file JPDF.hh.

◆ second

double JPHYSICS::JPDF::JRoot::second

most downstream solution

Definition at line 2027 of file JPDF.hh.


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