CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/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 GlobalTrajectoryParameters;
00016 class CurvilinearTrajectoryError;
00017 class FreeTrajectoryState;
00018 
00019 namespace reco {
00020 
00021 class GhostTrackPrediction {
00022     public:
00023         // z0, tIP, dz/dr, phi
00024 
00025         typedef ROOT::Math::SVector<double, 4> Vector;
00026         typedef ROOT::Math::SMatrix<double, 4, 4,
00027                         ROOT::Math::MatRepSym<double, 4> > Error;
00028         typedef ROOT::Math::SMatrix<double, 6, 6,
00029                         ROOT::Math::MatRepSym<double, 6> > CartesianError;
00030 
00031         GhostTrackPrediction() {}
00032         GhostTrackPrediction(const Vector &prediction, const Error &error) :
00033                 prediction_(prediction), covariance_(error)
00034         {}
00035 
00036         GhostTrackPrediction(const GlobalPoint &priorPosition, 
00037                              const GlobalError &priorError,
00038                              const GlobalVector &direction,
00039                              double coneRadius);
00040 
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 GlobalTrajectoryParameters &trajectory,
00048                              const CurvilinearTrajectoryError &error);
00049 
00050         GhostTrackPrediction(const Track &track);
00051 
00052         double z() const { return prediction_[0]; }
00053         double ip() const { return prediction_[1]; }
00054         double cotTheta() const { return prediction_[2]; }
00055         double phi() const { return prediction_[3]; }
00056 
00057         double rho2() const { return cotTheta() * cotTheta() + 1.; }
00058         double rho() const { return std::sqrt(rho2()); }
00059         double sz() const { return z() / rho(); }
00060         double theta() const { return M_PI_2 - std::atan(cotTheta()); }
00061         double eta() const { return -std::log(rho() - cotTheta()); }
00062 
00063         const Vector &prediction() const { return prediction_; }
00064         const Error &covariance() const { return covariance_; }
00065 
00066         const GlobalPoint origin() const
00067         { return GlobalPoint(-std::sin(phi()) * ip(), std::cos(phi()) * ip(), z()); }
00068         const GlobalVector direction() const
00069         { return GlobalVector(std::cos(phi()), std::sin(phi()), cotTheta()); }
00070 
00071         double lambda(const GlobalPoint &point) const
00072         { return (point - origin()) * direction() / rho2(); }
00073 
00074         GlobalPoint position(double lambda = 0.) const
00075         { return origin() + lambda * direction(); }
00076         GlobalError positionError(double lambda = 0.) const;
00077 
00078         CartesianError cartesianError(double lambda = 0.) const;
00079 
00080         GlobalTrajectoryParameters globalTrajectory(
00081                                 const MagneticField *fieldProvider) const;
00082         CurvilinearTrajectoryError curvilinearError() const;
00083 
00084         FreeTrajectoryState fts(const MagneticField *fieldProvider) const;
00085 
00086         Track track(double ndof = 0., double chi2 = 0.) const;
00087 
00088     private:
00089         void init(const GlobalPoint &priorPosition, 
00090                   const GlobalError &priorError,
00091                   const GlobalVector &direction,
00092                   const GlobalError &directionError);
00093 
00094         Vector  prediction_;
00095         Error   covariance_;
00096 };
00097 
00098 }
00099 #endif // RecoBTag_GhostTrackPrediction_h