00001
00002
00003 #ifndef LHCBMATH_KINEMATICS_H
00004 #define LHCBMATH_KINEMATICS_H 1
00005
00006
00007
00008
00009
00010 #include "Math/SMatrix.h"
00011 #include "Math/SVector.h"
00012 #include "Math/Vector4D.h"
00013
00021 namespace Gaudi
00022 {
00023
00024 namespace Math
00025 {
00026
00043 template <class C, class T>
00044 inline double
00045 sigma2mass2
00046 ( const ROOT::Math::LorentzVector<C>& momentum ,
00047 const ROOT::Math::SMatrix<T,4,4,ROOT::Math::MatRepSym<T,4> >& covariance )
00048 {
00049
00050 ROOT::Math::SVector<T,4> dM2dp;
00051 dM2dp [0] = -2 * momentum.Px () ;
00052 dM2dp [1] = -2 * momentum.Py () ;
00053 dM2dp [2] = -2 * momentum.Pz () ;
00054 dM2dp [3] = 2 * momentum.E () ;
00055
00056 return ROOT::Math::Similarity ( covariance , dM2dp ) ;
00057 }
00058
00077 template <class C, class T>
00078 inline double
00079 sigma2mass
00080 ( const ROOT::Math::LorentzVector<C>& momentum ,
00081 const ROOT::Math::SMatrix<T,4,4,ROOT::Math::MatRepSym<T,4> >& covariance )
00082 {
00083 const double s2m2 = sigma2mass2( momentum , covariance ) ;
00084 const double m2 = momentum.M2 () ;
00085 if ( 0 < m2 ) { return 0.25 * s2m2 / m2 ; }
00086 return -1000000 ;
00087 }
00088
00107 template <class C, class T>
00108 inline double
00109 sigmamass
00110 ( const ROOT::Math::LorentzVector<C>& momentum ,
00111 const ROOT::Math::SMatrix<T,4,4,ROOT::Math::MatRepSym<T,4> >& covariance )
00112 {
00113 const double s2m = sigma2mass ( momentum , covariance ) ;
00114 if ( 0 < s2m ) { return ::sqrt ( s2m ) ; }
00115 return s2m ;
00116 }
00117
00138 template <class C, class T>
00139 inline double chi2mass
00140 ( const double mass ,
00141 const ROOT::Math::LorentzVector<C>& momentum ,
00142 const ROOT::Math::SMatrix<T,4,4,ROOT::Math::MatRepSym<T,4> >& covariance )
00143 {
00144
00145 const double s2 = 1.0 / Gaudi::Math::sigma2mass2 ( momentum , covariance ) ;
00146
00147 const double dm2 = momentum.M2() - mass * mass ;
00148
00149 return ( dm2 * dm2 ) * s2 ;
00150 }
00151
00152 }
00153
00154 }
00155
00156
00157
00158 #endif // LHCBMATH_KINEMATICS_H
00159