Testing Helix fit code, chi2/dof
  1. The working horse:
    
    OUTPUT:
    
      double mXCenter, mYCenter, mFitRadius, mChi2Rad,mIterRad;
    
    bool
    HelixUtil::CircleFit(double x[],double y[], double wei[], int num){
    
    
    //////////////////////////////////////////////////////////////////
    // Circle fitting program
    //
    // This function will fit a circle to the points in the matrix x and y.
    // 'num' is the number of points in x and y
    // 'xc' is the found center in x
    // 'yc' is the found center in y
    // 'R' is the radius of the fitted circle
    // 'chi2' error in fit
    //
    // Written by Mike Heffner Sept 21 1998
    // error calculation added Oct 3 1998, Mike Heffner
    // fit with point errors added May 1999 Holm Huemmler
    //  Jan Balewski, January 2007
    //  - fix chi2 formula,
    //  - relace weights in x & y by common weigth, were merged  anyhow
    //  - returns false only if # of points<4
    //
    // Fitting algorithm by: N.Chernov,G.Ososkov, Computer Physics 
    //          Communications 33(1984) 329-333
    //////////////////////////////////////////////////////////////////  
    

  2. Input: segment of circle which matches a 10GeV Pt tracks at eta of 1.5, full filed.
    * fixed params: R=66m; arc len=0.02 rad == ~120 cm;
    sigL=1mm (along arc); sigR=0 (along radius), nd=10 equaly spaced points
    weight[i]=const=1/sigL^2
    * varied: location of the center of the circle uniform in 2pi (equivalent, to varied phi of the prim track)
    * Gaussian noise added to each hit point along the arc.
    * chi2/dof calculated as sum {recoR- dist(hit-recoCenter) /sigL }, squared
    example of one track (units=cm) & fit result
     
    IN: 0 -23.50 -23.17
    IN: 1 -32.86 -32.47
    IN: 2 -42.26 -41.75
    IN: 3 -51.77 -50.89
    IN: 4 -61.34 -59.99
    IN: 5 -70.87 -69.13
    IN: 6 -80.30 -78.37
    IN: 7 -89.79 -87.53
    IN: 8 -99.32 -96.67
    IN: 9 -108.91 -105.74 
    IN Center       xc=-4649.85 yc=4683.0  phi0/rad=2.352547
    Fit: R=9207.21  xc=-6462.11 yc=6558.29 chi2dof=0.64692 nIter=2 len/cm=118.8
    DEL: R=2607.21  xc=-1812.26 yc=1874.39
    
    Few distributions for 1000 tracks

  3. avr chi2/dof is 1

  4. reco pT will have RMS of 40%, is non-Gaussian

  5. Error of the curvature has Gaussian distribution

  6. Make sure I added the sigL smearing correctly

  7. Used macro doHelixA.C