Jpp 19.3.0-rc.1
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 1971 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 1980 of file JPDF.hh.

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

2010 {
2011 switch (i) {
2012
2013 case 0:
2014 return first;
2015
2016 case 1:
2017 return second;
2018
2019 default:
2020 THROW(JException, "JRoot::operator[] invalid index");
2021 }
2022 }
#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 2024 of file JPDF.hh.

◆ first

double JPHYSICS::JPDF::JRoot::first

most upstream solution

Definition at line 2025 of file JPDF.hh.

◆ second

double JPHYSICS::JPDF::JRoot::second

most downstream solution

Definition at line 2026 of file JPDF.hh.


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