View Javadoc

1   package org.lcsim.recon.tracking.vsegment.geom;
2   
3   import hep.physics.vec.Hep3Vector;
4   import hep.physics.vec.VecOp;
5   import hep.physics.matrix.SymmetricMatrix;
6   import org.lcsim.detector.IDetectorElement;
7   
8   import org.lcsim.recon.tracking.vsegment.transform.Rotation3D;
9   import org.lcsim.recon.tracking.vsegment.transform.Transformation3D;
10  
11  /**
12   * Representation of a silicon sensor that can be further divided 
13   * into strips or pixels. Each sensor has a local reference frame associated with it, 
14   * and knows how to transform coordinates between local and global frames. 
15   *
16   * @author D.Onoprienko
17   * @version $Id: Sensor.java,v 1.1 2008/12/06 21:53:43 onoprien Exp $
18   */
19  public class Sensor {
20    
21  // -- Constructors :  ----------------------------------------------------------
22    
23    public Sensor(IDetectorElement de, int id, SensorType type, Hep3Vector translation, Transformation3D rotation) {
24      _de = de;
25      _id = id;
26      _type = type;
27      _translation = translation;
28      _rotation = rotation;
29    }
30    
31  // -- Getters :  ---------------------------------------------------------------
32    
33    /**
34     * Returns {@link IDetectorElement} object this sensor belongs to.
35     */
36    public IDetectorElement getDetectorElement() {return _de;}
37    
38    /**
39     * Returns {@link SensorType} object representing the geometry of this sensor.
40     */
41    public SensorType getType() {return _type;}
42    
43    /**
44     * Returns a unique integer ID associated with this sensor.
45     */
46    public int getID() {return _id;}
47    
48    /** 
49     * Returns vector in global frame pointing from global to local reference frame origin.
50     */
51    public Hep3Vector getTranslation() {return _translation;}
52    
53    /**
54     * Returns transformation from translated global to local reference frame.
55     */
56    public Transformation3D getRotation() {return _rotation;}
57    
58    /** 
59     * Converts vector coordinates from local to global reference frame. 
60     */
61    public Hep3Vector localToGlobal(Hep3Vector point) {
62      return VecOp.add(_translation, _rotation.transformFrom(point));
63    }
64    
65    /**
66     * Converts vector coordinates from global to local reference frame.
67     */
68    public Hep3Vector globalToLocal(Hep3Vector point) {
69      return _rotation.transformTo(VecOp.sub(point, _translation));
70    }
71    
72    /** 
73     * Converts covariance matrix from local to global reference frame. 
74     * Throws <tt>RuntimeException</tt> if transformed covariance matrix cannot be
75     * computed based on the original covariance matrix alone.
76     */
77    public SymmetricMatrix localToGlobal(SymmetricMatrix covMatrix) {
78      return _rotation.transformFrom(covMatrix);
79    }
80    
81    /**
82     * Converts covariance matrix from global to local reference frame.
83     * Throws <tt>RuntimeException</tt> if transformed covariance matrix cannot be
84     * computed based on the original covariance matrix alone.
85     */
86    public SymmetricMatrix globalToLocal(SymmetricMatrix covMatrix) {
87      return _rotation.transformTo(covMatrix);
88    }
89    
90    /** 
91     * Converts covariance matrix from local to global reference frame. 
92     */
93    public SymmetricMatrix localToGlobal(SymmetricMatrix covMatrix, Hep3Vector position) {
94      return _rotation.transformFrom(covMatrix, position);
95    }
96    
97    /**
98     * Converts covariance matrix from global to local reference frame.
99     */
100   public SymmetricMatrix globalToLocal(SymmetricMatrix covMatrix, Hep3Vector position) {
101     return _rotation.transformTo(covMatrix, position);
102   }
103 
104 // -- Private parts :  ---------------------------------------------------------
105 
106   private IDetectorElement _de;
107   private SensorType _type;
108   private int _id;
109   private Hep3Vector _translation;
110   private Transformation3D _rotation;
111 
112 }