Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:52

0001 #ifndef TrackReco_TrackExtra_h
0002 #define TrackReco_TrackExtra_h
0003 /** \class reco::TrackExtra TrackExtra.h DataFormats/TrackReco/interface/TrackExtra.h

0004  *

0005  * Additional information about a reconstructed track. It is stored in RECO and supplements

0006  * the basic information stored in the Track class that is stored on AOD only.

0007  * If you wish to use information in the TrackExtra class, you should

0008  * access it via the reference supplied in the Track class.

0009  *

0010  * \author Luca Lista, INFN

0011  *

0012  *

0013  */
0014 #include <Rtypes.h>
0015 #include "DataFormats/Common/interface/RefToBase.h"
0016 #include "DataFormats/Math/interface/Vector3D.h"
0017 #include "DataFormats/Math/interface/Point3D.h"
0018 #include "DataFormats/Math/interface/Error.h"
0019 #include "DataFormats/TrackReco/interface/TrackExtraBase.h"
0020 #include "DataFormats/TrackReco/interface/TrackResiduals.h"
0021 #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
0022 #include "DataFormats/TrajectorySeed/interface/TrajectorySeed.h"
0023 #include "FWCore/Utilities/interface/thread_safety_macros.h"
0024 
0025 namespace reco {
0026   class TrackExtra : public TrackExtraBase {
0027   public:
0028     /// tracker parameter dimension

0029     enum { dimension = 5 };
0030     /// track error matrix size

0031     enum { covarianceSize = dimension * (dimension + 1) / 2 };
0032     /// point in the space

0033     typedef math::XYZPoint Point;
0034     /// spatial vector

0035     typedef math::XYZVector Vector;
0036     /// 5 parameter covariance matrix

0037     typedef math::Error<5>::type CovarianceMatrix;
0038     /// index type

0039     typedef unsigned int index;
0040 
0041     /// default constructor

0042     TrackExtra()
0043         : outerMomentum_(),
0044           outerOk_(false),
0045           outerDetId_(0),
0046           innerPosition_(),
0047           innerMomentum_(),
0048           innerOk_(false),
0049           innerDetId_(0),
0050           seedDir_(anyDirection),
0051           seedRef_() {
0052       for (index i = 0; i < covarianceSize; ++i) {
0053         outerCovariance_[i] = 0;
0054         innerCovariance_[i] = 0;
0055       }
0056     }
0057 
0058     /// constructor from outermost/innermost position and momentum and Seed information

0059     TrackExtra(const Point &outerPosition,
0060                const Vector &outerMomentum,
0061                bool ok,
0062                const Point &innerPosition,
0063                const Vector &innerMomentum,
0064                bool iok,
0065                const CovarianceMatrix &outerState,
0066                unsigned int outerId,
0067                const CovarianceMatrix &innerState,
0068                unsigned int innerId,
0069                PropagationDirection seedDir,
0070                edm::RefToBase<TrajectorySeed> seedRef = edm::RefToBase<TrajectorySeed>());
0071 
0072     /// outermost hit position

0073     const Point &outerPosition() const { return outerPosition_; }
0074     /// momentum vector at outermost hit position

0075     const Vector &outerMomentum() const { return outerMomentum_; }
0076     /// returns true if the outermost hit is valid

0077     bool outerOk() const { return outerOk_; }
0078     /// innermost hit position

0079     const Point &innerPosition() const { return innerPosition_; }
0080     /// momentum vector at innermost hit position

0081     const Vector &innerMomentum() const { return innerMomentum_; }
0082     /// returns true if the innermost hit is valid

0083     bool innerOk() const { return innerOk_; }
0084     /// x coordinate of momentum vector at the outermost hit position

0085     double outerPx() const { return outerMomentum_.X(); }
0086     /// y coordinate of momentum vector at the outermost hit position

0087     double outerPy() const { return outerMomentum_.Y(); }
0088     /// z coordinate of momentum vector at the outermost hit position

0089     double outerPz() const { return outerMomentum_.Z(); }
0090     /// x coordinate the outermost hit position

0091     double outerX() const { return outerPosition_.X(); }
0092     /// y coordinate the outermost hit position

0093     double outerY() const { return outerPosition_.Y(); }
0094     /// z coordinate the outermost hit position

0095     double outerZ() const { return outerPosition_.Z(); }
0096     /// magnitude of momentum vector at the outermost hit position

0097     double outerP() const { return outerMomentum().R(); }
0098     /// transverse momentum at the outermost hit position

0099     double outerPt() const { return outerMomentum().Rho(); }
0100     /// azimuthal angle of the  momentum vector at the outermost hit position

0101     double outerPhi() const { return outerMomentum().Phi(); }
0102     /// pseudorapidity the  momentum vector at the outermost hit position

0103     double outerEta() const { return outerMomentum().Eta(); }
0104     /// polar angle of the  momentum vector at the outermost hit position

0105     double outerTheta() const { return outerMomentum().Theta(); }
0106     /// polar radius of the outermost hit position

0107     double outerRadius() const { return outerPosition().Rho(); }
0108 
0109     /// outermost trajectory state curvilinear errors

0110     CovarianceMatrix outerStateCovariance() const;
0111     /// innermost trajectory state curvilinear errors

0112     CovarianceMatrix innerStateCovariance() const;
0113     /// fill outermost trajectory state curvilinear errors

0114     CovarianceMatrix &fillOuter CMS_THREAD_SAFE(CovarianceMatrix &v) const;
0115     /// fill outermost trajectory state curvilinear errors

0116     CovarianceMatrix &fillInner CMS_THREAD_SAFE(CovarianceMatrix &v) const;
0117     /// DetId of the detector on which surface the outermost state is located

0118     unsigned int outerDetId() const { return outerDetId_; }
0119     /// DetId of the detector on which surface the innermost state is located

0120     unsigned int innerDetId() const { return innerDetId_; }
0121     // direction how the hits were sorted in the original seed

0122     const PropagationDirection &seedDirection() const { return seedDir_; }
0123 
0124     /**  return the edm::reference to the trajectory seed in the original

0125      *   seeds collection. If the collection has been dropped from the

0126      *   Event, the reference may be invalid. Its validity should be tested,

0127      *   before the reference is actually used.

0128      */
0129     const edm::RefToBase<TrajectorySeed> &seedRef() const { return seedRef_; }
0130     void setSeedRef(const edm::RefToBase<TrajectorySeed> &r) { seedRef_ = r; }
0131     /// set the residuals

0132     void setResiduals(const TrackResiduals &r) { trackResiduals_ = r; }
0133 
0134     /// get the residuals

0135     const TrackResiduals &residuals() const { return trackResiduals_; }
0136 
0137   private:
0138     /// outermost hit position

0139     Point outerPosition_;
0140     /// momentum vector at outermost hit position

0141     Vector outerMomentum_;
0142     /// outermost hit validity flag

0143     bool outerOk_;
0144     /// outermost trajectory state curvilinear errors

0145     float outerCovariance_[covarianceSize];
0146     unsigned int outerDetId_;
0147 
0148     /// innermost hit position

0149     Point innerPosition_;
0150     /// momentum vector at innermost hit position

0151     Vector innerMomentum_;
0152     /// innermost hit validity flag

0153     bool innerOk_;
0154     /// innermost trajectory state

0155     float innerCovariance_[covarianceSize];
0156     unsigned int innerDetId_;
0157 
0158     PropagationDirection seedDir_;
0159     edm::RefToBase<TrajectorySeed> seedRef_;
0160 
0161     /// unbiased track residuals

0162     TrackResiduals trackResiduals_;
0163   };
0164 
0165 }  // namespace reco

0166 
0167 #endif