BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
BesVectorErr.cxx
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: BesVectorErr.cxx,v 1.3 2010/03/25 09:55:57 zhangy Exp $
4//
5// Description:
6// Class BbrVectorErr
7//
8// Environment:
9// Software developed for the BaBar Detector at the SLAC B-Factory.
10//
11// Author List:
12// Forest Rouse February 1996
13// Victoria Novotny August 1996
14//
15// Copyright Information:
16// Copyright (C) 1996 U.C. Davis
17//
18// History:
19// Migration for BESIII MDC
20//
21// 2002/01/19, Sasha Telnov: added operator * (scaling by a real number)
22//
23//------------------------------------------------------------------------
24// File BbrVectorErr.cc
25// Source file for class BbrVectorErr
26//
27// For advice, input, or any questions then please contact either
28// Bob Jacobsen <Bob_Jacobsen@lbl.gov> or
29// Forest Rouse <rouse@ucdhep.ucdavis.edu>
30//
31// =====================================================================
32// Name Change description
33// Date
34// Version
35// =====================================================================
36
37// #include "BaBar/BaBar.h"
38#include "MdcRecoUtil/BesVectorErr.h"
39#include "MdcRecoUtil/DifArray.h"
40#include "MdcRecoUtil/DifNumber.h"
41#include <float.h>
42#include <iostream>
43using std::istream;
44using std::ostream;
45// #include "BesError.h"
46
47// void BesVectorErr::printOn(ostream& out) const
48//{
49// out << "Bes Vector and Covariance Matrix:" << endl;
50// BesVector::printOn(out);
51// out << endl;
52// out << _covMatrix;
53// }
54
56 // protect against 0's
57 double xv = x() == 0 ? FLT_MIN : x();
58 double yv = y() == 0 ? FLT_MIN : y();
59 double zv = z() == 0 ? FLT_MIN : z();
60 DifNumber xDF( xv, X + 1, 3 ), yDF( yv, Y + 1, 3 ), zDF( zv, Z + 1, 3 );
61 DifArray pars( 3, NUM_PCOORDINATES );
62 pars[Rho] = sqrt( xDF * xDF + yDF * yDF + zDF * zDF );
63 pars[Phi] = atan2( yDF, xDF );
64 pars[Theta] = acos( zDF / pars[Rho] );
65 return covMatrix().similarity( pars.jacobian() );
66}
67
69 // protect against 0's
70 double xv = x() == 0 ? FLT_MIN : x();
71 double yv = y() == 0 ? FLT_MIN : y();
72 double zv = z() == 0 ? FLT_MIN : z();
73 DifNumber xDF( xv, X + 1, 3 ), yDF( yv, Y + 1, 3 ), zDF( zv, Z + 1, 3 );
74 DifArray pars( 3, NUM_CCOORDINATES );
75 pars[C_Rho] = sqrt( xDF * xDF + yDF * yDF );
76 pars[C_Phi] = atan2( yDF, xDF );
77 pars[C_Zeta] = zDF;
78 return covMatrix().similarity( pars.jacobian() );
79}
80
81double BesVectorErr::determineChisq( const Hep3Vector& refVector ) const {
82 HepVector temp( NUM_COORDINATES, 0 );
83 temp[0] = refVector.x() - this->x();
84 temp[1] = refVector.y() - this->y();
85 temp[2] = refVector.z() - this->z();
86 return _covMatrix.determineChisq( temp );
87}
88
90 BesVectorErr ve( Hep3Vector( v.x() + w.x(), v.y() + w.y(), v.z() + w.z() ),
91 ( v.covMatrix() + w.covMatrix() ) );
92 return ve;
93}
94
96 BesVectorErr ve( Hep3Vector( v.x() - w.x(), v.y() - w.y(), v.z() - w.z() ),
97 ( v.covMatrix() + w.covMatrix() ) );
98 return ve;
99}
100
101// Added by Sasha Telnov
102BesVectorErr operator*( const BesVectorErr& p, double a ) {
103 BesVectorErr ve( Hep3Vector( a * p.x(), a * p.y(), a * p.z() ), ( p.covMatrix() * a * a ) );
104 return ve;
105}
106
107BesVectorErr operator*( double a, const BesVectorErr& p ) {
108 BesVectorErr ve( Hep3Vector( a * p.x(), a * p.y(), a * p.z() ), ( p.covMatrix() * a * a ) );
109 return ve;
110}
111
112ostream& operator<<( ostream& stream, const BesVectorErr& verr ) {
113 stream << (const Hep3Vector&)verr << ", " << verr.covMatrix();
114
115 return stream;
116}
117
118istream& operator>>( istream& stream, BesVectorErr& verr ) {
119 BesError mat( verr.SIZE );
120 stream >> (Hep3Vector&)verr >> mat;
121 verr.setCovMatrix( mat );
122
123 return stream;
124}
istream & operator>>(istream &stream, BesVectorErr &verr)
BesVectorErr operator-(const BesVectorErr &v, const BesVectorErr &w)
BesVectorErr operator+(const BesVectorErr &v, const BesVectorErr &w)
BesVectorErr operator*(const BesVectorErr &p, double a)
ostream & operator<<(ostream &stream, const BesVectorErr &verr)
Double_t x[10]
double w
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition KarLud.h:35
BesError similarity(const HepRotation &rot) const
Definition BesError.cxx:49
BesError covRZPMatrix() const
double determineChisq(const Hep3Vector &refVector) const
BesError covRTPMatrix() const
HepMatrix jacobian() const
Definition DifArray.cxx:70