Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:58:32

0001 /****************************************************************************
0002 * Authors: 
0003 *  Jan Kašpar (jan.kaspar@gmail.com) 
0004 ****************************************************************************/
0005 
0006 #ifndef CalibPPS_AlignmentRelative_LocalTrackFit_h
0007 #define CalibPPS_AlignmentRelative_LocalTrackFit_h
0008 
0009 #include "TMath.h"
0010 
0011 /**
0012  *\brief Local (linear) track description (or a fit result).
0013  * Uses global reference system.
0014  **/
0015 struct LocalTrackFit {
0016   /// the point where intercepts are measured, in mm
0017   double z0;
0018 
0019   /// slopes in rad
0020   double ax, ay;
0021 
0022   /// intercepts in mm
0023   double bx, by;
0024 
0025   /// the number of degrees of freedom
0026   signed int ndf;
0027 
0028   /// the residual sum of squares
0029   double chi_sq;
0030 
0031   LocalTrackFit(double _z0 = 0.,
0032                 double _ax = 0.,
0033                 double _ay = 0.,
0034                 double _bx = 0.,
0035                 double _by = 0.,
0036                 unsigned int _ndf = 0,
0037                 double _chi_sq = 0.)
0038       : z0(_z0), ax(_ax), ay(_ay), bx(_bx), by(_by), ndf(_ndf), chi_sq(_chi_sq) {}
0039 
0040   double pValue() const { return TMath::Prob(chi_sq, ndf); }
0041 
0042   double chiSqPerNdf() const { return (ndf > 0) ? chi_sq / ndf : 0.; }
0043 
0044   void eval(double z, double &x, double &y) {
0045     double ze = z - z0;
0046     x = ax * ze + bx;
0047     y = ay * ze + by;
0048   }
0049 };
0050 
0051 #endif