View Javadoc

1   package org.lcsim.recon.tracking.trfxyp;
2   
3   
4   import java.util.List;
5   import java.util.ArrayList;
6   
7   import org.lcsim.recon.tracking.trfutil.Assert;
8   
9   import org.lcsim.recon.tracking.trfbase.McCluster;
10  import org.lcsim.recon.tracking.trfbase.ETrack;
11  import org.lcsim.recon.tracking.trfbase.Cluster;
12  import org.lcsim.recon.tracking.trfbase.Surface;
13  import org.lcsim.recon.tracking.trfbase.Hit;
14  
15  /**Describes a v-z measurement on a XYPlane.
16   * avz = wv*v + wz*z
17   * <p>
18   * This is a very simple hit.  It produces one prediction with fixed
19   * measurement which is simply the avz of the track.
20   *
21   *@author Norman A. Graf
22   *@version 1.0
23   */
24  public class ClusXYPlane1 extends McCluster
25  {
26      
27      // static methods
28      
29      // Return the type name.
30      public static String typeName()
31      { return "ClusXYPlane1"; }
32      
33      // Return the type.
34      public static String staticType()
35      { return typeName(); }
36      
37      // attributes
38      
39      // the surface
40      private SurfXYPlane _sxyp;
41      
42      // the v axis weight
43      private double _wv;
44      
45      // the z axis weight
46      private double _wz;
47      
48      // measurement
49      private double _avz;
50      
51      // the error (standard deviation) for the measurement
52      private double _davz;
53      
54      // methods
55      
56      // equality
57      public boolean equal(Cluster clus)
58      {
59          Assert.assertTrue( type().equals(clus.type()) );
60          ClusXYPlane1 ccp = (  ClusXYPlane1 ) clus;
61          return    ( _wv == ccp._wv )
62          && ( _wz == ccp._wz )
63          && ( _avz == ccp._avz )
64          && ( _davz == ccp._davz )
65          && ( _sxyp.equals(ccp._sxyp) );
66      }
67      
68      // generate first (and only) track prediction
69      public List predict( ETrack tre)
70      {
71          List hits =  new ArrayList();
72          double v_track = tre.vector().get(SurfXYPlane.IV);
73          double z_track = tre.vector().get(SurfXYPlane.IZ);
74          double evv_track = tre.error().get(SurfXYPlane.IV,SurfXYPlane.IV);
75          double evz_track = tre.error().get(SurfXYPlane.IV,SurfXYPlane.IZ);
76          double ezz_track = tre.error().get(SurfXYPlane.IZ,SurfXYPlane.IZ);
77          
78          double avz  = _wv*v_track + _wz*z_track;
79          double eavz = evv_track*_wv*_wv + 2.*evz_track*_wv*_wz + ezz_track*_wz*_wz;
80          
81          hits.add(  new HitXYPlane1( avz, eavz ) );
82          return hits;
83      }
84      
85      // methods
86      
87      // constructor
88      public ClusXYPlane1(double dist, double phi,
89              double wv, double wz, double avz,double davz)
90      {
91          _sxyp = new SurfXYPlane(dist,phi);
92          _wv = wv;
93          _wz = wz;
94          _avz = avz;
95          _davz = davz;
96          Assert.assertTrue( _davz >= 0.0 );
97      }
98      
99      // constructor from a single id
100     public ClusXYPlane1(double dist, double phi,
101             double wv, double wz, double avz,double davz,  int mcid)
102     {
103         super(mcid);
104         _sxyp = new SurfXYPlane(dist,phi);
105         _wv = wv;
106         _wz = wz;
107         _avz = avz;
108         _davz = davz;
109         
110         Assert.assertTrue( _davz >= 0.0 );
111     }
112     
113     // constructor from a list of ids
114     public ClusXYPlane1(double dist, double phi,
115             double wv, double wz, double avz,double davz,  List mcids)
116     {
117         super(mcids);
118         _sxyp = new SurfXYPlane(dist,phi);
119         _wv = wv;
120         _wz = wz;
121         _avz = avz;
122         _davz = davz;
123         
124         Assert.assertTrue( _davz >= 0.0 );
125     }
126     
127     // copy constructor
128     public ClusXYPlane1( ClusXYPlane1 clus)
129     {
130         super(clus);
131         _sxyp =  new SurfXYPlane(clus._sxyp);
132         _wv = clus._wv;
133         _wz = clus._wz;
134         _avz = clus._avz;
135         _davz = clus._davz;
136     }
137     
138     // return the type
139     public String type()
140     { return staticType();  }
141     
142     // return the surface
143     public  Surface surface()
144     { return _sxyp; }
145     
146     // return the wv pitch
147     public double wV()
148     { return _wv; }
149     
150     // return the wz pitch
151     public double wZ()
152     { return _wz; }
153     
154     // return avz
155     public double aVZ()
156     { return _avz; }
157     
158     // return davz
159     public double daVZ()
160     { return _davz; }
161     
162     // there are no more predictions.
163     public Hit newNextPrediction()
164     { return null; }
165     
166     public String toString()
167     {
168         return "ClusXYPlane1 " + _sxyp + " and v weight " + _wv
169                 + " and z weight " + _wz
170                 + ": avz = " + _avz + " +/- " + _davz;
171     }
172     
173 }