00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "MdcTrkRecon/MdcSegInfoCsmc.h"
00020 #include <math.h>
00021 #include <assert.h>
00022 #include "MdcTrkRecon/mdcTwoInv.h"
00023 #include "MdcGeom/MdcSuperLayer.h"
00024 #include "MdcTrkRecon/MdcSeg.h"
00025 #include "MdcGeom/BesAngle.h"
00026
00027 using std::endl;
00028
00029
00030 bool
00031 MdcSegInfoCsmc::parIsAngle(int i) const {
00032
00033 assert (i >= 0 && i < 2);
00034 return (0 != i);
00035 }
00036
00037 void
00038 MdcSegInfoCsmc::calcStraight(double phi, double slope,
00039 double rad, const double *inErr) {
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 double d0ovSlope = -rad * rad / sqrt( 1. + slope*slope * rad*rad );
00062 double d0 = slope * d0ovSlope;
00063 _par0 = d0;
00064
00065 double d0ovRad = d0 / rad ;
00066
00067 d0ovRad = ( d0ovRad > 1.0 || d0ovRad < -1.0) ?
00068 (d0ovRad+0.00001)/fabs(d0ovRad) : d0ovRad;
00069 BesAngle phi0 = phi - asin( d0ovRad );
00070 _par1 = phi0.posRad();
00071
00072
00073
00074 double dphi0ds = -d0ovSlope * sqrt( 1. - d0ovRad*d0ovRad ) / rad;
00075 double dd0ds = d0ovSlope * ( 1. - d0ovRad*d0ovRad );
00076
00077
00078 _errmat[0] = inErr[2] * dd0ds * dd0ds;
00079 if (_errmat[0] < 0.) _errmat[0] = 0.;
00080
00081
00082 _errmat[2] = inErr[2] * dphi0ds * dphi0ds + inErr[0] +
00083 inErr[1] * 2. * dphi0ds;
00084 if (_errmat[2] < 0.) _errmat[2] = 0.;
00085
00086 _errmat[1] = inErr[2] * dd0ds * dphi0ds +
00087 inErr[1] * dd0ds;
00088
00089 int error = mdcTwoInv(_errmat, _inverr);
00090 if (error) {
00091 std::cout << " ErrMsg(warning) "
00092 << "Failed to invert matrix -- MdcSegInfo::calcStraight" << endl
00093 << _errmat[0] << " " << _errmat[1] << " " << _errmat[2]<< std::endl;
00094 }
00095 }
00096
00097
00098 void
00099 MdcSegInfoCsmc::calcStraight(const MdcSeg *parentSeg) {
00100
00101 double slope = parentSeg->slope();
00102 double radius = parentSeg->superlayer()->rad0();
00103 double phi = parentSeg->phi();
00104 const double *inErr = parentSeg->errmat();
00105
00106 calcStraight(phi, slope, radius, inErr);
00107 }
00108
00109
00110 double
00111 MdcSegInfoCsmc::sigPhi0() const {
00112
00113 return sqrt(_errmat[2]);
00114 }
00115
00116 double
00117 MdcSegInfoCsmc::sigD0() const {
00118
00119 return sqrt(_errmat[0]);
00120 }