View Javadoc

1   package  org.lcsim.recon.tracking.trfzp;
2   
3   import java.util.List;
4   import java.util.ArrayList;
5   
6   import org.lcsim.recon.tracking.trfutil.Assert;
7   
8   import org.lcsim.recon.tracking.trfbase.McCluster;
9   import org.lcsim.recon.tracking.trfbase.ETrack;
10  import org.lcsim.recon.tracking.trfbase.Cluster;
11  import org.lcsim.recon.tracking.trfbase.Surface;
12  import org.lcsim.recon.tracking.trfbase.Hit;
13  
14  /**
15   * Describes a cluster which measures x-y on a ZPlane.
16   * axy = wx*x + wy*y
17   *
18   *
19   *@author Norman A. Graf
20   *@version 1.0
21   *
22   */
23  
24  //**********************************************************************
25  
26  public class ClusZPlane1 extends McCluster
27  {
28      
29      // static methods
30      
31      //
32      
33      /**
34       *Return a String representation of the class' type name.
35       *Included for completeness with the C++ version.
36       *
37       * @return   A String representation of the class' type name.
38       */
39      public static String typeName()
40      { return "ClusZPlane1"; }
41      
42      
43      //
44      
45      /**
46       *Return a String representation of the class' type name.
47       *Included for completeness with the C++ version.
48       *
49       * @return   A String representation of the class' type name.
50       */
51      public static String staticType()
52      { return typeName(); }
53      
54      // attributes
55      
56      // the surface
57      private SurfZPlane _szp;
58      
59      // the x axis weight
60      private double _wx;
61      
62      // the y axis weight
63      private double _wy;
64      
65      // measurement
66      private double _axy;
67      
68      // the error (standard deviation) for the measurement
69      private double _daxy;
70      
71      // methods
72      
73      //
74      
75      /**
76       * Test equality.
77       *
78       * @param   clus The Cluster to test against.
79       * @return true if the Clusters are the same.
80       */
81      public boolean equal( Cluster clus)
82      {
83          Assert.assertTrue(  type().equals(clus.type()) );
84          ClusZPlane1 ccp = (ClusZPlane1) clus;
85          return ( _wx == ccp._wx )
86          && ( _wy == ccp._wy )
87          && ( _axy == ccp._axy )
88          && ( _daxy == ccp._daxy )
89          && ( _szp.equals(ccp._szp) );
90      }
91      
92      //
93      
94      /**
95       *Generate the first (and only) track prediction.
96       *
97       * @param   tre The ETrack for which to generate the prediction.
98       * @return A list of hits for this Track.
99       */
100     public  List predict( ETrack tre)
101     {
102         List hits =  new ArrayList();
103         double x_track = tre.vector().get(SurfZPlane.IX);
104         double y_track = tre.vector().get(SurfZPlane.IY);
105         double exx_track = tre.error().get(SurfZPlane.IX,SurfZPlane.IX);
106         double exy_track = tre.error().get(SurfZPlane.IX,SurfZPlane.IY);
107         double eyy_track = tre.error().get(SurfZPlane.IY,SurfZPlane.IY);
108         
109         double axy  = _wx*x_track + _wy*y_track;
110         double eaxy = exx_track*_wx*_wx + 2.*exy_track*_wx*_wy + eyy_track*_wy*_wy;
111         
112         hits.add( new HitZPlane1( axy, eaxy ) );
113         return hits;
114     }
115     
116     // methods
117     
118     //
119     
120     /**
121      *Construct an instance from the z plane position, mixing and
122      * measurement uncertainty as a gaussian sigma.
123      *
124      * @param   zpos  The z position of the plane.
125      * @param   wx  The stereo angle in the x direction.
126      * @param   wy  The stereo angle in the y direction.
127      * @param   axy The mixing between a and y.
128      * @param   daxy  The gaussian sigma for the xy measurement uncertainty.
129      */
130     public ClusZPlane1(double zpos, double wx, double wy, double axy,double daxy)
131     {
132         _szp = new SurfZPlane(zpos);
133         _wx = wx;
134         _wy = wy;
135         _axy = axy;
136         _daxy = daxy;
137         Assert.assertTrue( _daxy >= 0.0 );
138     }
139     
140     //
141     
142     /**
143      *Construct an instance from the z plane position, mixing,
144      * the measurement uncertainty as a gaussian sigma and the MC ID associated with this cluster.
145      *
146      * @param   zpos  The z position of the plane.
147      * @param   wx  The stereo angle in the x direction.
148      * @param   wy  The stereo angle in the y direction.
149      * @param   axy The mixing between a and y.
150      * @param   daxy  The gaussian sigma for the xy measurement uncertainty.
151      * @param   mcid   The MC ID for the track creating this cluster.
152      */
153     public ClusZPlane1(double zpos, double wx, double wy, double axy,double daxy, int mcid )
154     {
155         super(mcid);
156         _szp = new SurfZPlane(zpos);
157         _wx = wx;
158         _wy = wy;
159         _axy = axy;
160         _daxy = daxy;
161         Assert.assertTrue( _daxy >= 0.0 );
162     }
163     
164     //
165     
166     /**
167      *Construct an instance from the z plane position, mixing,
168      * the measurement uncertainty as a gaussian sigma and a list
169      * of MC IDs contributing to this cluster.
170      *
171      * @param   zpos  The z position of the plane.
172      * @param   wx  The stereo angle in the x direction.
173      * @param   wy  The stereo angle in the y direction.
174      * @param   axy The mixing between a and y.
175      * @param   daxy  The gaussian sigma for the xy measurement uncertainty.
176      * @param   mcids   The list of MC IDs for the tracks contributing to this cluster.
177      */
178     public ClusZPlane1(double zpos, double wx, double wy, double axy,double daxy, List mcids )
179     {
180         super(mcids);
181         _szp = new SurfZPlane(zpos);
182         _wx = wx;
183         _wy = wy;
184         _axy = axy;
185         _daxy = daxy;
186         Assert.assertTrue( _daxy >= 0.0 );
187     }
188     
189     //
190     
191     /**
192      *Construct an instance replicating the ClusZPlane1 ( copy constructor ).
193      *
194      * @param   clus The Cluster to replicate.
195      */
196     public ClusZPlane1( ClusZPlane1 clus)
197     {
198         super(clus);
199         _szp = new SurfZPlane(clus._szp);
200         _wx = clus._wx;
201         _wy = clus._wy;
202         _axy = clus._axy;
203         _daxy = clus._daxy;
204     }
205     
206     //
207     
208     /**
209      *Return a String representation of the class' type name.
210      *Included for completeness with the C++ version.
211      *
212      * @return   A String representation of the class' type name.
213      */
214     public String type()
215     { return staticType();  }
216     
217     
218     //
219     
220     /**
221      *Return the surface at which this cluster is measured.
222      *
223      * @return The surface of this cluster.
224      */
225     public Surface surface()
226     { return _szp; }
227     
228     //
229     
230     /**
231      *Return the wx pitch.
232      *
233      * @return The wx pitch.
234      */
235     public double wX()
236     { return _wx; }
237     
238     //
239     
240     /**
241      *Return the wy pitch.
242      *
243      * @return The wy pitch.
244      */
245     public double wY()
246     { return _wy; }
247     
248     //
249     
250     /**
251      *Return the mixing in x and y axy.
252      *
253      * @return The mixing in x and y.
254      */
255     public double aXY()
256     { return _axy; }
257     
258     //
259     
260     /**
261      *Return the uncertainty in the xy measurement.
262      *
263      * @return The uncertainty in the xy measurement.
264      */
265     public double daXY()
266     { return _daxy; }
267     
268     //
269     
270     /**
271      *There are no more predictions.
272      *
273      * @return null
274      */
275     public Hit newNextPrediction()
276     { return null; }
277     
278     
279     /**
280      *output stream
281      *
282      * @return A String representation of this instance.
283      */
284     public String toString()
285     {
286         return "axy " + _szp + " and x weight " + _wx
287                 + " and y weight " + _wy
288                 + ": axy = " + _axy + " +/- " + _daxy;
289     }
290     
291     
292 }