View Javadoc

1   /*
2    * HelicalTrack3DHit.java
3    *
4    * Created on November 13, 2007, 12:39 PM
5    *
6    */
7   
8   package org.lcsim.fit.helicaltrack;
9   
10  import hep.physics.vec.Hep3Vector;
11  import hep.physics.matrix.SymmetricMatrix;
12  import hep.physics.vec.BasicHep3Vector;
13  
14  import java.util.List;
15  
16  import org.lcsim.geometry.subdetector.BarrelEndcapFlag;
17  
18  /**
19   * Encapsulate 3D hit info needed by HelicalTrackFitter.  Pixel hits should be
20   * instantiated using this class.  The BarrelEndcapFlag determines whether the
21   * the measurement coordinates are taken to be r*phi and z (barrel) or r*phi
22   * and r (endcap disk).
23   * @author Richard Partridge
24   * @version 1.0
25   */
26  public class HelicalTrack3DHit extends HelicalTrackHit {
27      private double _dz;
28      private static int _type = 1;
29      
30      public HelicalTrack3DHit(Hep3Vector pos, SymmetricMatrix cov, double dEdx, double time,
31              List rawhits, String detname, int layer, BarrelEndcapFlag beflag) {
32          super(pos, cov, dEdx, time, _type, rawhits, detname, layer, beflag);
33          _dz = Math.sqrt(cov.e(2, 2));
34          if (! (_dz>_eps)) //_eps inherited from HelicalTrackHit
35              _dz = _eps; 
36      }
37      
38      /**
39       * Create a HelicalTrack3DHit from a TrackerHit.
40       * @param hit TrackerHit associated with this hit
41       * @param beflag BarrelEndcapFlag for this hit
42       */
43  //    public HelicalTrack3DHit(TrackerHit hit, BarrelEndcapFlag beflag) {
44  //        super(hit);
45  //        super.setBarrelEndcapFlag(beflag);
46  //        _dz = Math.sqrt(hit.getCovMatrix()[5]);
47  //    }
48      
49      /**
50       * Create a HelicalTrack3DHit from a TrackerHit overriding the hit position
51       * and covariance matrix in the TrackerHit.
52       * @param hit TrackerHit associated with this hit
53       * @param pos hit position
54       * @param cov covariance matrix
55       * @param beflag BarrelEndcapFlag for this hit
56       */
57  //    public HelicalTrack3DHit(TrackerHit hit, Hep3Vector pos, SymmetricMatrix cov, BarrelEndcapFlag beflag) {
58  //        super(hit, pos, cov);
59  //        super.setBarrelEndcapFlag(beflag);
60  //        _dz = Math.sqrt(cov.e(2,2));
61  //    }
62      
63      /**
64       * Create a HelicalTrack3DHit from scratch without reference to an existing
65       * TrackerHit.  The BarrelEndcapFlag defaults to barrel, but can be set to
66       * an endcap disk using the parent method setBarrelEndcapFlag.
67       * @param x x coordinate
68       * @param y y coordinate
69       * @param z z coordinate
70       * @param drphi uncertainty in the r*phi coordinate
71       * @param dz uncertainty in the z coordinate
72       */
73      @Deprecated
74      public HelicalTrack3DHit(double x, double y, double z, double drphi, double dz){
75          this(new BasicHep3Vector(x, y, z), HitUtils.PixelCov(x, y, drphi, dz), 0., 0., null,
76                  "Unknown", 0 , BarrelEndcapFlag.BARREL);
77          _dz = dz;
78      }
79      
80      /**
81       * Return the uncertainty in the z coordinate.
82       * @return uncertainty in the z coordinate
83       */
84      public double dz() {
85          if (super.BarrelEndcapFlag() == BarrelEndcapFlag.BARREL) return _dz;
86          else throw new RuntimeException("z coordinate uncertainty undefined for a disk hit");
87      }
88  }
89