00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: MdcSegInfoAxialO.cxx,v 1.2 2005/07/18 02:34:42 zhangy Exp $ 00004 // 00005 // Description: 00006 // 00007 // 00008 // Environment: 00009 // Software developed for the BaBar Detector at the SLAC B-Factory. 00010 // 00011 // Authors: 00012 // 00013 //------------------------------------------------------------------------ 00014 //#include "BaBar/BaBar.h" 00015 #include "MdcTrkRecon/MdcSegInfoAxialO.h" 00016 #include <math.h> 00017 #include <assert.h> 00018 #include "MdcTrkRecon/mdcTwoInv.h" 00019 #include "MdcTrkRecon/MdcSeg.h" 00020 #include "MdcGeom/MdcSuperLayer.h" 00021 #include "MdcGeom/BesAngle.h" 00022 //#include "ErrLogger/ErrLog.h" 00023 using std::endl; 00024 00025 //-------------------------------------------------------------------------- 00026 bool 00027 MdcSegInfoAxialO::parIsAngle(int i) const { 00028 //--------------------------------------------------------------------------- 00029 assert (i >= 0 && i < 2); 00030 return (0 == i); //i.e., 0th parameter is an angle 00031 } 00032 //------------------------------------------------------------------ 00033 void 00034 MdcSegInfoAxialO::calcFromOrigin(double phi, double slope, 00035 double radius, const double *inErr) { 00036 //------------------------------------------------------------------ 00037 00038 if (slope == 0.) slope = 0.00000001; 00039 double slinv = 1./slope; 00040 _par1 = slope / sqrt(1. + radius*radius * slope*slope); //curve 00041 double temp = 1. - _par1*_par1 * radius*radius; 00042 if (temp < 0.) temp = 0.; 00043 double dphi0ds = -radius * _par1 * sqrt(temp) * slinv; 00044 BesAngle phi0 = phi - asin(_par1 * radius); 00045 _par0 = phi0.posRad(); 00046 00047 // phi0: 00048 _errmat[0] = inErr[2] * dphi0ds * dphi0ds + inErr[0] + 00049 inErr[1] * 2. * dphi0ds; 00050 if (_errmat[0] < 0.) _errmat[0] = 0.; 00051 // curv: 00052 _errmat[2] = inErr[2] * _par1*_par1 * temp*temp * slinv*slinv; 00053 if (_errmat[2] < 0.) _errmat[2] = 0.; 00054 // phi0|curv: 00055 _errmat[1] = inErr[2] *_par1 * slinv * temp * dphi0ds + 00056 inErr[1] *_par1 * slinv * temp; 00057 int error = mdcTwoInv(_errmat, _inverr); 00058 if (error) { 00059 std::cout << " ErrMsg(warning) " 00060 << "Failed to invert matrix -- MdcSegInfo::calcFromOrigin" << endl 00061 << _errmat[0] << " " << _errmat[1] << " " << _errmat[2]<< endl; 00062 } 00063 } 00064 00065 //------------------------------------------------------------------- 00066 void 00067 MdcSegInfoAxialO::calcFromOrigin(const MdcSeg *parentSeg) { 00068 //------------------------------------------------------------------- 00069 double slope = parentSeg->slope(); 00070 double radius = parentSeg->superlayer()->rad0(); 00071 double phi = parentSeg->phi(); 00072 const double *inErr = parentSeg->errmat(); 00073 00074 calcFromOrigin(phi, slope, radius, inErr); 00075 } 00076 00077 //------------------------------------------------------------------- 00078 double 00079 MdcSegInfoAxialO::sigPhi0() const { 00080 //------------------------------------------------------------------- 00081 return sqrt(_errmat[0]);} 00082 00083 //------------------------------------------------------------------- 00084 double 00085 MdcSegInfoAxialO::sigCurv() const { 00086 //------------------------------------------------------------------- 00087 return sqrt(_errmat[2]);} 00088 00089 00090 00091