Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | List of all members
JPHYSICS::JPDF::JRoot Class Reference

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. More...

#include <JPDF.hh>

Public Member Functions

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

Public Attributes

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

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 1793 of file JPDF.hh.

Constructor & Destructor Documentation

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 1802 of file JPDF.hh.

1804  :
1805  is_valid(false),
1806  first (0.0),
1807  second(0.0)
1808  {
1809  using JTOOLS::C;
1810 
1811  const double a = n*n - 1.0;
1812  const double b = 2*C*t;
1813  const double c = R*n * R*n - C*t * C*t;
1814 
1815  const double q = b*b - 4*a*c;
1816 
1817  if (q >= 0.0) {
1818 
1819  first = (-b - sqrt(q)) / (2*a);
1820  second = (-b + sqrt(q)) / (2*a);
1821 
1822  is_valid = C*t > second;
1823  }
1824  }
double second
most downstream solution
Definition: JPDF.hh:1850
bool is_valid
validity of solutions
Definition: JPDF.hh:1848
static const double C
Speed of light in vacuum [m/ns].
Definition: JConstants.hh:22
double first
most upstream solution
Definition: JPDF.hh:1849

Member Function Documentation

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 1833 of file JPDF.hh.

1834  {
1835  switch (i) {
1836 
1837  case 0:
1838  return first;
1839 
1840  case 1:
1841  return second;
1842 
1843  default:
1844  throw JException("JRoot::operator[] invalid index");
1845  }
1846  }
double second
most downstream solution
Definition: JPDF.hh:1850
double first
most upstream solution
Definition: JPDF.hh:1849

Member Data Documentation

bool JPHYSICS::JPDF::JRoot::is_valid

validity of solutions

Definition at line 1848 of file JPDF.hh.

double JPHYSICS::JPDF::JRoot::first

most upstream solution

Definition at line 1849 of file JPDF.hh.

double JPHYSICS::JPDF::JRoot::second

most downstream solution

Definition at line 1850 of file JPDF.hh.


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