<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
Hi Craig,<br>
<br>
    I just spoke with Simon and realized there was some confusion on
how DReferenceTrajectory::DistToRT() works. It is set up to assume that
the DCoordinateSystem object represents a wire and will find the point
of closest approach (POCA) to that wire. This works OK for a plane when
the track is more or less perpendicular to the plane, but will be less
accurate as the angle to the plane increases.<br>
<br>
    This needs to be fixed in the DReferenceTrajectory class and will
be soon. There is another solution though that currently exists in the
repository which uses DMagneticFieldStepper. Below is a snippet of code
to give you the idea of what needs to be done assuming you have the
JEventLoop and DTrack object pointers.<br>
<br>
<tt>// We must get a pointer to the magnetic field object so do a small
backflip to get it using DApplication<br>
DApplication* dapp =
dynamic_cast<DApplication*>(loop->GetJApplication());<br>
<br>
// Create a DMagenticFieldStepper object<br>
DMagneticFieldStepper stepper(dapp->GetBfield(), track->charge());<br>
<br>
// Swim to a plane defined by "origin" and "norm". "origin" is any
point in the plane.<br>
double pathlen;  // Holds pathlength from starting point to
intersection with plane<br>
DVector3 pos = track->position();  // Holds starting position on
entry and intersection point on output<br>
DVector3 mom = track->momentum();  // Holds starting momentum on
entry and intersection point on output<br>
stepper.SwimToPlane(pos, mom, origin, norm, &pathlen);</tt><br>
<br>
The DMagneticFieldStepper class also has a SwimToRadius method that can
be used to find the intersection point with a cylinder centered on the
beamline.<br>
<br>
I hope this helps.<br>
<br>
-David<br>
<br>
<br>
Simon Taylor wrote:
<blockquote cite="mid:4AF02B96.4090509@jlab.org" type="cite">
  <pre wrap="">Hi, Craig.

You can get the position of the closest approach to the beam line of the 
track using the position() method; e.g. track->position();

You can track to any plane using one of the methods of the 
DReferenceTrajectory class ( a DReferenceTrajectory object is attached 
to the wire-based track).  Here's a code snippet:

 DReferenceTrajectory *rt=const_cast<DReferenceTrajectory *>(track->rt);
 DCoordinateSystem st_plane;  // plane parameters
  double s; // path length
 double doca=rt->DistToRT(&st_plane,&s);     // Distance of closest 
approach between plane     // and track

Simon

Craig Bookwalter wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Hi folks,
    I'm looking for a couple methods to help me determine the event 
start time, namely:
    - a method for getting the vertex position of a hit-based track in 
the CDC or FDC
    - a method for getting the path length along a hit-based track from, 
say, the start counter to the target (this would require some 
association between start counter hits and CDC/FDC tracks, which I'm not 
sure is happening yet)

    I've looked through the DOxygen docs and haven't seen anything that 
stuck out to me, but I certainly could have missed something. If these 
guys do not yet exist I would be happy to help implement them.

    Thanks in advance!

--cb
   

   

  
    </pre>
  </blockquote>
  <pre wrap=""><!---->
_______________________________________________
Halld-offline mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Halld-offline@jlab.org">Halld-offline@jlab.org</a>
<a class="moz-txt-link-freetext" href="https://mailman.jlab.org/mailman/listinfo/halld-offline">https://mailman.jlab.org/mailman/listinfo/halld-offline</a>
  </pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 

------------------------------------------------------------------------
 David Lawrence Ph.D.
 Staff Scientist                 Office: (757)269-5567   [[[  [   [ [       
 Jefferson Lab                   Pager:  (757)584-5567   [  [ [ [ [ [   
 <a class="moz-txt-link-freetext" href="http://www.jlab.org/~davidl">http://www.jlab.org/~davidl</a>     <a class="moz-txt-link-abbreviated" href="mailto:davidl@jlab.org">davidl@jlab.org</a>         [[[  [[ [[ [[[
------------------------------------------------------------------------

</pre>
</body>
</html>