View Javadoc

1   /**
2    * @version $Id: FastMCTrack.java,v 1.3 2012/07/26 16:46:14 grefe Exp $
3    */
4   package org.lcsim.mc.fast.tracking.fix;
5   
6   import static java.lang.Math.sqrt;
7   import hep.physics.matrix.SymmetricMatrix;
8   import hep.physics.vec.Hep3Vector;
9   
10  import java.util.ArrayList;
11  import java.util.List;
12  
13  import org.lcsim.event.LCIOParameters;
14  import org.lcsim.event.MCParticle;
15  import org.lcsim.event.Track;
16  import org.lcsim.event.TrackState;
17  import org.lcsim.event.TrackerHit;
18  import org.lcsim.event.LCIOParameters.ParameterName;
19  import org.lcsim.event.base.BaseTrackState;
20  import org.lcsim.spacegeom.CartesianPoint;
21  import org.lcsim.spacegeom.CartesianVector;
22  import org.lcsim.spacegeom.SpacePoint;
23  import org.lcsim.spacegeom.SpaceVector;
24  
25  /**
26   * @author jstrube The class to store the measurement information of the track of a charged particle in a magnetic field. This class represents the FastMC simulation. An invariant of this class is
27   *         that the "origin" is the point of closest approach to the reference point.
28   */
29  public class FastMCTrack implements Track {
30      protected LCIOParameters _parameters;
31      protected SymmetricMatrix _errorMatrix;
32      protected SpacePoint _referencePoint;
33      protected int _charge;
34      protected MCParticle _particle = null;
35      protected List<TrackState> _trackStates;
36  
37      protected FastMCTrack(SpacePoint refPoint, LCIOParameters parameters, SymmetricMatrix errorMatrix, int charge) {
38          _referencePoint = refPoint;
39          _parameters = parameters;
40          _charge = charge;
41          _errorMatrix = errorMatrix;
42          _trackStates = new ArrayList<TrackState>();
43          _trackStates.add(new BaseTrackState(parameters.getValues(), errorMatrix.asPackedArray(true), refPoint.v(), 0));
44      }
45  
46      protected FastMCTrack(SpacePoint refPoint, LCIOParameters parameters, SymmetricMatrix errorMatrix, int charge, MCParticle part) {
47          this(refPoint, parameters, errorMatrix, charge);
48          _particle = part;
49      }
50  
51      public FastMCTrack(Track t) {
52          double[] p = t.getMomentum();
53          double pt = sqrt(p[0] * p[0] + p[1] * p[1]);
54          _parameters = new LCIOParameters(t.getTrackParameters(), pt);
55          _errorMatrix = t.getErrorMatrix();
56          _referencePoint = new CartesianPoint(t.getReferencePoint());
57          _charge = t.getCharge();
58          _trackStates = new ArrayList<TrackState>();
59          _trackStates.add(new BaseTrackState(_parameters.getValues(), _errorMatrix.asPackedArray(true), _referencePoint.v(), 0));
60      }
61  
62      public boolean fitSuccess() {
63          return false;
64      }
65  
66      /*
67       * (non-Javadoc)
68       * 
69       * @see org.lcsim.contrib.JanStrube.tracking.Track#getCharge()
70       */
71      public int getCharge() {
72          return _charge;
73      }
74  
75      public double getChi2() {
76          return -1;
77      }
78  
79      public double getdEdx() {
80          return 0;
81      }
82  
83      public double getdEdxError() {
84          return 0;
85      }
86  
87      /*
88       * (non-Javadoc)
89       * 
90       * @see org.lcsim.contrib.JanStrube.tracking.Track#getErrorMatrix()
91       */
92      public SymmetricMatrix getErrorMatrix() {
93          return _errorMatrix;
94      }
95  
96      public MCParticle getMCParticle() {
97          return _particle;
98      }
99  
100     public double[] getMomentum() {
101         return momentum().v();
102     }
103 
104     public int getNDF() {
105         return 0;
106     }
107 
108     /*
109      * (non-Javadoc)
110      * 
111      * @see org.lcsim.contrib.JanStrube.tracking.Track#getParameter(org.lcsim.contrib.JanStrube.tracking.FastMCTrack.ParameterName)
112      */
113     public double getParameter(ParameterName name) {
114         return _parameters.get(name);
115     }
116 
117     /*
118      * (non-Javadoc)
119      * 
120      * @see org.lcsim.contrib.JanStrube.tracking.Track#getParameters()
121      */
122     public LCIOParameters getParameters() {
123         return _parameters;
124     }
125 
126     /*
127      * (non-Javadoc)
128      * 
129      * @see org.lcsim.contrib.JanStrube.tracking.Track#getPt()
130      */
131     public double getPt() {
132         return _parameters.getPt();
133     }
134 
135     public double getPX() {
136         return momentum().x();
137     }
138 
139     public double getPY() {
140         return momentum().y();
141     }
142 
143     public double getPZ() {
144         return momentum().z();
145     }
146 
147     public double getRadiusOfInnermostHit() {
148         return -1;
149     }
150 
151     public double[] getReferencePoint() {
152         return _referencePoint.v();
153     }
154 
155     public double getReferencePointX() {
156         return referencePoint().x();
157     }
158 
159     public double getReferencePointY() {
160         return referencePoint().y();
161     }
162 
163     public double getReferencePointZ() {
164         return referencePoint().z();
165     }
166 
167     public int[] getSubdetectorHitNumbers() {
168         return null;
169     }
170 
171     public List<TrackerHit> getTrackerHits() {
172         return null;
173     }
174 
175     public double getTrackParameter(int i) {
176         return _parameters.getValues()[i];
177     }
178 
179     public double[] getTrackParameters() {
180         return _parameters.getValues();
181     }
182 
183     public List<Track> getTracks() {
184         return null;
185     }
186 
187     public int getType() {
188         return 0;
189     }
190 
191     public boolean isReferencePointPCA() {
192         return true;
193     }
194 
195     public Hep3Vector momentum() {
196         return new CartesianVector(LCIOParameters.Parameters2Momentum(_parameters).v());
197     }
198 
199     public SpacePoint position() {
200         return LCIOParameters.Parameters2Position(_parameters, _referencePoint);
201     }
202 
203     /*
204      * (non-Javadoc)
205      * 
206      * @see org.lcsim.contrib.JanStrube.tracking.Track#getReferencePoint()
207      */
208     public SpacePoint referencePoint() {
209         return _referencePoint;
210     }
211 
212     public List<TrackState> getTrackStates() {
213         return _trackStates;
214     }
215 }