View Javadoc

1   package org.lcsim.recon.vertexing.billoir;
2   /**
3    * @version $Id: Vertex.java,v 1.2 2006/03/28 23:50:27 jstrube Exp $
4    */
5   //Testing...
6   // A class encapsulating the behavior of a vertex constructed
7   // from tracks. It is written to be independent of any other
8   // packages and therefore makes extensive use of arrays and
9   // internal methods. It is not object-oriented in any way.
10  // But it should work.
11  //
12  public class Vertex {
13      public int _ntrk; // the number of tracks used in this fit
14      public double[] _xyzf; // the vertex position in Cartesian coordinates
15      public double[] _vcov; // packed covariance matrix on _xyzf
16  
17      public double[][] _parf; // the fitted parameters at the vertex
18      // 0: theta
19      // 1: phi
20      // 2: 1/R
21      public double[][] _tcov; // covariance matrix on _parf
22  
23      public double _chi2; // chisquared of vertex fit;
24      public double[] _chi2tr; // chisquared contribution of each track
25  
26      // default constructor
27      public Vertex() {
28          _ntrk = 0;
29          _xyzf = new double[3];
30          _parf = new double[3][0];
31          _vcov = new double[6];
32          _tcov = new double[6][0];
33          _chi2 = 0.;
34          _chi2tr = new double[0];
35      }
36  
37      // constructor
38      public Vertex(int ntrk, double[] xyz, double[][] parf, double[] vcov, double[][] tcov, double chi2, double[] chi2tr) {
39          _ntrk = ntrk;
40          _xyzf = xyz;
41          _parf = parf;
42          _vcov = vcov;
43          _tcov = tcov;
44          _chi2 = chi2;
45          _chi2tr = chi2tr;
46      }
47  
48      public String toString() {
49          StringBuffer sb = new StringBuffer("Vertex at : \nx= "
50                  + _xyzf[0]
51                  + " +/- "
52                  + Math.sqrt(_vcov[0])
53                  + "\ny= "
54                  + _xyzf[1]
55                  + " +/- "
56                  + Math.sqrt(_vcov[2])
57                  + "\nz= "
58                  + _xyzf[2]
59                  + " +/- "
60                  + Math.sqrt(_vcov[5])
61                  + "\nchi2 = "
62                  + _chi2);
63          for (int i = 0; i < _ntrk; ++i) {
64              sb.append("\n chi2[" + i + "]= " + _chi2tr[i]);
65          }
66          return sb.toString();
67  
68      }
69  
70  }