View Javadoc

1   package org.lcsim.recon.tracking.trfcyl;
2   
3   import java.util.*;
4   import org.lcsim.recon.tracking.trfutil.Assert;
5   import org.lcsim.recon.tracking.trfbase.McCluster;
6   import org.lcsim.recon.tracking.trfbase.Cluster;
7   import org.lcsim.recon.tracking.trfbase.Hit;
8   import org.lcsim.recon.tracking.trfbase.ETrack;
9   import org.lcsim.recon.tracking.trfbase.Surface;
10  /**
11   * Describes a cluster which measures phi and z on a cylinder.
12   *
13   *@author Norman A. Graf
14   *@version 1.0
15   *
16   */
17  public class ClusCylPhiZ2D extends McCluster
18  {
19      
20      // static methods
21      
22      //
23      
24      /**
25       *Return a String representation of the class' type name.
26       *Included for completeness with the C++ version.
27       *
28       * @return   A String representation of the class' type name.
29       */
30      public static String typeName()
31      { return "ClusCylPhiZ2D";
32      }
33      
34      //
35      
36      /**
37       *Return a String representation of the class' type name.
38       *Included for completeness with the C++ version.
39       *
40       * @return   A String representation of the class' type name.
41       */
42      public static String staticType()
43      { return typeName();
44      }
45      
46      // attributes
47      
48      // the surface
49      private SurfCylinder _scy;
50      
51      // the phi measurement
52      private double _phi;
53      
54      // the error (standard deviation) for the phi measurement
55      private double _dphi;
56      
57      // the z measurement
58      private double _z;
59      
60      // the error (standard deviation) for the z measurement
61      private double _dz;
62      
63      // the covariance term
64      private double _dphidz;
65      
66      // methods
67      
68      //
69      
70      /**
71       * Test equality.
72       *
73       * @param   clus The Cluster to test against.
74       * @return true if the Clusters are the same.
75       */
76      public boolean equal(Cluster clus)
77      {
78          Assert.assertTrue( type().equals(clus.type()) );
79          ClusCylPhiZ2D ccpz = ( ClusCylPhiZ2D ) clus;
80          return ( _phi == ccpz._phi ) && ( _dphi == ccpz._dphi ) &&
81                  ( _z == ccpz._z ) && ( _dz == ccpz._dz ) &&
82                  ( _scy.equals(ccpz._scy) );
83      }
84      
85      //
86      
87      /**
88       *Generate the first (and only) track prediction.
89       *
90       * @param   tre The ETrack for which to generate the prediction.
91       * @return A list of hits for this Track.
92       */
93      public List predict(ETrack tre)
94      {
95          List hits = new ArrayList();
96          double phi = tre.vector().get(SurfCylinder.IPHI);
97          double dphi = tre.error().get(SurfCylinder.IPHI, SurfCylinder.IPHI);
98          double z = tre.vector().get(SurfCylinder.IZ);
99          double dz = tre.error().get(SurfCylinder.IZ,SurfCylinder.IZ);
100         double dphidz = 0.;
101         hits.add( new HitCylPhiZ2D( phi, dphi, z, dz, dphidz ) );
102         return hits;
103     }
104     
105     // methods
106     
107     //
108     
109     /**
110      *Construct an instance from the radius of the measurement, the phi measurement,
111      * the uncertainty in the phi measurement, the z measurement, the uncertainty in the z measurement,
112      * and the correlation between the phi and z measurements.
113      *
114      * @param   radius The cylindrical radius of the measurement.
115      * @param   phi    The phi value measurement.
116      * @param   dphi   The uncertainty in the phi measurement.
117      * @param   z      The z value measurement.
118      * @param   dz     The uncertainty in the z measurement.
119      * @param   dphidz The correlation between the phi and z measurements.
120      */
121     public ClusCylPhiZ2D(double radius, double phi, double dphi, double z, double dz, double dphidz)
122     {
123         _scy = new SurfCylinder(radius);
124         _phi = phi;
125         _dphi = dphi;
126         _z = z;
127         _dz = dz;
128         _dphidz = dphidz;
129         Assert.assertTrue( _dphi >= 0.0 );
130         Assert.assertTrue( _dz >= 0.0 );
131     }
132     
133     //
134     
135     /**
136      *Construct an instance from the radius of the measurement, the phi measurement,
137      * the uncertainty in the phi measurement, the z measurement, the uncertainty in the z measurement,
138      * the correlation between the phi and z measurements and the MC ID associated with this cluster.
139      *
140      * @param   radius The cylindrical radius of the measurement.
141      * @param   phi    The phi value measurement.
142      * @param   dphi   The uncertainty in the phi measurement.
143      * @param   z      The z value measurement.
144      * @param   dz     The uncertainty in the z measurement.
145      * @param   dphidz The correlation between the phi and z measurements.
146      * @param   mcid   The MC ID for the track creating this cluster.
147      */
148     public ClusCylPhiZ2D(double radius, double phi, double dphi, double z, double dz, double dphidz,
149             int mcid)
150     {
151         super(mcid);
152         _scy = new SurfCylinder(radius);
153         _phi = phi;
154         _dphi = dphi;
155         _z = z;
156         _dz = dz;
157         _dphidz = dphidz;
158         Assert.assertTrue( _dphi >= 0.0 );
159         Assert.assertTrue( _dz >= 0.0 );
160     }
161     
162     //
163     
164     /**
165      *Construct an instance from the radius of the measurement, the phi measurement,
166      * the uncertainty in the phi measurement, the z measurement, the uncertainty in the z measurement,
167      * the correlation between the phi and z measurements and a list of MC IDs contributing to this cluster.
168      *
169      * @param   radius The cylindrical radius of the measurement.
170      * @param   phi    The phi value measurement.
171      * @param   dphi   The uncertainty in the phi measurement.
172      * @param   z      The z value measurement.
173      * @param   dz     The uncertainty in the z measurement.
174      * @param   dphidz The correlation between the phi and z measurements.
175      * @param   mcids  The list of MC IDs for the tracks contributing to this cluster.
176      */
177     public ClusCylPhiZ2D(double radius, double phi, double dphi, double z, double dz, double dphidz,
178             List mcids)
179     {
180         super(mcids);
181         _scy = new SurfCylinder(radius);
182         _phi = phi;
183         _dphi = dphi;
184         _z = z;
185         _dz = dz;
186         _dphidz = dphidz;
187         Assert.assertTrue( _dphi >= 0.0 );
188         Assert.assertTrue( _dz >= 0.0 );
189     }
190     
191     //
192     
193     /**
194      *Construct an instance replicating the ClusCylPhiZ2D ( copy constructor ).
195      *
196      * @param   ccpz The Cluster to replicate.
197      */
198     public ClusCylPhiZ2D(ClusCylPhiZ2D ccpz)
199     {
200         super(ccpz);
201         _scy = new SurfCylinder(ccpz._scy);
202         _phi = ccpz._phi;
203         _dphi = ccpz._dphi;
204         _z = ccpz._z;
205         _dz = ccpz._dz;
206         _dphidz = ccpz._dphidz;
207     }
208     
209     //
210     
211     /**
212      *Return a String representation of the class' type name.
213      *Included for completeness with the C++ version.
214      *
215      * @return   A String representation of the class' type name.
216      */
217     public String type()
218     {
219         return staticType();
220     }
221     
222     //
223     
224     /**
225      *Return the surface at which this cluster is measured.
226      *
227      * @return The surface of this cluster.
228      */
229     public  Surface surface()
230     {
231         return _scy;
232     }
233     
234     //
235     
236     /**
237      *Return the phi measurement of this cluster
238      *
239      * @return The phi measurement.
240      */
241     public double phi()
242     {
243         return _phi;
244     }
245     
246     //
247     
248     /**
249      *Return the uncertainty in the phi measurement.
250      *
251      * @return The uncertainty in the phi measurement.
252      */
253     public double dPhi()
254     {
255         return _dphi;
256     }
257     
258     //
259     
260     /**
261      *Return the z measurement of this cluster
262      *
263      * @return The z measurement.
264      */
265     public double z()
266     {
267         return _z;
268     }
269     
270     // return dz
271     
272     /**
273      *Return the uncertainty in the z measurement.
274      *
275      * @return The uncertainty in the z measurement.
276      */
277     public double dZ()
278     {
279         return _dz;
280     }
281     
282     //
283     
284     /**
285      *Return the covariance between the phi and z measurements.
286      *
287      * @return The covariance between the phi and z measurements.
288      */
289     public double dPhidZ()
290     {
291         return _dphidz;
292     }
293     
294     //
295     
296     /**
297      *Return the cylindrical radius of this cluster.
298      *
299      * @return The cylindrical radius of this cluster.
300      */
301     public double radius()
302     {
303         return _scy.radius();
304     }
305     
306     // there are no more predictions.
307     
308     /**
309      *Return the next prediction. There are none for this simple hit, so return null.
310      *
311      * @return null.
312      */
313     public Hit newNextPrediction()
314     { return null;
315     }
316     
317     
318     /**
319      *output stream
320      *
321      * @return A String representation of this instance.
322      */
323     public String toString()
324     {
325         StringBuffer sb = new StringBuffer("ClusCylPhiZ2D at " + _scy
326                 + "\n phi = " + _phi + " +/- " + _dphi
327                 + "\n z   = " + _z   + " +/- " + _dz);
328         List mcids = mcIds();
329         if ( mcids.size() > 0)
330         {
331             sb.append( "\n MC ID's:");
332             for ( Iterator it=mcids.iterator(); it.hasNext(); )
333             {
334                 sb.append( " " + it.next());
335             }
336             sb.append("\n");
337         }
338         return sb.toString();
339         
340     }
341 }
342 
343