/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/MdcPatRec/MdcRecoUtil/MdcRecoUtil-00-01-08/MdcRecoUtil/BesVectorErr.h

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: BesVectorErr.h,v 1.5 2010/03/25 09:55:57 zhangy Exp $
00004 //
00005 // Description:
00006 //      Add errors to a vector.  Used for direction errors 
00007 //      BaBar native class
00008 //
00009 // Environment:
00010 //      Software developed for the BaBar Detector at the SLAC B-Factory.
00011 //
00012 // Author List:
00013 //      Forest Rouse                    February 1996
00014 //      Victoria Novotny                August   1996
00015 //      Ed Frank        University of Pennsylvania, efrank@upenn5.hep.upenn.edu
00016 //
00017 // History
00018 //      14 Oct 96  Ed Frank      Simple mod to make unary - compile under
00019 //                               Sun's CC 4.0.1
00020 //      19 Jan 2002  Sasha Telnov  Added operator * (scaling by a real number)
00021 //
00022 // Copyright Information:
00023 //      Copyright (C) 1996
00024 // 
00025 // History:
00026 //      Migration for BESIII MDC
00027 //
00028 //------------------------------------------------------------------------
00029 #ifndef BESVECTORERR_H
00030 #define BESVECTORERR_H
00031 
00032 #include <iosfwd>
00033 #include "MdcRecoUtil/BesError.h"
00034 #include "CLHEP/Vector/Rotation.h"
00035 
00036 using namespace CLHEP;
00037 
00038 
00039 class BesVectorErr : public Hep3Vector {
00040   
00041 public:
00042   // polar coordinates
00043   enum PolarCoordinateIndex {   
00044     Rho = 0, 
00045     Theta = 1, 
00046     Phi = 2,
00047     NUM_PCOORDINATES = 3
00048   };
00049   
00050   enum CylindricalCoordinateIndex {   
00051     C_Rho = 0, 
00052     C_Zeta = 1, 
00053     C_Phi = 2,
00054     NUM_CCOORDINATES = 3
00055   };
00056   // argumentless constructor:
00057   BesVectorErr() : Hep3Vector(), _covMatrix(NUM_COORDINATES) {}
00058   
00059   // auto casting constructor
00060   BesVectorErr(const Hep3Vector &p) : Hep3Vector(p), _covMatrix(NUM_COORDINATES)        {}
00061   BesVectorErr(const Hep3Vector &p, const BesError& covMat) : Hep3Vector(p),
00062   _covMatrix(NUM_COORDINATES)                           { _covMatrix=covMat; }
00063 
00064   // copy constructor:
00065   BesVectorErr(const BesVectorErr& v) : Hep3Vector(v),
00066     _covMatrix(v.covMatrix())   {}
00067 
00068   // destructor MAY be needed later
00069   // virtual ~BesVectorErr() {};
00070 
00071   // assignment operator:
00072   BesVectorErr& operator=(const BesVectorErr& v)
00073     {
00074       if (this != &v) {
00075         Hep3Vector::operator=(v);
00076         _covMatrix = v.covMatrix();
00077       }
00078       return *this;
00079     }
00080 
00081   BesVectorErr operator - () {
00082       Hep3Vector t = *this;
00083       return BesVectorErr( -t, _covMatrix);  // _covMatrix remains unaltered
00084   }
00085 
00086   BesVectorErr& operator += (const BesVectorErr& v){
00087       Hep3Vector::operator+=(v);
00088       _covMatrix += v.covMatrix();
00089       return *this;
00090   }
00091   
00092   BesVectorErr& operator -= (const BesVectorErr& v){
00093       Hep3Vector::operator-=(v);
00094       _covMatrix += v.covMatrix();
00095       return *this;
00096   }
00097 /*
00098   BesVectorErr& transform(const HepTranslation& trans){
00099       Hep3Vector::transform(trans);
00100       return *this;
00101   }
00102 
00103   BesVectorErr& transform(const HepRotation& rot){
00104       Hep3Vector::transform(rot);
00105       _covMatrix = _covMatrix.similarity(rot);
00106       return *this;
00107   }
00108 
00109   BesVectorErr& transform(const HepTransformation& transf){
00110       Hep3Vector::transform(transf);
00111       _covMatrix = _covMatrix.similarity(transf.rot_mat());
00112       return *this;
00113   }
00114 */
00115   double determineChisq(const Hep3Vector& refVector) const;   
00116   // returns Chisquare
00117   // refVector refers to the same origin as the Hep3Vector of this
00118   // ie refVector is not relative to this Vector
00119 
00120 
00121   inline const BesError & covMatrix() const             { return _covMatrix; }
00122 
00123   BesError covRTPMatrix() const;
00124   // returns the covariance Matrix in spherical coordinate
00125   // use   PolarCoordinateIndex enum to get the components
00126 
00127   BesError covRZPMatrix() const;
00128   // returns the covariance Matrix in cylindrical coordinate
00129   // use   CylindricalCoordinateIndex enum to get the components
00130 
00131   inline void setCovMatrix(const BesError& v)           { _covMatrix = v; }
00132 
00133 //  void printOn(ostream& out=cout) const;
00134 
00135 private:
00136   
00137   BesError _covMatrix;
00138 };
00139 
00140 
00141 BesVectorErr operator + (const BesVectorErr&, const BesVectorErr&);
00142 
00143 BesVectorErr operator - (const BesVectorErr&, const BesVectorErr&);
00144 
00145 // Added by Sasha Telnov
00146 BesVectorErr operator * (const BesVectorErr &, double a);
00147 BesVectorErr operator * (double a, const BesVectorErr &);
00148 
00149 std::ostream & operator<<(std::ostream & stream, const BesVectorErr & verr);
00150 std::istream & operator>>(std::istream & stream, BesVectorErr & verr);
00151 
00152 #endif
00153 
00154 
00155 
00156 
00157 
00158 

Generated on Tue Nov 29 23:13:31 2016 for BOSS_7.0.2 by  doxygen 1.4.7