View Javadoc

1   /*
2    * SiTrackerHitStrip1D.java
3    *
4    * Created on December 12, 2007, 10:56 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.recon.tracking.digitization.sisim;
11  
12  import hep.physics.matrix.SymmetricMatrix;
13  import hep.physics.vec.Hep3Vector;
14  import hep.physics.vec.VecOp;
15  import java.util.List;
16  import org.lcsim.detector.ITransform3D;
17  import org.lcsim.detector.Transform3D;
18  import org.lcsim.detector.solids.LineSegment3D;
19  import org.lcsim.detector.solids.Point3D;
20  import org.lcsim.detector.tracker.silicon.SiStrips;
21  import org.lcsim.event.RawTrackerHit;
22  import org.lcsim.event.TrackerHit;
23  
24  /**
25   *
26   * @author tknelson
27   */
28  public class SiTrackerHitStrip1D extends SiTrackerHit
29  {
30      private Hep3Vector _measured_coordinate;
31      private Hep3Vector _unmeasured_coordinate;
32      
33      private LineSegment3D _hit_segment;
34      
35      /**
36       * Creates a new instance of SiTrackerHitStrip1D
37       */
38      public SiTrackerHitStrip1D(Hep3Vector position_vector, SymmetricMatrix covariance_matrix, double energy, double time, List<RawTrackerHit> raw_hits, TrackerHitType decoded_type)
39      {
40          super(position_vector, covariance_matrix, energy, time, raw_hits, decoded_type);
41      }
42      
43      public SiTrackerHitStrip1D(TrackerHit hit)
44      {
45          super(hit);
46      }
47      
48      public SiTrackerHitStrip1D(TrackerHit hit, TrackerHitType.CoordinateSystem coordinate_system)
49      {
50          super(hit,coordinate_system);
51      }
52      
53      public SiTrackerHitStrip1D getTransformedHit(TrackerHitType.CoordinateSystem coordinate_system)
54      {
55          return new SiTrackerHitStrip1D(super.getTransformedHit(coordinate_system));
56      }
57      
58      public SiTrackerHitStrip1D getTransformedHit(ITransform3D global_to_local)
59      {
60          return new SiTrackerHitStrip1D(super.getTransformedHit(global_to_local));
61      }
62      
63      // Access information specific to 1D strip hits
64      public double getHitLength()
65      {
66          double hit_length = 0;
67          for (RawTrackerHit raw_hit : getRawHits())
68          {
69              hit_length = Math.max( hit_length,
70                      ((SiStrips)getReadoutElectrodes()).
71                      getStripLength(getIdentifierHelper().getElectrodeValue(raw_hit.getIdentifier())) );
72              
73  //            System.out.println("Strip length: "+((SiStrips)getReadoutElectrodes()).
74  //                    getStripLength(getIdentifierHelper().getElectrodeValue(raw_hit.getIdentifier())));
75          }
76  //        System.out.println("    Hit length: "+hit_length);
77          
78          return hit_length;
79      }
80      
81      public LineSegment3D getHitSegment()
82      {
83          if (_hit_segment == null)
84          {
85              Hep3Vector direction = getUnmeasuredCoordinate();
86              double length = getHitLength();
87              Point3D startpoint = new Point3D(VecOp.add(getPositionAsVector(),VecOp.mult(-length/2,direction)));
88              _hit_segment = new LineSegment3D(startpoint,direction,length);
89          }
90          return _hit_segment;
91      }
92      
93      public Hep3Vector getMeasuredCoordinate()
94      {
95          if (_measured_coordinate == null)
96          {
97              ITransform3D electrodes_to_global = getReadoutElectrodes().getLocalToGlobal();
98              ITransform3D global_to_hit = getLocalToGlobal().inverse();
99              ITransform3D electrodes_to_hit = Transform3D.multiply(global_to_hit,electrodes_to_global);
100             
101             _measured_coordinate = electrodes_to_hit.rotated(getReadoutElectrodes().getMeasuredCoordinate(0));
102         }
103         return _measured_coordinate;
104     }
105     
106     public Hep3Vector getUnmeasuredCoordinate()
107     {
108         if (_unmeasured_coordinate == null)
109         {
110             ITransform3D electrodes_to_global = getReadoutElectrodes().getLocalToGlobal();
111             ITransform3D global_to_hit = getLocalToGlobal().inverse();
112             ITransform3D electrodes_to_hit = Transform3D.multiply(global_to_hit,electrodes_to_global);
113             
114             _unmeasured_coordinate = electrodes_to_hit.rotated(getReadoutElectrodes().getUnmeasuredCoordinate(0));
115         }
116         return _unmeasured_coordinate;
117     }
118     
119 }