Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /****************************************************************************
0002  * Authors:
0003  *   Jan Kašpar
0004  *   Laurent Forthomme
0005  ****************************************************************************/
0006 
0007 #ifndef DataFormats_ProtonReco_ForwardProton_h
0008 #define DataFormats_ProtonReco_ForwardProton_h
0009 
0010 #include "DataFormats/Math/interface/Error.h"
0011 #include "DataFormats/Math/interface/Point3D.h"
0012 #include "DataFormats/Math/interface/Vector3D.h"
0013 
0014 #include "DataFormats/Common/interface/RefVector.h"
0015 
0016 #include "DataFormats/CTPPSReco/interface/CTPPSLocalTrackLiteFwd.h"
0017 
0018 namespace reco {
0019   class ForwardProton {
0020   public:
0021     /// parameter dimension
0022     enum { dimension = 5 };
0023     /// indices to the covariance matrix
0024     enum struct Index { xi, th_x, vtx_x, th_y, vtx_y, num_indices = dimension };
0025     /// dimension-parameter covariance matrix
0026     typedef math::ErrorF<dimension>::type CovarianceMatrix;
0027     /// spatial vector
0028     typedef math::XYZVectorF Vector;
0029     /// point in the space
0030     typedef math::XYZPointF Point;
0031     /// type of reconstruction applied for this track
0032     enum class ReconstructionMethod { invalid = -1, singleRP, multiRP };
0033 
0034   public:
0035     /// default constructor
0036     ForwardProton();
0037     /// constructor from refit parameters, fitted vertex and momentum, and longitudinal fractional momentum loss
0038     ForwardProton(double chi2,
0039                   double ndof,
0040                   const Point& vtx,
0041                   const Vector& momentum,
0042                   float xi,
0043                   const CovarianceMatrix& cov,
0044                   ReconstructionMethod method,
0045                   const CTPPSLocalTrackLiteRefVector& local_tracks,
0046                   bool valid,
0047                   const float time = 0.,
0048                   const float time_err = 0.);
0049 
0050     /// fitted vertex position
0051     const Point& vertex() const { return vertex_; }
0052     /// fitted vertex horizontal position
0053     float vx() const { return vertex_.x(); }
0054     /// fitted vertex vertical position
0055     float vy() const { return vertex_.y(); }
0056     /// vertex longitudinal position (conventionally set to 0)
0057     float vz() const { return vertex_.z(); }
0058     /// fitted track direction
0059     const Vector& momentum() const { return momentum_; }
0060     /// scalar norm of fitted track momentum
0061     float p() const { return momentum_.r(); }
0062     /// scalar fitted track transverse momentum
0063     float pt() const { return momentum_.rho(); }
0064     /// fitted track momentum horizontal component
0065     float px() const { return momentum_.x(); }
0066     /// fitted track momentum vertical component
0067     float py() const { return momentum_.y(); }
0068     /// fitted track momentum longitudinal component
0069     float pz() const { return momentum_.z(); }
0070 
0071     /// chi-squared of the fit
0072     float chi2() const { return chi2_; }
0073     /// number of degrees of freedom for the track fit
0074     unsigned int ndof() const { return ndof_; }
0075     /// chi-squared divided by ndof (or chi-squared * 1e6 if ndof is zero)
0076     float normalizedChi2() const { return (ndof_ != 0) ? chi2_ / ndof_ : chi2_ * 1.e6; }
0077 
0078     /// longitudinal fractional momentum loss
0079     float xi() const { return xi_; }
0080     /// vertical scattering angle, in rad
0081     float thetaX() const { return px() / p(); }
0082     /// horizontal scattering angle, in rad
0083     float thetaY() const { return py() / p(); }
0084 
0085     // vertex position can be obtained via TrackBase::vx() and vy() functions
0086 
0087     /// return the uncertainty on a given component
0088     double error(Index i) const { return sqrt(covariance_((unsigned int)i, (unsigned int)i)); }
0089 
0090     /// uncertainty on longitudinal fractional momentum loss
0091     float xiError() const { return error(Index::xi); }
0092     /// uncertainty on fitted momentum horizontal angle opening
0093     float thetaXError() const { return error(Index::th_x); }
0094     /// uncertainty on fitted momentum vertical angle opening
0095     float thetaYError() const { return error(Index::th_y); }
0096     /// uncertainty on fitted vertex horizontal position
0097     float vxError() const { return error(Index::vtx_x); }
0098     /// uncertainty on fitted vertex vertical position
0099     float vyError() const { return error(Index::vtx_y); }
0100 
0101     /// proton mass in GeV
0102     static float mass() { return mass_; }
0103 
0104     /// compute the squared four-momentum transfer from incident and scattered momenta, and angular information
0105     static float calculateT(double beam_mom, double proton_mom, double theta);
0106 
0107     /// four-momentum transfer squared, in GeV^2
0108     float t() const;
0109 
0110     /// time of proton arrival at forward stations
0111     float time() const { return time_; }
0112     void setTime(float time) { time_ = time; }
0113 
0114     /// uncertainty on time of proton arrival at forward stations
0115     float timeError() const { return time_err_; }
0116     void setTimeError(float time_err) { time_err_ = time_err; }
0117 
0118     /// set the flag for the fit validity
0119     void setValidFit(bool valid = true) { valid_fit_ = valid; }
0120     /// flag for the fit validity
0121     bool validFit() const { return valid_fit_; }
0122 
0123     /// set the reconstruction method for this track
0124     void setMethod(const ReconstructionMethod& method) { method_ = method; }
0125     /// reconstruction method for this track
0126     ReconstructionMethod method() const { return method_; }
0127 
0128     /// store the list of RP tracks that contributed to this global track
0129     void setContributingLocalTracks(const CTPPSLocalTrackLiteRefVector& v) { contributing_local_tracks_ = v; }
0130     /// list of RP tracks that contributed to this global track
0131     const CTPPSLocalTrackLiteRefVector& contributingLocalTracks() const { return contributing_local_tracks_; }
0132 
0133     /// LHC sector
0134     enum class LHCSector { invalid = -1, sector45, sector56 };
0135     LHCSector lhcSector() const {
0136       if (pz() < 0.)
0137         return LHCSector::sector56;
0138       if (pz() > 0.)
0139         return LHCSector::sector45;
0140       return LHCSector::invalid;
0141     }
0142 
0143   private:
0144     static constexpr float mass_ = 0.938272046;        ///< proton mass, GeV
0145     static constexpr float massSquared_ = 0.88035443;  ///< proton mass squared, GeV^2
0146 
0147     /// reconstructed vertex position at z/s = 0
0148     Point vertex_;
0149     /// reconstructed momentum vector
0150     Vector momentum_;
0151     /// reconstructed time at forward detectors
0152     float time_;
0153     /// uncertainty on reconstructed time at forward detectors
0154     float time_err_;
0155     /// fractional momentum loss (positive for diffractive protons)
0156     float xi_;
0157     /// 5x5 covariance matrix
0158     CovarianceMatrix covariance_;
0159     /// chi-squared
0160     float chi2_;
0161     /// number of degrees of freedom
0162     unsigned int ndof_;
0163     /// fit validity flag
0164     bool valid_fit_;
0165     /// type of reconstruction applied
0166     ReconstructionMethod method_;
0167     /// collection of references to tracks contributing to this object definition
0168     CTPPSLocalTrackLiteRefVector contributing_local_tracks_;
0169   };
0170 }  // namespace reco
0171 
0172 #endif