BOSS 7.0.4
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 <math.h>
21#include <assert.h>
22#include "MdcTrkRecon/mdcTwoInv.h"
23#include "MdcGeom/MdcSuperLayer.h"
24#include "MdcTrkRecon/MdcSeg.h"
25#include "MdcGeom/BesAngle.h"
26//#include "ErrLogger/ErrLog.h"
27using std::endl;
28
29//--------------------------------------------------------------------------
30bool
32//---------------------------------------------------------------------------
33 assert (i >= 0 && i < 2);
34 return (0 != i); //i.e., parameter 1 is an angle
35}
36//------------------------------------------------------------------
37void
38MdcSegInfoCsmc::calcStraight(double phi, double slope,
39 double rad, const double *inErr) {
40//------------------------------------------------------------------
41 // Load the segment info obj with phi0 and d0 values, calc. assuming
42 // the segments lie on straight tracks.
43 //
44 // d0 defined to be positive for tracks that intercept x axis on positive
45 // phi (neg x) side of origin. At least that's what I claim. */
46
47 // error matrix conversion:
48 // Vij(f) = SUM(n,m) ( d(fi)/d(yn) * d(fj)/d(ym) * Vnm(y) )
49 // The derivatives are calculated from:
50 // d0 = r**2 * slope / sqrt( 1 + r**2 * slope**2 ) &
51 // phi0 = phiseg - asin(d0 / r)
52
53 // d0ovSlope = r**2/sqrt(1 + slope**2 * r**2) = d0 / slope
54 // d0ovrad = d0/r
55 // d0ovradsq = (d0/r)**2
56 // dphi0dphi = d(phi0)/d(seg-phi)
57 // dphi0ds = d(phi0)/d(seg-slope)
58 // dd0ds = d(d0)/d(seg-slope)
59 // dd0dphi = 0
60
61 double d0ovSlope = -rad * rad / sqrt( 1. + slope*slope * rad*rad );
62 double d0 = slope * d0ovSlope;
63 _par0 = d0;
64
65 double d0ovRad = d0 / rad ;
66 // Don't blow away arcsine:
67 d0ovRad = ( d0ovRad > 1.0 || d0ovRad < -1.0) ?
68 (d0ovRad+0.00001)/fabs(d0ovRad) : d0ovRad;
69 BesAngle phi0 = phi - asin( d0ovRad );
70 _par1 = phi0.posRad();
71
72 // Error matrix (anal calculation).
73 // double dphi0dphi = 1.;
74 double dphi0ds = -d0ovSlope * sqrt( 1. - d0ovRad*d0ovRad ) / rad;
75 double dd0ds = d0ovSlope * ( 1. - d0ovRad*d0ovRad );
76
77 // d0:
78 _errmat[0] = inErr[2] * dd0ds * dd0ds;
79 if (_errmat[0] < 0.) _errmat[0] = 0.;
80
81 // phi0:
82 _errmat[2] = inErr[2] * dphi0ds * dphi0ds + inErr[0] +
83 inErr[1] * 2. * dphi0ds;
84 if (_errmat[2] < 0.) _errmat[2] = 0.;
85 // phi0|d0:
86 _errmat[1] = inErr[2] * dd0ds * dphi0ds +
87 inErr[1] * dd0ds;
88
89 int error = mdcTwoInv(_errmat, _inverr);
90 if (error) {
91 std::cout << " ErrMsg(warning) "
92 << "Failed to invert matrix -- MdcSegInfo::calcStraight" << endl
93 << _errmat[0] << " " << _errmat[1] << " " << _errmat[2]<< std::endl;
94 }
95}
96
97//------------------------------------------------------------------
98void
100//------------------------------------------------------------------
101 double slope = parentSeg->slope();
102 double radius = parentSeg->superlayer()->rad0();
103 double phi = parentSeg->phi();
104 const double *inErr = parentSeg->errmat();
105
106 calcStraight(phi, slope, radius, inErr);
107}
108
109//------------------------------------------------------------------
110double
112//------------------------------------------------------------------
113 return sqrt(_errmat[2]);
114}
115//------------------------------------------------------------------
116double
118//------------------------------------------------------------------
119 return sqrt(_errmat[0]);
120}
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)
const MdcSuperLayer * superlayer() const