Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:28:10

0001 #ifndef RecoBTag_GhostTrackPrediction_h
0002 #define RecoBTag_GhostTrackPrediction_h
0003 
0004 #include <cmath>
0005 
0006 #include <Math/SVector.h>
0007 #include <Math/SMatrix.h>
0008 
0009 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
0010 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0011 #include "DataFormats/GeometryCommonDetAlgo/interface/GlobalError.h"
0012 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0013 
0014 class MagneticField;
0015 class GlobalTrajectoryParameters;
0016 class CurvilinearTrajectoryError;
0017 class FreeTrajectoryState;
0018 
0019 namespace reco {
0020 
0021   class GhostTrackPrediction {
0022   public:
0023     // z0, tIP, dz/dr, phi
0024 
0025     typedef ROOT::Math::SVector<double, 4> Vector;
0026     typedef ROOT::Math::SMatrix<double, 4, 4, ROOT::Math::MatRepSym<double, 4> > Error;
0027     typedef ROOT::Math::SMatrix<double, 6, 6, ROOT::Math::MatRepSym<double, 6> > CartesianError;
0028 
0029     GhostTrackPrediction() {}
0030     GhostTrackPrediction(const Vector &prediction, const Error &error) : prediction_(prediction), covariance_(error) {}
0031 
0032     GhostTrackPrediction(const GlobalPoint &priorPosition,
0033                          const GlobalError &priorError,
0034                          const GlobalVector &direction,
0035                          double coneRadius);
0036 
0037     GhostTrackPrediction(const GlobalPoint &priorPosition,
0038                          const GlobalError &priorError,
0039                          const GlobalVector &direction,
0040                          const GlobalError &directionError) {
0041       init(priorPosition, priorError, direction, directionError);
0042     }
0043 
0044     GhostTrackPrediction(const GlobalTrajectoryParameters &trajectory, const CurvilinearTrajectoryError &error);
0045 
0046     GhostTrackPrediction(const Track &track);
0047 
0048     double z() const { return prediction_[0]; }
0049     double ip() const { return prediction_[1]; }
0050     double cotTheta() const { return prediction_[2]; }
0051     double phi() const { return prediction_[3]; }
0052 
0053     double rho2() const { return cotTheta() * cotTheta() + 1.; }
0054     double rho() const { return std::sqrt(rho2()); }
0055     double sz() const { return z() / rho(); }
0056     double theta() const { return M_PI_2 - std::atan(cotTheta()); }
0057     double eta() const { return -std::log(rho() - cotTheta()); }
0058 
0059     const Vector &prediction() const { return prediction_; }
0060     const Error &covariance() const { return covariance_; }
0061 
0062     const GlobalPoint origin() const { return GlobalPoint(-std::sin(phi()) * ip(), std::cos(phi()) * ip(), z()); }
0063     const GlobalVector direction() const { return GlobalVector(std::cos(phi()), std::sin(phi()), cotTheta()); }
0064 
0065     double lambda(const GlobalPoint &point) const { return (point - origin()) * direction() / rho2(); }
0066 
0067     GlobalPoint position(double lambda = 0.) const { return origin() + lambda * direction(); }
0068     GlobalError positionError(double lambda = 0.) const;
0069 
0070     CartesianError cartesianError(double lambda = 0.) const;
0071 
0072     GlobalTrajectoryParameters globalTrajectory(const MagneticField *fieldProvider) const;
0073     CurvilinearTrajectoryError curvilinearError() const;
0074 
0075     FreeTrajectoryState fts(const MagneticField *fieldProvider) const;
0076 
0077     Track track(double ndof = 0., double chi2 = 0.) const;
0078 
0079   private:
0080     void init(const GlobalPoint &priorPosition,
0081               const GlobalError &priorError,
0082               const GlobalVector &direction,
0083               const GlobalError &directionError);
0084 
0085     Vector prediction_;
0086     Error covariance_;
0087   };
0088 
0089 }  // namespace reco
0090 #endif  // RecoBTag_GhostTrackPrediction_h