<!DOCTYPE HTML PUBLIC "-// IETF/DTD HTML 2.0// EN">
<html>
<!--                                             -->
<!-- Author: ROOT team (rootdev@hpsalo.cern.ch)  -->
<!--                                             -->
<!--   Date: Tue Apr  6 15:52:12 1999            -->
<!--                                             -->
<head>
<title>SmearTraj - source file</title>
<link rev=made href="mailto:rootdev@root.cern.ch">
<meta name="rating" content="General">
<meta name="objecttype" content="Manual">
<meta name="keywords" content="software development, oo, object oriented, unix, x11, motif, windows nt, c++, html, rene brun, fons rademakers">
<meta name="description" content="ROOT - An Object Oriented Framework For Large Scale Data Analysis.">
</head>
<body BGCOLOR="#ffffff" LINK="#0000ff" VLINK="#551a8b" ALINK="#ff0000" TEXT="#000000">
<a name="TopOfPage"></a>
<pre>
<b>// $Header: <a href=".././SmearTraj.html">SmearTraj</a>.cxx $</b>
<b>// For V3.0 of <a href=".././FastMC.html">FastMC</a>, April 2, 1999      J. Bogart</b>
<b>//</b>
<b>// Many thanks to Rasmus Munk Larsen of Stanford for the numerically-stable</b>
<b>// algorithm for finding the intersection of 2 circles.</b>


#include "TMath.h"
#include &lt;float.h&gt;   // for DBL_EPSILON

#include "<a href="../SmearTraj.h">SmearTraj.h</a>"
#define  false  0
#define  true   1

static const Double_t SBIG = 9999999.0;
static const Double_t A_LITTLE_WAYS = 0.10;   // a millimeter.

<b>//______________________________________________________________________</b>
<b>//</b>
<b>// <a href=".././SmearTraj.html">SmearTraj</a></b>
<b>//</b>
<b>// This class does the work of propagating particles.</b>

ClassImp(<a href=".././SmearTraj.html">SmearTraj</a>)

<a name="SmearTraj:SetParticle"> </a><a href="../ListOfTypes.html#void">void</a> <a href=".././SmearTraj.html#SmearTraj:SetParticle">SmearTraj::SetParticle</a>(<a href="http://root.cern.ch/root/html/McPart.html">McPart</a>* pP, <a href="../ListOfTypes.html#Int_t">Int_t</a> partIx) {
<b>  // Compute and cache some information about this particle</b>

  <a href="../ListOfTypes.html#Float_t">Float_t</a> *pIpos = pP-&gt;GetPosition();
  <a href="../ListOfTypes.html#Float_t">Float_t</a> *pImom = pP-&gt;GetMomentum();

  <a href=".././SmearTraj.html#SmearTraj:totalS">totalS</a> = 0.0;
  <a href=".././SmearTraj.html#SmearTraj:particleIx">particleIx</a> = partIx;
  for (<a href="../ListOfTypes.html#int">int</a> ix = 0; ix &lt; 3; ix++) {
    <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[ix] = *pIpos++;
    <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[ix] = *pImom++;  
    <a href=".././SmearTraj.html#SmearTraj:newP">newP</a>[ix] = 0.0;
    <a href=".././SmearTraj.html#SmearTraj:newM">newM</a>[ix] = 0.0;
  }
  <a href=".././SmearTraj.html#SmearTraj:momMag">momMag</a> = <a href=".././SmearTraj.html#SmearTraj:xyMomMag">xyMomMag</a> = 0.0;
  <a href=".././SmearTraj.html#SmearTraj:sinLambda">sinLambda</a> = <a href=".././SmearTraj.html#SmearTraj:cosLambda">cosLambda</a> = 0.0;
  <a href=".././SmearTraj.html#SmearTraj:rad">rad</a> = <a href=".././SmearTraj.html#SmearTraj:radQ">radQ</a> = <a href=".././SmearTraj.html#SmearTraj:xCenter">xCenter</a> = <a href=".././SmearTraj.html#SmearTraj:yCenter">yCenter</a> = 0.0;
  <a href=".././SmearTraj.html#SmearTraj:fieldCnv">fieldCnv</a> = 0.0;

   <a href=".././SmearTraj.html#SmearTraj:q">q</a> = (<a href="../ListOfTypes.html#int">int</a>) pP-&gt;<a href="#SmearTraj:GetCharge">GetCharge</a>();

  <a href=".././SmearTraj.html#SmearTraj:pPart">pPart</a> = pP;
}

<a name="SmearTraj:Update"> </a><a href="../ListOfTypes.html#void">void</a>  <a href=".././SmearTraj.html#SmearTraj:Update">SmearTraj::Update</a>() {
<b>  // Invoke this routine when the result of the last request to propagate is </b>
<b>  // is deemed OK.</b>

  for (<a href="../ListOfTypes.html#int">int</a> i = 0; i &lt; 3; i++) {
    <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[i] = <a href=".././SmearTraj.html#SmearTraj:newP">newP</a>[i];
    <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[i] = <a href=".././SmearTraj.html#SmearTraj:newM">newM</a>[i];
  }
  <a href=".././SmearTraj.html#SmearTraj:totalS">totalS</a> += <a href=".././SmearTraj.html#SmearTraj:deltaS">deltaS</a>;
}
  
<a name="SmearTraj:makeHelixQuantities"> </a><a href="../ListOfTypes.html#void">void</a> <a href=".././SmearTraj.html#SmearTraj:makeHelixQuantities">SmearTraj::makeHelixQuantities</a>(<a href="../ListOfTypes.html#Double_t">Double_t</a> fld) {
<b>  // For a given field (and momementum magnitude of particle which,</b>
<b>  // for current implementation, is constant throughoutn its life)</b>
<b>  // compute and store some useful quantities.</b>

  static const <a href="../ListOfTypes.html#Double_t">Double_t</a> VERY_SMALL_COSLAMBDA = 0.0000010;
  <a href=".././SmearTraj.html#SmearTraj:fieldCnv">fieldCnv</a> = fld * 0.003;

  <a href=".././SmearTraj.html#SmearTraj:momMag">momMag</a> = <a href="http://root.cern.ch/root/html/TMath.html#TMath:Sqrt">TMath::Sqrt</a>(<a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[0]*<a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[0] + <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[1]*<a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[1] + <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[2]*<a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[2]);
  

  <a href=".././SmearTraj.html#SmearTraj:xyMomMag">xyMomMag</a> = <a href="#SmearTraj:pythagPlus">pythagPlus</a>(<a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[0], <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[1]);
  <a href=".././SmearTraj.html#SmearTraj:sinLambda">sinLambda</a> = <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[2] / <a href=".././SmearTraj.html#SmearTraj:momMag">momMag</a>;
  <a href=".././SmearTraj.html#SmearTraj:cosLambda">cosLambda</a> = <a href=".././SmearTraj.html#SmearTraj:xyMomMag">xyMomMag</a> / <a href=".././SmearTraj.html#SmearTraj:momMag">momMag</a>;
  
  if (<a href=".././SmearTraj.html#SmearTraj:q">q</a> == 0) {
<b>    // propagate helix stuff is irrelevant</b>
    <a href=".././SmearTraj.html#SmearTraj:xCenter">xCenter</a> = <a href=".././SmearTraj.html#SmearTraj:yCenter">yCenter</a>  = <a href=".././SmearTraj.html#SmearTraj:rad">rad</a> = <a href=".././SmearTraj.html#SmearTraj:radQ">radQ</a> = 0;
  }
  else {
    if (<a href=".././SmearTraj.html#SmearTraj:cosLambda">cosLambda</a> &lt; VERY_SMALL_COSLAMBDA) { // essentially just moves in z
      <a href=".././SmearTraj.html#SmearTraj:xCenter">xCenter</a> = <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[0];
      <a href=".././SmearTraj.html#SmearTraj:yCenter">yCenter</a> = <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[1];
      <a href=".././SmearTraj.html#SmearTraj:radQ">radQ</a> = 0;
    }
    else {
      <a href="../ListOfTypes.html#Double_t">Double_t</a> fieldCnvQ = <a href=".././SmearTraj.html#SmearTraj:fieldCnv">fieldCnv</a> * <a href=".././SmearTraj.html#SmearTraj:q">q</a>;

      <a href=".././SmearTraj.html#SmearTraj:radQ">radQ</a> = <a href=".././SmearTraj.html#SmearTraj:xyMomMag">xyMomMag</a> / fieldCnvQ;
      <a href=".././SmearTraj.html#SmearTraj:rad">rad</a> = <a href="http://root.cern.ch/root/html/TMath.html#TMath:Abs">TMath::Abs</a>(<a href=".././SmearTraj.html#SmearTraj:radQ">radQ</a>);
<b>      //      <a href=".././SmearTraj.html#SmearTraj:xCenter">xCenter</a> = <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[0] + <a href=".././SmearTraj.html#SmearTraj:radQ">radQ</a> * <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[1] / <a href=".././SmearTraj.html#SmearTraj:xyMomMag">xyMomMag</a>;</b>
      <a href=".././SmearTraj.html#SmearTraj:xCenter">xCenter</a> = <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[0] + <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[1] / fieldCnvQ;
<b>      //      <a href=".././SmearTraj.html#SmearTraj:yCenter">yCenter</a> = <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[1] - <a href=".././SmearTraj.html#SmearTraj:radQ">radQ</a> * <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[0] / <a href=".././SmearTraj.html#SmearTraj:xyMomMag">xyMomMag</a>;</b>
      <a href=".././SmearTraj.html#SmearTraj:yCenter">yCenter</a> = <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[1] - <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[0] / fieldCnvQ;
    }
  }
}

<a name="SmearTraj:QuadRoot"> </a><a href="../ListOfTypes.html#Double_t">Double_t</a> <a href=".././SmearTraj.html#SmearTraj:QuadRoot">SmearTraj::QuadRoot</a>(const <a href="../ListOfTypes.html#Double_t">Double_t</a> a, const <a href="../ListOfTypes.html#Double_t">Double_t</a> b, 
			     const <a href="../ListOfTypes.html#Double_t">Double_t</a> c, <a href="../ListOfTypes.html#Bool_t">Bool_t</a>* status) {
<b>  // Utility used when swimming linearly to cylinder.  Return</b>
<b>  // Smallest positive root, if any.</b>

  <a href="../ListOfTypes.html#Double_t">Double_t</a> disc = b*b - 4 * a * c;
  static const <a href="../ListOfTypes.html#Double_t">Double_t</a> VERY_SMALL = 0.00001;

  if ((disc &lt; 0.0) || ((a &lt; VERY_SMALL) &amp;&amp; (-a &gt; - VERY_SMALL))) {
    *status = false;
    return 0.0;
  }
  else *status = true;

  <a href="../ListOfTypes.html#Double_t">Double_t</a> r1, r2;

  disc = <a href="http://root.cern.ch/root/html/TMath.html#TMath:Sqrt">TMath::Sqrt</a>(disc);

  r1 = (-b + disc) / (2 * a);
  r2 = (-b - disc) / (2 * a);

  if (r1 &lt; 0.0) {
    if (r2 &lt; 0.0) {
      *status = false;  
    }
    return r2;
  }
  else if (r2 &lt; 0.0) return r1;      
  else return (r1 &gt; r2) ? r2 : r1;  // both positive
}

<a name="SmearTraj:circleIntersect"> </a><a href="../ListOfTypes.html#Int_t">Int_t</a> <a href=".././SmearTraj.html#SmearTraj:circleIntersect">SmearTraj::circleIntersect</a>(<a href="../ListOfTypes.html#Double_t">Double_t</a> rv,    // radius of cylinder
				 <a href="../ListOfTypes.html#Double_t">Double_t</a> p1[],   // (x,y) of 1st solution
				 <a href="../ListOfTypes.html#Double_t">Double_t</a> p2[])   // (x,y) of 2nd solution
{
<b>  // This utility is used by <a href=".././SmearTraj.html#SmearTraj:HelixToCy">SmearTraj::HelixToCy</a>.</b>
<b>  //</b>
<b>  // Given two circles, one centered about the origin, find their points of</b>
<b>  // intersection.  The return value is the number of solutions found.</b>
<b>  // In this application, one circle is the (xy-projection) of a volume</b>
<b>  // boundary, always centered about the origin.  The other the helix which</b>
<b>  // is typically not centered about the origin.</b>
<b>  // This algorithm is due to Rasmus Munk Larsen.</b>

<b>  // Returns the number of intersections or error code:</b>

<b>  //   -2: Invalid input.</b>
<b>  //   -1: Infinitely many intersections - the two circles are identical.</b>
<b>  //      0: No intersection.</b>
<b>  //      1: 1 point of intersection, (p1[0],p1[1]) contains the </b>
<b>  //           x- and y-coordinates.</b>
<b>  //      2: 2 point of intersection, (p1[0],p1[1]) and (p2[0],p2[1])</b>
<b>  //           contains the x- and y-coordinates</b>

  <a href="../ListOfTypes.html#Double_t">Double_t</a> x0 = <a href=".././SmearTraj.html#SmearTraj:xCenter">xCenter</a>;
  <a href="../ListOfTypes.html#Double_t">Double_t</a> y0 = <a href=".././SmearTraj.html#SmearTraj:yCenter">yCenter</a>;
  <a href="../ListOfTypes.html#Double_t">Double_t</a> r2 = <a href=".././SmearTraj.html#SmearTraj:rad">rad</a>;     // radius of helix
  <a href="../ListOfTypes.html#Double_t">Double_t</a> r1 = rv;      // radius of detector volume

  <a href="../ListOfTypes.html#Int_t">Int_t</a>    nGood = 0;

  <a href="../ListOfTypes.html#Double_t">Double_t</a> d;   // distance between circle centers
  <a href="../ListOfTypes.html#Double_t">Double_t</a> h; // distance from point of intersection of the two circles 
<b>              //   to line between centers</b>
  <a href="../ListOfTypes.html#Double_t">Double_t</a> l; // distance from origin to intersection of two perp. lines: 
<b>              // the line between centers and the line connecting two </b>
<b>              // intersections (solutions)</b>
  <a href="../ListOfTypes.html#Double_t">Double_t</a> v1, v2;  // (v1, v2) is unit vector along line connecting centers.
  <a href="../ListOfTypes.html#Double_t">Double_t</a> mag; // scale factor used in checking for solutions


<b>  // Check for negative radii. </b>
  if (r1&lt;=0.0 || r2&lt;=0.0) {
    fprintf(stderr,"Negative radii passed to circle_intersect:");
    fprintf(stderr,"r1 = %g, r2=%gn", r1, r2);
    return -2;
  }
  
<b>  // Now decide how many points of intersection there are: </b>

  if ( x0==0 &amp;&amp; y0==0 &amp;&amp; r1==r2)
    return -1; // The two circles are identical! 


  d = <a href="#SmearTraj:pythagPlus">pythagPlus</a>(x0,y0); 
  mag = <a href="http://root.cern.ch/root/html/TMath.html#TMath:Abs">TMath::Abs</a>(r1) + <a href="http://root.cern.ch/root/html/TMath.html#TMath:Abs">TMath::Abs</a>(r2) + <a href="http://root.cern.ch/root/html/TMath.html#TMath:Abs">TMath::Abs</a>(d);

  if ( d &gt; r1 +r2 + 10 * DBL_EPSILON * mag  ||  
       d &lt; <a href="http://root.cern.ch/root/html/TMath.html#TMath:Abs">TMath::Abs</a>(r1-r2) - 10 * DBL_EPSILON * mag) 
    return 0; // No intersections! 


  if ( <a href="http://root.cern.ch/root/html/TMath.html#TMath:Abs">TMath::Abs</a>(d-r1-r2) &lt;= 10*DBL_EPSILON*mag  ||  
       <a href="http://root.cern.ch/root/html/TMath.html#TMath:Abs">TMath::Abs</a>(d-<a href="http://root.cern.ch/root/html/TMath.html#TMath:Abs">TMath::Abs</a>(r1-r2)) &lt;= 10*DBL_EPSILON*mag) {
<b>    // (Maybe!) One point of intersection!</b>
    v1 = x0/d; 
    v2 = y0/d;
    p1[0] = r1*v1;
    p2[0] = r1*v2;
    nGood = 1;
  }
  else {
<b>    // Two points of intersection! </b>
    l = (d + (r1*(r1/d) - r2*(r2/d)))/2;
    h = <a href="#SmearTraj:pythagMinus">pythagMinus</a>(r1, l);
    v1 = x0/d; 
    v2 = y0/d;
<b>    // First point (x1,y1):</b>
    p1[0] = l*v1 + h*v2;
    p1[1] = l*v2 - h*v1;
<b>    // Second point (x2,y2):</b>
    p2[0] = l*v1 - h*v2;
    p2[1] = l*v2 + h*v1;
    nGood = 2;
  }

  return nGood;
}

<a name="SmearTraj:phaseChange"> </a><a href="../ListOfTypes.html#Double_t">Double_t</a> <a href=".././SmearTraj.html#SmearTraj:phaseChange">SmearTraj::phaseChange</a>(<a href="../ListOfTypes.html#Double_t">Double_t</a> newX, <a href="../ListOfTypes.html#Double_t">Double_t</a> newY) {
<b>  // Return change in phase needed to get to (newX, newY) from</b>
<b>  // initial position</b>

  <a href="../ListOfTypes.html#Double_t">Double_t</a> iniPhi, newPhi, delPhi;

<b>  // ATan2 returns a value in the range -pi to pi</b>

<b>  // Might want to cache iniPhi in Update method rather than re-computing</b>
  iniPhi = <a href="http://root.cern.ch/root/html/TMath.html#TMath:ATan2">TMath::ATan2</a>(<a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[1] - <a href=".././SmearTraj.html#SmearTraj:yCenter">yCenter</a>, <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[0] - <a href=".././SmearTraj.html#SmearTraj:xCenter">xCenter</a>); 
  
  newPhi = <a href="http://root.cern.ch/root/html/TMath.html#TMath:ATan2">TMath::ATan2</a>(newY - <a href=".././SmearTraj.html#SmearTraj:yCenter">yCenter</a>, newX - <a href=".././SmearTraj.html#SmearTraj:xCenter">xCenter</a>);
  
<b>  // Which gets subtracted from which depends on sign of particle.</b>
<b>  // I *think* neg. charge goes "forwards" in a positive field</b>
  delPhi = newPhi - iniPhi;          // assume forward
  if ((<a href=".././SmearTraj.html#SmearTraj:q">q</a> * <a href=".././SmearTraj.html#SmearTraj:fieldCnv">fieldCnv</a>) &gt; 0) delPhi = - delPhi;    // whoops, wrong guess
  if (delPhi &lt; 0.0) delPhi += 2.0 * <a href="http://root.cern.ch/root/html/TMath.html#TMath:Pi">TMath::Pi</a>();  // normalize
  return delPhi;
}

<a href=".././SmearTraj.html#SmearTraj:PropagateRet">SmearTraj::PropagateRet</a> shortestPath(<a href="../ListOfTypes.html#Double_t">Double_t</a> sEnd, <a href="../ListOfTypes.html#Double_t">Double_t</a> sIn, 
				     <a href="../ListOfTypes.html#Double_t">Double_t</a> sOut, <a href="../ListOfTypes.html#Double_t">Double_t</a>* pS)
{
<b>  // Given values for for paths to endcap, inner barrel, outer barrel,</b>
<b>  // put the smallest in return path argument and return an appropriate</b>
<b>  // status code.  This routine can't distinguish between +z and -z</b>
<b>  // endcap, so caller has to fix up return code afterwards in this case.</b>

<b>  // Shortest path gives us the surface we hit first</b>
  if (sEnd &lt; sOut) {
    if (sEnd &lt; sIn) {
      *pS = sEnd;
      return <a href=".././SmearTraj.html#SmearTraj:INTERSECT_ZPLUS">SmearTraj::INTERSECT_ZPLUS</a>;       // Caller may have to fix
    }
    else {
      *pS = sIn;
      return <a href=".././SmearTraj.html#SmearTraj:INTERSECT_CYLIN">SmearTraj::INTERSECT_CYLIN</a>;
    }
  }
  else if (sIn &lt; sOut) {
    *pS = sIn;
    return <a href=".././SmearTraj.html#SmearTraj:INTERSECT_CYLIN">SmearTraj::INTERSECT_CYLIN</a>;
  }
  else {
    *pS = sOut;
    return <a href=".././SmearTraj.html#SmearTraj:INTERSECT_CYLOUT">SmearTraj::INTERSECT_CYLOUT</a>;
  }
}

<a href=".././SmearTraj.html#SmearTraj:PropagateRet">SmearTraj::PropagateRet</a> <a href=".././SmearTraj.html#SmearTraj:HelixPath">SmearTraj::HelixPath</a>(<a href="../ListOfTypes.html#Double_t">Double_t</a> fld, <a href="../ListOfTypes.html#Double_t">Double_t</a> s) {
<b>  // Propagate along a suitable helix for length s, starting with input</b>
<b>  // position and momentum vectors (by default use vectors specified in</b>
<b>  // previous call to SetParticle). Return final position and momentum.</b>

  <a href="../ListOfTypes.html#Double_t">Double_t</a> iMomPhi;

  if (<a href=".././SmearTraj.html#SmearTraj:q">q</a> == 0) return <a href=".././SmearTraj.html#SmearTraj:INTERSECT_UNCHARGED">INTERSECT_UNCHARGED</a>;

<b>  // Invoke utility to compute some useful things.</b>
  <a href="#SmearTraj:makeHelixQuantities">makeHelixQuantities</a>(fld);

  iMomPhi = <a href="http://root.cern.ch/root/html/TMath.html#TMath:ATan2">TMath::ATan2</a>(<a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[1], <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[0]);

  <a href="../ListOfTypes.html#Double_t">Double_t</a>  phiMom = s * <a href=".././SmearTraj.html#SmearTraj:cosLambda">cosLambda</a> / <a href=".././SmearTraj.html#SmearTraj:radQ">radQ</a> - iMomPhi;
  <a href=".././SmearTraj.html#SmearTraj:newP">newP</a>[0] = <a href=".././SmearTraj.html#SmearTraj:xCenter">xCenter</a> + <a href=".././SmearTraj.html#SmearTraj:radQ">radQ</a> * <a href="http://root.cern.ch/root/html/TMath.html#TMath:Sin">TMath::Sin</a>(phiMom);       // x
  <a href=".././SmearTraj.html#SmearTraj:newP">newP</a>[1] = <a href=".././SmearTraj.html#SmearTraj:yCenter">yCenter</a> + <a href=".././SmearTraj.html#SmearTraj:radQ">radQ</a> * <a href="http://root.cern.ch/root/html/TMath.html#TMath:Cos">TMath::Cos</a>(phiMom); // y
  <a href=".././SmearTraj.html#SmearTraj:newP">newP</a>[2] = <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[2] + s * <a href=".././SmearTraj.html#SmearTraj:sinLambda">sinLambda</a>;
  
<b>  // Momemtum vector</b>

  <a href=".././SmearTraj.html#SmearTraj:newM">newM</a>[0] = <a href=".././SmearTraj.html#SmearTraj:momMag">momMag</a> * <a href=".././SmearTraj.html#SmearTraj:cosLambda">cosLambda</a> * <a href="http://root.cern.ch/root/html/TMath.html#TMath:Cos">TMath::Cos</a>(phiMom);        // x
  <a href=".././SmearTraj.html#SmearTraj:newM">newM</a>[1] = -<a href=".././SmearTraj.html#SmearTraj:momMag">momMag</a> * <a href=".././SmearTraj.html#SmearTraj:cosLambda">cosLambda</a> * <a href="http://root.cern.ch/root/html/TMath.html#TMath:Sin">TMath::Sin</a>(phiMom); // y
  <a href=".././SmearTraj.html#SmearTraj:newM">newM</a>[2] = <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[2];                              // z - doesn't change

  <a href=".././SmearTraj.html#SmearTraj:deltaS">deltaS</a> = s;
  return <a href=".././SmearTraj.html#SmearTraj:INTERSECT_PATHOK">INTERSECT_PATHOK</a>;
}


<a href=".././SmearTraj.html#SmearTraj:PropagateRet">SmearTraj::PropagateRet</a> <a href=".././SmearTraj.html#SmearTraj:LinePath">SmearTraj::LinePath</a>(<a href="../ListOfTypes.html#Double_t">Double_t</a> s) {
<b>  // Propagate along a line.  Same call interface as HelixPath </b>
<b>  // except for fld.  </b>

  <a href="../ListOfTypes.html#Double_t">Double_t</a> xMom = <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[0];
  <a href="../ListOfTypes.html#Double_t">Double_t</a> yMom = <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[1];
  <a href="../ListOfTypes.html#Double_t">Double_t</a> zMom = <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[2];

<b>  // Momentum doesn't change in model with no energy loss.</b>
  <a href=".././SmearTraj.html#SmearTraj:newM">newM</a>[0] = <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[0];
  <a href=".././SmearTraj.html#SmearTraj:newM">newM</a>[1] = <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[1];
  <a href=".././SmearTraj.html#SmearTraj:newM">newM</a>[2] = <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[2];

  <a href=".././SmearTraj.html#SmearTraj:momMag">momMag</a> = <a href="http://root.cern.ch/root/html/TMath.html#TMath:Sqrt">TMath::Sqrt</a>(xMom*xMom + yMom*yMom + zMom*zMom);

  if (<a href=".././SmearTraj.html#SmearTraj:momMag">momMag</a> == 0) { // nothing happens
    <a href=".././SmearTraj.html#SmearTraj:newP">newP</a>[0] = <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[0];
    <a href=".././SmearTraj.html#SmearTraj:newP">newP</a>[1] = <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[1];
    <a href=".././SmearTraj.html#SmearTraj:newP">newP</a>[2] = <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[2];
  }
  <a href=".././SmearTraj.html#SmearTraj:newP">newP</a>[0] = <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[0] + xMom * s / <a href=".././SmearTraj.html#SmearTraj:momMag">momMag</a>;
  <a href=".././SmearTraj.html#SmearTraj:newP">newP</a>[1] = <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[1] + yMom * s / <a href=".././SmearTraj.html#SmearTraj:momMag">momMag</a>;
  <a href=".././SmearTraj.html#SmearTraj:newP">newP</a>[2] = <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[2] + zMom * s / <a href=".././SmearTraj.html#SmearTraj:momMag">momMag</a>;
  <a href=".././SmearTraj.html#SmearTraj:deltaS">deltaS</a> = s;

  return <a href=".././SmearTraj.html#SmearTraj:INTERSECT_PATHOK">INTERSECT_PATHOK</a>;
}
<a href=".././SmearTraj.html#SmearTraj:PropagateRet">SmearTraj::PropagateRet</a> <a href=".././SmearTraj.html#SmearTraj:HelixToCyl">SmearTraj::HelixToCyl</a>(<a href=".././SmearVolume.html">SmearVolume</a> *pCur, <a href="../ListOfTypes.html#Double_t">Double_t</a> *pS)
{
<b>  // Propagate along a suitable helix until it intersects the surface of a</b>
<b>  // cylindrical tube with inner radius rCylIn, outer radius rCylOut,</b>
<b>  // and ends at z = +- zCyl.  Return code indicates whether intersection was </b>
<b>  // with -z end, +z end,  inner barrel surface, outer barrel surface</b>
<b>  // or never happened.  Return path length as well as final position </b>
<b>  // and momentum vectors.</b>
<b>  // Initial position must be inside the tube.</b>
  <a href="../ListOfTypes.html#Double_t">Double_t</a>      iMomPhi;
  <a href="../ListOfTypes.html#Double_t">Double_t</a>      s;
  PropagateRet  ret, ret1;
  <a href="../ListOfTypes.html#Double_t">Double_t</a>      zCyl = pCur-&gt;outerZ;
  <a href="../ListOfTypes.html#Double_t">Double_t</a>      rCylIn = pCur-&gt;innerR;
  <a href="../ListOfTypes.html#Double_t">Double_t</a>      rCylOut = pCur-&gt;outerR;

<b>  // Perhaps only for diagnostic purposes, keep coordinates of </b>
<b>  // "best" intersection point with inner and outer cylinders.</b>
  <a href="../ListOfTypes.html#Double_t">Double_t</a>      xInner, yInner, xOuter, yOuter;
  <a href="../ListOfTypes.html#Double_t">Double_t</a>      sol1[2], sol2[2];

  if (<a href=".././SmearTraj.html#SmearTraj:q">q</a> == 0) return <a href=".././SmearTraj.html#SmearTraj:INTERSECT_ERROR">INTERSECT_ERROR</a>;
  ret = <a href=".././SmearTraj.html#SmearTraj:INTERSECT_NONE">INTERSECT_NONE</a>;   // unknown at this point
  *pS = 0.0;

<b>  // Propagate "a little ways" and then check that we're inside volume</b>
<b>  // (might be on the boundary to begin with).</b>
<b>  // A side effect of this is to compute radius, etc.</b>
  ret1 = <a href="#SmearTraj:HelixPath">HelixPath</a>(pCur-&gt;field, A_LITTLE_WAYS);

  if (!<a href="#SmearTraj:checkInside">checkInside</a>(pCur))   return <a href=".././SmearTraj.html#SmearTraj:INTERSECT_ERROR">INTERSECT_ERROR</a>;
  else <a href="#SmearTraj:Update">Update</a>();

  iMomPhi = <a href="http://root.cern.ch/root/html/TMath.html#TMath:ATan2">TMath::ATan2</a>(<a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[1], <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[0]);

<b>  // Which endcap, if any, are we headed towards?  Find s for endcap hit.</b>
  <a href="../ListOfTypes.html#Double_t">Double_t</a>  sEndcap, sBarrelOut, sBarrelIn;
  <a href="../ListOfTypes.html#Double_t">Double_t</a>  smallSinLambda = zCyl / SBIG;

  if (<a href=".././SmearTraj.html#SmearTraj:sinLambda">sinLambda</a> &gt; smallSinLambda) {
    ret = <a href=".././SmearTraj.html#SmearTraj:INTERSECT_ZPLUS">INTERSECT_ZPLUS</a>;
    sEndcap = (zCyl - <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[2]) / <a href=".././SmearTraj.html#SmearTraj:sinLambda">sinLambda</a>;
  }
  else if (<a href=".././SmearTraj.html#SmearTraj:sinLambda">sinLambda</a> &lt; -smallSinLambda) {
    ret = <a href=".././SmearTraj.html#SmearTraj:INTERSECT_ZMINUS">INTERSECT_ZMINUS</a>;
    sEndcap = -(zCyl + <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[2]) / <a href=".././SmearTraj.html#SmearTraj:sinLambda">sinLambda</a>;
  }  
  else {   // we're headed for barrel, but set variables to something anyway
    sEndcap = SBIG;
  }

<b>  // Find s for outer barrel</b>
  { 
    <a href="../ListOfTypes.html#Int_t">Int_t</a> nSol = <a href="#SmearTraj:circleIntersect">circleIntersect</a>(rCylOut, sol1, sol2);

    switch (nSol) {
    case 0: 
    case 1:
      sBarrelOut = SBIG;
      break;
    case 2:   // Bunch of stuff to do here
      {
	<a href="../ListOfTypes.html#Double_t">Double_t</a>  delPhi0, delPhi1;
	delPhi0 = <a href="#SmearTraj:phaseChange">phaseChange</a>(sol1[0], sol1[1]);
	delPhi1 = <a href="#SmearTraj:phaseChange">phaseChange</a>(sol2[0], sol2[1]);

	if (delPhi1 &lt; delPhi0) delPhi0 = delPhi1;
<b>	// Now use this to calculate path length</b>

	sBarrelOut = delPhi0 * <a href=".././SmearTraj.html#SmearTraj:rad">rad</a> / <a href=".././SmearTraj.html#SmearTraj:cosLambda">cosLambda</a>;
	break;
      }
    default:  // anything else is screwy
      printf(" <a href=".././SmearTraj.html#SmearTraj:HelixToCyl">SmearTraj::HelixToCyl</a>: Bad # intersections (%d) with outer volumen", nSol);
      return <a href=".././SmearTraj.html#SmearTraj:INTERSECT_ERROR">INTERSECT_ERROR</a>;
      break;
    }
  }

<b>  // .. and similarly for inner barrel -- if rCylIn isn't zero</b>
  if (rCylIn &gt; .01)   { 
    <a href="../ListOfTypes.html#Int_t">Int_t</a> nSol = <a href="#SmearTraj:circleIntersect">circleIntersect</a>(rCylIn, sol1, sol2);

    switch (nSol) {
    case 0: 
    case 1:
      sBarrelIn = SBIG;
      break;
    case 2:   // Bunch of stuff to do here
      {
	<a href="../ListOfTypes.html#Double_t">Double_t</a>  delPhi0, delPhi1;
	delPhi0 = <a href="#SmearTraj:phaseChange">phaseChange</a>(sol1[0], sol1[1]);
	delPhi1 = <a href="#SmearTraj:phaseChange">phaseChange</a>(sol2[0], sol2[1]);

	if (delPhi1 &lt; delPhi0) delPhi0 = delPhi1;
<b>	// Now use this to calculate path length</b>

	sBarrelIn = delPhi0 * <a href=".././SmearTraj.html#SmearTraj:rad">rad</a> / <a href=".././SmearTraj.html#SmearTraj:cosLambda">cosLambda</a>;
	break;
      }
    default:  // anything else is screwy
      printf(" <a href=".././SmearTraj.html#SmearTraj:HelixToCyl">SmearTraj::HelixToCyl</a>: Bad # intersections (%d) with inner volumen", nSol);
      return <a href=".././SmearTraj.html#SmearTraj:INTERSECT_ERROR">INTERSECT_ERROR</a>;
      break;
    }
  }
  else sBarrelIn = SBIG;

  ret1 = shortestPath(sEndcap, sBarrelIn, sBarrelOut, &amp;s);
  if (ret1 != <a href=".././SmearTraj.html#SmearTraj:INTERSECT_ZPLUS">INTERSECT_ZPLUS</a>) ret = ret1;

  if (s == SBIG) return <a href=".././SmearTraj.html#SmearTraj:INTERSECT_NONE">INTERSECT_NONE</a>;

<b>  // In any case need to calculate all returned values</b>
  <a href="../ListOfTypes.html#Double_t">Double_t</a>  phiMom = s * <a href=".././SmearTraj.html#SmearTraj:cosLambda">cosLambda</a> / <a href=".././SmearTraj.html#SmearTraj:radQ">radQ</a> - iMomPhi;
  <a href=".././SmearTraj.html#SmearTraj:newP">newP</a>[0] = <a href=".././SmearTraj.html#SmearTraj:xCenter">xCenter</a> + <a href=".././SmearTraj.html#SmearTraj:radQ">radQ</a> * <a href="http://root.cern.ch/root/html/TMath.html#TMath:Sin">TMath::Sin</a>(phiMom);  // x
  <a href=".././SmearTraj.html#SmearTraj:newP">newP</a>[1] = <a href=".././SmearTraj.html#SmearTraj:yCenter">yCenter</a> + <a href=".././SmearTraj.html#SmearTraj:radQ">radQ</a> * <a href="http://root.cern.ch/root/html/TMath.html#TMath:Cos">TMath::Cos</a>(phiMom);
  <a href=".././SmearTraj.html#SmearTraj:newP">newP</a>[2] = <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[2] + s * <a href=".././SmearTraj.html#SmearTraj:sinLambda">sinLambda</a>;

  <a href=".././SmearTraj.html#SmearTraj:deltaS">deltaS</a> = s;
  *pS = s + A_LITTLE_WAYS;
  
<b>  // Momemtum vector</b>

  <a href=".././SmearTraj.html#SmearTraj:newM">newM</a>[0] = <a href=".././SmearTraj.html#SmearTraj:momMag">momMag</a> * <a href=".././SmearTraj.html#SmearTraj:cosLambda">cosLambda</a> * <a href="http://root.cern.ch/root/html/TMath.html#TMath:Cos">TMath::Cos</a>(phiMom);        // x
  <a href=".././SmearTraj.html#SmearTraj:newM">newM</a>[1] = -<a href=".././SmearTraj.html#SmearTraj:momMag">momMag</a> * <a href=".././SmearTraj.html#SmearTraj:cosLambda">cosLambda</a> * <a href="http://root.cern.ch/root/html/TMath.html#TMath:Sin">TMath::Sin</a>(phiMom); // y
  <a href=".././SmearTraj.html#SmearTraj:newM">newM</a>[2] = <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[2];                              // z - doesn't change

  return ret;
}

<a href=".././SmearTraj.html#SmearTraj:PropagateRet">SmearTraj::PropagateRet</a> <a href=".././SmearTraj.html#SmearTraj:LineToCyl">SmearTraj::LineToCyl</a>(<a href=".././SmearVolume.html">SmearVolume</a> *pCur, <a href="../ListOfTypes.html#Double_t">Double_t</a> *pS)
{
<b>  // Propagate along straight line to cylinder.</b>

  <a href="../ListOfTypes.html#Double_t">Double_t</a> xMom, yMom, zMom;
  <a href="../ListOfTypes.html#Double_t">Double_t</a> ix, iy, iz;
  <a href="../ListOfTypes.html#Double_t">Double_t</a> x, y, z;
  <a href="../ListOfTypes.html#Double_t">Double_t</a> zCyl = pCur-&gt;outerZ;
  <a href="../ListOfTypes.html#Double_t">Double_t</a> rCylIn = pCur-&gt;innerR;
  <a href="../ListOfTypes.html#Double_t">Double_t</a> rCylOut = pCur-&gt;outerR;

  static const <a href="../ListOfTypes.html#Double_t">Double_t</a> SMALL_MOM = .00001;
  PropagateRet  ret, ret1;
  <a href="../ListOfTypes.html#Double_t">Double_t</a> delX, delY, delZ;
  <a href="../ListOfTypes.html#Double_t">Double_t</a> sEnd, sIn, sOut, s;

  *pS = 0.0;

<b>  // Must start out inside</b>
  ret1 = <a href="#SmearTraj:LinePath">LinePath</a>(A_LITTLE_WAYS);
  if (!<a href="#SmearTraj:checkInside">checkInside</a>(pCur)) {
    return <a href=".././SmearTraj.html#SmearTraj:INTERSECT_ERROR">INTERSECT_ERROR</a>;
  }
  else <a href="#SmearTraj:Update">Update</a>();

  <a href=".././SmearTraj.html#SmearTraj:newM">newM</a>[0] = xMom = <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[0]; 
  <a href=".././SmearTraj.html#SmearTraj:newM">newM</a>[1] = yMom = <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[1]; 
  <a href=".././SmearTraj.html#SmearTraj:newM">newM</a>[2] = zMom = <a href=".././SmearTraj.html#SmearTraj:iM">iM</a>[2]; 

  if (xMom*xMom + yMom*yMom + zMom*zMom &lt; .000001) return <a href=".././SmearTraj.html#SmearTraj:INTERSECT_NONE">INTERSECT_NONE</a>;

  ix = <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[0]; iy = <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[1]; iz = <a href=".././SmearTraj.html#SmearTraj:iP">iP</a>[2];

  ret = <a href=".././SmearTraj.html#SmearTraj:INTERSECT_NONE">INTERSECT_NONE</a>;

<b>  // First check to see if we hit an endcap</b>
  if (<a href="http://root.cern.ch/root/html/TMath.html#TMath:Abs">TMath::Abs</a>(zMom) &gt; SMALL_MOM) { // worth computing

    if (zMom &lt; -SMALL_MOM) { 
      delZ = -zCyl - iz;
      ret = <a href=".././SmearTraj.html#SmearTraj:INTERSECT_ZMINUS">INTERSECT_ZMINUS</a>;
    }
    else {
      delZ = zCyl - iz;
      ret = <a href=".././SmearTraj.html#SmearTraj:INTERSECT_ZPLUS">INTERSECT_ZPLUS</a>;
    }
    delX =  delZ * xMom / zMom;
    delY =  delZ * yMom / zMom;
    sEnd = <a href="http://root.cern.ch/root/html/TMath.html#TMath:Sqrt">TMath::Sqrt</a>(delX*delX + delY*delY + delZ*delZ);
  }
  else sEnd = SBIG;

  if (xMom*xMom + yMom*yMom &lt; SMALL_MOM*SMALL_MOM) {
    sIn = sOut = SBIG;
  } 
  else { // Compute barrel stuff
    <a href="../ListOfTypes.html#Double_t">Double_t</a> t;
    <a href="../ListOfTypes.html#Bool_t">Bool_t</a>   quadStatus;
    if (rCylIn &lt;= 0.0) {  // No inner barrel.  We have solid cylinder.
      sIn = SBIG;
    }
<b>    //    else { // if radius isn't decreasing, can't possibly go inwards</b>
<b>    //if (x0 * xMom + y0 * yMom &lt;= 0.0) sIn = SBIG;</b>
    else { 
<b>      // Find time t such that we've reached the inner barrel, that is</b>
<b>      // (x0 + t*px)**2 + (y0 + t*py)**2  = rCyl**2</b>
<b>      // Reduces to finding the positive root, if any, of the quadratic with</b>
<b>      //     A = px*px + py*py, B = 2(px*x0 + py*y0)</b>
<b>      //     C = x0*x0 + y0*y0 - rCyl*rCyl</b>
      t = <a href="#SmearTraj:QuadRoot">QuadRoot</a>(xMom * xMom + yMom * yMom,
		   2.0 * (xMom * ix + yMom * iy),
		   ix * ix + iy * iy - rCylIn*rCylIn, &amp;quadStatus);

      if ((quadStatus) &amp;&amp; (t &gt; 0.0)) { // OK
	delX = t * xMom;
	delY = t * yMom;
	delZ = t * zMom;
	sIn = <a href="http://root.cern.ch/root/html/TMath.html#TMath:Sqrt">TMath::Sqrt</a>(delX*delX + delY*delY + delZ*delZ);
      }
      else sIn = SBIG;
    }        // Done with inner barrel
<b>    // Do same for outer barrel</b>
    t = <a href="#SmearTraj:QuadRoot">QuadRoot</a>(xMom * xMom + yMom * yMom,
		 2.0 * (xMom * iy + yMom * ix),
		 ix * ix + iy * iy - rCylOut*rCylOut, &amp;quadStatus);

    if ((quadStatus) &amp;&amp; (t &gt; 0.0)) { // OK
      delX = t * xMom;
      delY = t * yMom;
      delZ = t * zMom;
      sOut = <a href="http://root.cern.ch/root/html/TMath.html#TMath:Sqrt">TMath::Sqrt</a>(delX*delX + delY*delY + delZ*delZ);
    }
    else sOut = SBIG;
  }

  ret1 = shortestPath(sEnd, sIn, sOut, &amp;s);
  if (s == SBIG) return <a href=".././SmearTraj.html#SmearTraj:INTERSECT_NONE">INTERSECT_NONE</a>;
 
  if (ret1 != <a href=".././SmearTraj.html#SmearTraj:INTERSECT_ZPLUS">INTERSECT_ZPLUS</a>) ret = ret1;

<b>  // Good status.  Fill return arguments</b>
  <a href="../ListOfTypes.html#Double_t">Double_t</a>  absMom = <a href="http://root.cern.ch/root/html/TMath.html#TMath:Sqrt">TMath::Sqrt</a>(xMom*xMom + yMom*yMom + zMom*zMom);
  delX = s * xMom / absMom;
  delY = s * yMom / absMom;
  delZ = s * zMom / absMom;

  <a href=".././SmearTraj.html#SmearTraj:newP">newP</a>[0] = ix + delX;
  <a href=".././SmearTraj.html#SmearTraj:newP">newP</a>[1]  = iy + delY;
  <a href=".././SmearTraj.html#SmearTraj:newP">newP</a>[2] = iz + delZ;

  <a href=".././SmearTraj.html#SmearTraj:deltaS">deltaS</a> = s;
  *pS = s + A_LITTLE_WAYS;

  return ret;
}

<a name="SmearTraj:pythagPlus"> </a><a href="../ListOfTypes.html#Double_t">Double_t</a> <a href=".././SmearTraj.html#SmearTraj:pythagPlus">SmearTraj::pythagPlus</a>(const <a href="../ListOfTypes.html#Double_t">Double_t</a> x, <a href="../ListOfTypes.html#Double_t">Double_t</a> y) {
<b>  // Compute sqrt(x*x + y*y) in maximally stable fashion</b>
  <a href="../ListOfTypes.html#double">double</a> t, p;

  if (<a href="http://root.cern.ch/root/html/TMath.html#TMath:Abs">TMath::Abs</a>(x) &gt; <a href="http://root.cern.ch/root/html/TMath.html#TMath:Abs">TMath::Abs</a>(y)) {
    t = y/x;
    p = x * <a href="http://root.cern.ch/root/html/TMath.html#TMath:Sqrt">TMath::Sqrt</a>(1.0 + t*t);
  }
  else {
    t = x/y;
    p = y*<a href="http://root.cern.ch/root/html/TMath.html#TMath:Sqrt">TMath::Sqrt</a>(t*t + 1.0);
  }
<b>  //  return p;</b>
  return <a href="http://root.cern.ch/root/html/TMath.html#TMath:Abs">TMath::Abs</a>(p);
}
<a name="SmearTraj:pythagMinus"> </a><a href="../ListOfTypes.html#Double_t">Double_t</a> <a href=".././SmearTraj.html#SmearTraj:pythagMinus">SmearTraj::pythagMinus</a>(const <a href="../ListOfTypes.html#Double_t">Double_t</a> x, <a href="../ListOfTypes.html#Double_t">Double_t</a> y) {
<b>  // Compute sqrt(x*x - y*y) maximally stable fashion</b>
  <a href="../ListOfTypes.html#double">double</a> t, p;

  if (<a href="http://root.cern.ch/root/html/TMath.html#TMath:Abs">TMath::Abs</a>(x) &gt; <a href="http://root.cern.ch/root/html/TMath.html#TMath:Abs">TMath::Abs</a>(y)) {
    t = y/x;
    p = x * <a href="http://root.cern.ch/root/html/TMath.html#TMath:Sqrt">TMath::Sqrt</a>(1.0 - t*t);
  }
  else {
    t = x/y;
    p = y*<a href="http://root.cern.ch/root/html/TMath.html#TMath:Sqrt">TMath::Sqrt</a>(t*t - 1.0);
  }
<b>  // return p;</b>
  return <a href="http://root.cern.ch/root/html/TMath.html#TMath:Abs">TMath::Abs</a>(p);
}
</pre>

<!--SIGNATURE-->
<br>
<address>
<hr>
<center>
<a href="http://root.cern.ch/root/Welcome.html">ROOT page</a> - <a href="../ClassIndex.html">Class index</a> - <a href="#TopOfPage">Top of the page</a><br>
</center>
<hr>This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to <a href="mailto:rootdev@root.cern.ch">ROOT support</a>, or contact <a href="mailto:rootdev@root.cern.ch">the developers</a> with any questions or problems regarding ROOT.
</address>
</body>
</html>
