View Javadoc

1   /*
2    * TrackDirection.java
3    *
4    * Created on May 8, 2008, 10:28 AM
5    *
6    * To change this template, choose Tools | Template Manager
7    * and open the template in the editor.
8    */
9   
10  package org.lcsim.fit.helicaltrack;
11  
12  import hep.physics.matrix.Matrix;
13  import hep.physics.vec.Hep3Vector;
14  
15  /**
16   * Encapsulate the track direction and direction derivatives.
17   * @author Richard Partridge
18   */
19  public class TrackDirection {
20      private Hep3Vector _dir;
21      private Matrix _deriv;
22      
23      /**
24       * Creates a new instance of TrackDirection.
25       * @param dir track direction
26       * @param deriv derivative of the track direction wrt helix parameters
27       */
28      public TrackDirection(Hep3Vector dir, Matrix deriv) {
29          for (double d : dir.v()){
30              if (Double.isNaN(d)){
31                  throw new RuntimeException("NaN in track direction"); 
32              }
33          }
34          _dir = dir;
35          _deriv = deriv;
36      }
37      
38      /**
39       * Return the track direction.
40       * @return track direction
41       */
42      public Hep3Vector Direction() {
43          return _dir;
44      }
45      
46      /**
47       * Return the direction derivatives.  In the direction derivative matrix,
48       * the row identifies the cartesian direction coordinate and the
49       * column identifies the helix parameter.
50       * @return direction derivatives
51       */
52      public Matrix Derivatives() {
53          return _deriv;
54      }
55  }