CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/RecoVertex/GhostTrackFitter/interface/GhostTrackPrediction.h

Go to the documentation of this file.
00001 #ifndef RecoBTag_GhostTrackPrediction_h
00002 #define RecoBTag_GhostTrackPrediction_h
00003 
00004 #include <cmath>
00005 
00006 #include <Math/SVector.h>
00007 #include <Math/SMatrix.h>
00008 
00009 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
00010 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00011 #include "DataFormats/GeometryCommonDetAlgo/interface/GlobalError.h"
00012 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00013 
00014 class MagneticField;
00015 class CurvilinearTrajectoryParameters;
00016 class GlobalTrajectoryParameters;
00017 class CurvilinearTrajectoryError;
00018 class FreeTrajectoryState;
00019 
00020 namespace reco {
00021 
00022 class GhostTrackPrediction {
00023     public:
00024         // z0, tIP, dz/dr, phi
00025 
00026         typedef ROOT::Math::SVector<double, 4> Vector;
00027         typedef ROOT::Math::SMatrix<double, 4, 4,
00028                         ROOT::Math::MatRepSym<double, 4> > Error;
00029         typedef ROOT::Math::SMatrix<double, 6, 6,
00030                         ROOT::Math::MatRepSym<double, 6> > CartesianError;
00031 
00032         GhostTrackPrediction() {}
00033         GhostTrackPrediction(const Vector &prediction, const Error &error) :
00034                 prediction_(prediction), covariance_(error)
00035         {}
00036 
00037         GhostTrackPrediction(const GlobalPoint &priorPosition, 
00038                              const GlobalError &priorError,
00039                              const GlobalVector &direction,
00040                              double coneRadius);
00041         GhostTrackPrediction(const GlobalPoint &priorPosition, 
00042                              const GlobalError &priorError,
00043                              const GlobalVector &direction,
00044                              const GlobalError &directionError)
00045         { init(priorPosition, priorError, direction, directionError); }
00046 
00047         GhostTrackPrediction(const CurvilinearTrajectoryParameters &trajectory,
00048                              const CurvilinearTrajectoryError &error);
00049         GhostTrackPrediction(const GlobalTrajectoryParameters &trajectory,
00050                              const CurvilinearTrajectoryError &error);
00051         GhostTrackPrediction(const Track &track);
00052 
00053         double z() const { return prediction_[0]; }
00054         double ip() const { return prediction_[1]; }
00055         double cotTheta() const { return prediction_[2]; }
00056         double phi() const { return prediction_[3]; }
00057 
00058         double rho2() const { return cotTheta() * cotTheta() + 1.; }
00059         double rho() const { return std::sqrt(rho2()); }
00060         double sz() const { return z() / rho(); }
00061         double theta() const { return M_PI_2 - std::atan(cotTheta()); }
00062         double eta() const { return -std::log(rho() - cotTheta()); }
00063 
00064         const Vector &prediction() const { return prediction_; }
00065         const Error &covariance() const { return covariance_; }
00066 
00067         const GlobalPoint origin() const
00068         { return GlobalPoint(-std::sin(phi()) * ip(), std::cos(phi()) * ip(), z()); }
00069         const GlobalVector direction() const
00070         { return GlobalVector(std::cos(phi()), std::sin(phi()), cotTheta()); }
00071 
00072         double lambda(const GlobalPoint &point) const
00073         { return (point - origin()) * direction() / rho2(); }
00074 
00075         GlobalPoint position(double lambda = 0.) const
00076         { return origin() + lambda * direction(); }
00077         GlobalError positionError(double lambda = 0.) const;
00078 
00079         CartesianError cartesianError(double lambda = 0.) const;
00080 
00081         CurvilinearTrajectoryParameters curvilinearTrajectory() const;
00082         GlobalTrajectoryParameters globalTrajectory(
00083                                 const MagneticField *fieldProvider) const;
00084         CurvilinearTrajectoryError curvilinearError() const;
00085 
00086         FreeTrajectoryState fts(const MagneticField *fieldProvider) const;
00087 
00088         Track track(double ndof = 0., double chi2 = 0.) const;
00089 
00090     private:
00091         void init(const GlobalPoint &priorPosition, 
00092                   const GlobalError &priorError,
00093                   const GlobalVector &direction,
00094                   const GlobalError &directionError);
00095 
00096         Vector  prediction_;
00097         Error   covariance_;
00098 };
00099 
00100 }
00101 #endif // RecoBTag_GhostTrackPrediction_h