Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:36

0001 #ifndef MultiTrajectoryStateTransform_H
0002 #define MultiTrajectoryStateTransform_H
0003 
0004 /** Extracts innermost and  outermost states from a GsfTrack
0005  *  in form of a TrajectoryStateOnSurface */
0006 
0007 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
0008 #include "DataFormats/GsfTrackReco/interface/GsfTrackExtra.h"
0009 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0010 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
0011 
0012 class TrajectoryStateOnSurface;
0013 class TrackingGeometry;
0014 class Surface;
0015 class MagneticField;
0016 class TransverseImpactPointExtrapolator;
0017 
0018 class MultiTrajectoryStateTransform {
0019 private:
0020   typedef reco::GsfTrackExtra::LocalParameterVector ParameterVector;
0021   typedef reco::GsfTrackExtra::LocalCovarianceMatrix CovarianceMatrix;
0022   enum { dimension = reco::GsfTrackExtra::dimension };
0023 
0024 public:
0025   /** Default constructor (deprecated) -> ES components have to be passed explicitely */
0026   MultiTrajectoryStateTransform() : geometry_(nullptr), field_(nullptr), extrapolator_(nullptr) {}
0027   /** Constructor from geometry and magnetic field */
0028   MultiTrajectoryStateTransform(const TrackingGeometry* geom, const MagneticField* field)
0029       : geometry_(geom), field_(field), extrapolator_(nullptr) {}
0030   /** Destructor */
0031   ~MultiTrajectoryStateTransform();
0032 
0033   /** TrajectoryStateOnSurface from the innermost state of a reco::GsfTrack */
0034   TrajectoryStateOnSurface innerStateOnSurface(const reco::GsfTrack& tk) const;
0035   /** TrajectoryStateOnSurface from the outermost state of a reco::GsfTrack */
0036   TrajectoryStateOnSurface outerStateOnSurface(const reco::GsfTrack& tk) const;
0037 
0038   /** Momentum vector from mode corresponding to the innermost state. 
0039    *  Returns true for success. */
0040   bool innerMomentumFromMode(const reco::GsfTrack& tk, GlobalVector& momentum) const;
0041   /** Momentum vector from mode corresponding to the outermost state */
0042   bool outerMomentumFromMode(const reco::GsfTrack& tk, GlobalVector& momentum) const;
0043 
0044   /** Extrapolation to a point using the TransverseImpactPointExtrapolator */
0045   TrajectoryStateOnSurface extrapolatedState(const TrajectoryStateOnSurface tsos, const GlobalPoint& point) const;
0046 
0047   /** TrajectoryStateOnSurface from the innermost state of a reco::GsfTrack 
0048    *  passing geometry and magnetic field (deprecated: use field from constructor) */
0049   static TrajectoryStateOnSurface innerStateOnSurface(const reco::GsfTrack& tk,
0050                                                       const TrackingGeometry& geom,
0051                                                       const MagneticField* field);
0052   /** TrajectoryStateOnSurface from the outermost state of a reco::GsfTrack 
0053    *  passing geometry and magnetic field (deprecated: use field from constructor) */
0054   static TrajectoryStateOnSurface outerStateOnSurface(const reco::GsfTrack& tk,
0055                                                       const TrackingGeometry& geom,
0056                                                       const MagneticField* field);
0057 
0058 private:
0059   /** TSOS from a mixture in local parameters */
0060   static TrajectoryStateOnSurface stateOnSurface(const std::vector<double>& weights,
0061                                                  const std::vector<ParameterVector>& parameters,
0062                                                  const std::vector<CovarianceMatrix>& covariances,
0063                                                  const double& pzSign,
0064                                                  const Surface& surface,
0065                                                  const MagneticField* field);
0066   /** On-demand creation of a TransverseImpactPointExtrapolator */
0067   bool checkExtrapolator() const;
0068   /** Verification of the presence of geometry and field */
0069   bool checkGeometry() const;
0070 
0071 private:
0072   const TrackingGeometry* geometry_;
0073   const MagneticField* field_;
0074   mutable TransverseImpactPointExtrapolator* extrapolator_;
0075 };
0076 
0077 #endif