BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcSegInfoCsmc.cxx
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: MdcSegInfoCsmc.cxx,v 1.3 2009/12/16 09:02:47 zhangy Exp $
4//
5// Description:
6//
7// Environment:
8// Software developed for the BaBar Detector at the SLAC B-Factory.
9//
10// Authors:
11//
12// Copyright (C) 1996 The Board of Trustees of
13//
14// History:
15// Migration for BESIII MDC
16// The Leland Stanford Junior University. All Rights Reserved.
17//------------------------------------------------------------------------
18// #include "BaBar/BaBar.h"
19#include "MdcTrkRecon/MdcSegInfoCsmc.h"
20#include "MdcGeom/BesAngle.h"
21#include "MdcGeom/MdcSuperLayer.h"
22#include "MdcTrkRecon/MdcSeg.h"
23#include "MdcTrkRecon/mdcTwoInv.h"
24#include <assert.h>
25#include <math.h>
26// #include "ErrLogger/ErrLog.h"
27using std::endl;
28
29//--------------------------------------------------------------------------
30bool MdcSegInfoCsmc::parIsAngle( int i ) const {
31 //---------------------------------------------------------------------------
32 assert( i >= 0 && i < 2 );
33 return ( 0 != i ); // i.e., parameter 1 is an angle
34}
35//------------------------------------------------------------------
36void MdcSegInfoCsmc::calcStraight( double phi, double slope, double rad,
37 const double* inErr ) {
38 //------------------------------------------------------------------
39 // Load the segment info obj with phi0 and d0 values, calc. assuming
40 // the segments lie on straight tracks.
41 //
42 // d0 defined to be positive for tracks that intercept x axis on positive
43 // phi (neg x) side of origin. At least that's what I claim. */
44
45 // error matrix conversion:
46 // Vij(f) = SUM(n,m) ( d(fi)/d(yn) * d(fj)/d(ym) * Vnm(y) )
47 // The derivatives are calculated from:
48 // d0 = r**2 * slope / sqrt( 1 + r**2 * slope**2 ) &
49 // phi0 = phiseg - asin(d0 / r)
50
51 // d0ovSlope = r**2/sqrt(1 + slope**2 * r**2) = d0 / slope
52 // d0ovrad = d0/r
53 // d0ovradsq = (d0/r)**2
54 // dphi0dphi = d(phi0)/d(seg-phi)
55 // dphi0ds = d(phi0)/d(seg-slope)
56 // dd0ds = d(d0)/d(seg-slope)
57 // dd0dphi = 0
58
59 double d0ovSlope = -rad * rad / sqrt( 1. + slope * slope * rad * rad );
60 double d0 = slope * d0ovSlope;
61 _par0 = d0;
62
63 double d0ovRad = d0 / rad;
64 // Don't blow away arcsine:
65 d0ovRad =
66 ( d0ovRad > 1.0 || d0ovRad < -1.0 ) ? ( d0ovRad + 0.00001 ) / fabs( d0ovRad ) : d0ovRad;
67 BesAngle phi0 = phi - asin( d0ovRad );
68 _par1 = phi0.posRad();
69
70 // Error matrix (anal calculation).
71 // double dphi0dphi = 1.;
72 double dphi0ds = -d0ovSlope * sqrt( 1. - d0ovRad * d0ovRad ) / rad;
73 double dd0ds = d0ovSlope * ( 1. - d0ovRad * d0ovRad );
74
75 // d0:
76 _errmat[0] = inErr[2] * dd0ds * dd0ds;
77 if ( _errmat[0] < 0. ) _errmat[0] = 0.;
78
79 // phi0:
80 _errmat[2] = inErr[2] * dphi0ds * dphi0ds + inErr[0] + inErr[1] * 2. * dphi0ds;
81 if ( _errmat[2] < 0. ) _errmat[2] = 0.;
82 // phi0|d0:
83 _errmat[1] = inErr[2] * dd0ds * dphi0ds + inErr[1] * dd0ds;
84
85 int error = mdcTwoInv( _errmat, _inverr );
86 if ( error )
87 {
88 std::cout << " ErrMsg(warning) "
89 << "Failed to invert matrix -- MdcSegInfo::calcStraight" << endl
90 << _errmat[0] << " " << _errmat[1] << " " << _errmat[2] << std::endl;
91 }
92}
93
94//------------------------------------------------------------------
95void MdcSegInfoCsmc::calcStraight( const MdcSeg* parentSeg ) {
96 //------------------------------------------------------------------
97 double slope = parentSeg->slope();
98 double radius = parentSeg->superlayer()->rad0();
99 double phi = parentSeg->phi();
100 const double* inErr = parentSeg->errmat();
101
102 calcStraight( phi, slope, radius, inErr );
103}
104
105//------------------------------------------------------------------
107 //------------------------------------------------------------------
108 return sqrt( _errmat[2] );
109}
110//------------------------------------------------------------------
111double MdcSegInfoCsmc::sigD0() const {
112 //------------------------------------------------------------------
113 return sqrt( _errmat[0] );
114}
int mdcTwoInv(double matrix[3], double invmat[3])
double sigPhi0() const
bool parIsAngle(int i) const
double sigD0() const
void calcStraight(double phi, double slope, double rad, const double *inErr)