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  /**
12   * Describes a cluster which measures phiz on a cylinder, where
13   * phiz = phi + stereo*z.
14   *
15   *@author Norman A. Graf
16   *@version 1.0
17   *
18   */
19  public class ClusCylPhiZ extends McCluster
20  {
21      
22      // static methods
23      
24      //
25      
26      /**
27       *Return a String representation of the class' type name.
28       *Included for completeness with the C++ version.
29       *
30       * @return   A String representation of the class' type name.
31       */
32      public static String typeName()
33      { return "ClusCylPhiZ";
34      }
35      
36      //
37      
38      /**
39       *Return a String representation of the class' type name.
40       *Included for completeness with the C++ version.
41       *
42       * @return   A String representation of the class' type name.
43       */
44      public static String staticType()
45      { return typeName();
46      }
47      
48      // attributes
49      
50      // the surface
51      private SurfCylinder _scy;
52      
53      // the phi-z mixing
54      private double _stereo;
55      
56      // the measurement
57      private double _phi;
58      
59      // the error (standard deviation) for the measurement
60      private double _dphi;
61      
62      // methods
63      
64      //
65      
66      /**
67       * Test equality.
68       *
69       * @param   clus The Cluster to test against.
70       * @return true if the Clusters are the same.
71       */
72      public boolean equal(Cluster clus)
73      {
74          Assert.assertTrue( type().equals(clus.type()) );
75          ClusCylPhiZ ccpz = ( ClusCylPhiZ ) clus;
76          return ( _phi == ccpz._phi ) && ( _dphi == ccpz._dphi ) &&
77                  ( _stereo == ccpz._stereo ) && ( _scy.equals(ccpz._scy) );
78          
79      }
80      
81      //
82      
83      /**
84       *Generate the first (and only) track prediction.
85       *
86       * @param   tre The ETrack for which to generate the prediction.
87       * @return A list of hits for this Track.
88       */
89      public List predict(ETrack tre)
90      {
91          
92          List hits = new ArrayList();
93          double phiz = tre.vector().get(0) + _stereo*tre.vector().get(1);
94          double epp = tre.error().get(0,0) + 2.0*_stereo*tre.error().get(0,1) +
95                  _stereo*_stereo*tre.error().get(1,1);
96          hits.add( new HitCylPhiZ( phiz, epp ) );
97          return hits;
98      }
99      
100     // methods
101     
102     //
103     
104     /**
105      *Construct an instance from the radius of the measurement, the phi measurement,
106      * the uncertainty in the phi measurement and the stereo angle (dphi/dz).
107      *
108      * @param   radius The cylindrical radius of the measurement.
109      * @param   phi    The phi value measurement.
110      * @param   dphi   The uncertainty in the phi measurement.
111      * @param   stereo The stereo angle (dphi/dz) for the measurement.
112      */
113     public ClusCylPhiZ(double radius, double phi, double dphi, double stereo)
114     {
115         _scy = new SurfCylinder(radius);
116         _phi = phi;
117         _dphi = dphi;
118         _stereo = stereo;
119         Assert.assertTrue( _dphi >= 0.0 );
120     }
121     
122     //
123     
124     /**
125      *Construct an instance from the radius of the measurement, the phi measurement,
126      * the uncertainty in the phi measurement, the stereo angle (dphi/dz)
127      *and the MC ID associated with this cluster.
128      *
129      * @param   radius The cylindrical radius of the measurement.
130      * @param   phi    The phi value measurement.
131      * @param   dphi   The uncertainty in the phi measurement.
132      * @param   stereo The stereo angle (dphi/dz) for the measurement.
133      * @param   mcid   The MC ID for the track creating this cluster.
134      */
135     public ClusCylPhiZ(double radius, double phi, double dphi, double stereo, int mcid)
136     {
137         super(mcid);
138         _scy = new SurfCylinder(radius);
139         _phi = phi;
140         _dphi = dphi;
141         _stereo = stereo;
142         Assert.assertTrue( _dphi >= 0.0 );
143     }
144     
145     //
146     
147     /**
148      *Construct an instance from the radius of the measurement, the phi measurement,
149      * the uncertainty in the phi measurement, the stereo angle (dphi/dz)
150      *and a list of MC IDs contributing to this cluster.
151      *
152      * @param   radius The cylindrical radius of the measurement.
153      * @param   phi    The phi value measurement.
154      * @param   dphi   The uncertainty in the phi measurement.
155      * @param   stereo The stereo angle (dphi/dz) for the measurement.
156      * @param   mcids  The list of MC IDs for the tracks contributing to this cluster.
157      */
158     public ClusCylPhiZ(double radius, double phi, double dphi, double stereo,
159             List mcids)
160     {
161         super(mcids);
162         _scy = new SurfCylinder(radius);
163         _phi = phi;
164         _dphi = dphi;
165         _stereo = stereo;
166         Assert.assertTrue( _dphi >= 0.0 );
167     }
168     
169     //
170     
171     /**
172      *Construct an instance replicating the ClusCylPhiZ ( copy constructor ).
173      *
174      * @param   ccpz The Cluster to replicate.
175      */
176     public ClusCylPhiZ(ClusCylPhiZ ccpz)
177     {
178         super(ccpz);
179         _scy = new SurfCylinder(ccpz._scy);
180         _phi = ccpz._phi;
181         _dphi = ccpz._dphi;
182         _stereo = ccpz._stereo;
183     }
184     
185     //
186     
187     /**
188      *Return a String representation of the class' type name.
189      *Included for completeness with the C++ version.
190      *
191      * @return   A String representation of the class' type name.
192      */
193     public String type()
194     { return staticType();
195     }
196     
197     //
198     
199     /**
200      *Return the surface at which this cluster is measured.
201      *
202      * @return The surface of this cluster.
203      */
204     public  Surface surface()
205     { return _scy;
206     }
207     
208     //
209     
210     /**
211      *Return the stereo pitch of the measurement (dphi/dz).
212      *
213      * @return The stereo angle dphi/dz.
214      */
215     public double stereo()
216     { return _stereo;
217     }
218     
219     //
220     
221     /**
222      *Return the phiz measurement of this cluster
223      *
224      * @return The phiz measurement (phi + stereo*z).
225      */
226     public double phiZ()
227     { return _phi;
228     }
229     
230     //
231     
232     /**
233      *Return the uncertainty of the phiz measurement of this cluster
234      *
235      * @return The uncertainty in the phiz measurement d(phi + stereo*z).
236      */
237     public double dPhiZ()
238     { return _dphi;
239     }
240     
241     //
242     
243     /**
244      *Return the cylindrical radius of this cluster.
245      *
246      * @return The cylindrical radius of this cluster.
247      */
248     public double radius()
249     { return _scy.radius();
250     }
251     
252     //
253     
254     /**
255      *Return the next prediction. There are none for this simple hit, so return null.
256      *
257      * @return null.
258      */
259     public Hit newNextPrediction()
260     { return null;
261     }
262     
263     
264     /**
265      *output stream
266      *
267      * @return A String representation of this instance.
268      */
269     public String toString()
270     {
271         StringBuffer sb = new StringBuffer("Hit at " + _scy + " with mixing " + _stereo
272                 + ": phiz = " + _phi + " +/- " + _dphi);
273         List mcids = mcIds();
274         if ( mcids.size() > 0)
275         {
276             sb.append( "\n MC ID's:");
277             for ( Iterator it=mcids.iterator(); it.hasNext(); )
278             {
279                 sb.append( " " + it.next());
280             }
281             sb.append("\n");
282         }
283         return sb.toString();
284         
285     }
286 }
287