Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:52

0001 #ifndef DataFormats_ParticleFlowReco_PFTrack_h
0002 #define DataFormats_ParticleFlowReco_PFTrack_h
0003 
0004 #include "DataFormats/ParticleFlowReco/interface/PFTrajectoryPoint.h"
0005 
0006 #include <iostream>
0007 #include <vector>
0008 
0009 namespace reco {
0010 
0011   /**\class PFTrack
0012      \brief  Base class for particle flow input reconstructed tracks
0013      and simulated particles.
0014      
0015      A PFTrack contains a vector of PFTrajectoryPoint objects. 
0016      These points are stored in a vector to benefit from the 
0017      random access. One must take care of storing the points in 
0018      the right order, and it might even be necessary to insert dummy points.
0019 
0020      For a PFRecTrack, the ordering of the points is the following:
0021      
0022      - point 1: Closest approach
0023 
0024      - point 2: Beam Pipe
0025 
0026      - point 3 to n: Trajectory measurements (from the tracker layers)
0027 
0028      - point n+1: Preshower Layer 1, or dummy point if 
0029      not in the preshower zone
0030      
0031      - point n+2: Preshower Layer 2, or dummy point if 
0032      not in the preshower zone
0033 
0034      - point n+3: ECAL Entrance
0035 
0036      - point n+4: ECAL expected position of the shower maximum, 
0037      assuming the track is an electron track.
0038      
0039      - point n+5: HCAL Entrance
0040 
0041      For a PFSimParticle, the ordering of the points is the following.
0042      
0043      - If the particle decays before ECAL:
0044      - point 1: start point
0045      - point 2: end point 
0046 
0047      - If the particle does not decay before ECAL:
0048      - point 1: start point
0049      - point 2: PS1 or dummy
0050      - point 3: PS2 or dummy
0051      - point 4: ECAL entrance
0052      - point 5: HCAL entrance
0053      
0054 
0055      \todo Note that some points are missing, and should be added: shower max,
0056      intersection with the tracker layers maybe. 
0057      
0058      PFRecTracks and PFSimParticles are created in the PFTrackProducer module. 
0059      \todo   Make this class abstract ? 
0060      \author Renaud Bruneliere
0061      \date   July 2006
0062   */
0063   class PFTrack {
0064   public:
0065     PFTrack();
0066 
0067     PFTrack(double charge);
0068 
0069     PFTrack(const PFTrack& other);
0070 
0071     PFTrack& operator=(const PFTrack& other) = default;
0072 
0073     /// add a trajectory measurement
0074     /// \todo throw an exception if the number of points is too large
0075     void addPoint(const reco::PFTrajectoryPoint& trajPt);
0076 
0077     /// set a trajectory point
0078     void setPoint(unsigned int index, const reco::PFTrajectoryPoint& measurement) {
0079       trajectoryPoints_[index] = measurement;
0080     }
0081 
0082     /// \return electric charge
0083     double charge() const { return charge_; }
0084 
0085     /// \return number of trajectory points
0086     unsigned int nTrajectoryPoints() const { return trajectoryPoints_.size(); }
0087 
0088     /// \return number of trajectory measurements in tracker
0089     unsigned int nTrajectoryMeasurements() const {
0090       return (indexOutermost_ ? indexOutermost_ - indexInnermost_ + 1 : 0);
0091     }
0092 
0093     /// \return vector of trajectory points
0094     const std::vector<reco::PFTrajectoryPoint>& trajectoryPoints() const { return trajectoryPoints_; }
0095 
0096     /// \return a trajectory point
0097     const reco::PFTrajectoryPoint& trajectoryPoint(unsigned index) const { return trajectoryPoints_[index]; }
0098 
0099     /// \return an extrapolated point
0100     /// \todo throw an exception in case of invalid point.
0101     const reco::PFTrajectoryPoint& extrapolatedPoint(unsigned layerid) const;
0102 
0103     /// iterator on innermost tracker measurement
0104     std::vector<reco::PFTrajectoryPoint>::const_iterator innermostMeasurement() const {
0105       return trajectoryPoints_.begin() + indexInnermost_;
0106     }
0107 
0108     /// iterator on outermost tracker measurement
0109     std::vector<reco::PFTrajectoryPoint>::const_iterator outermostMeasurement() const {
0110       return trajectoryPoints_.begin() + indexOutermost_;
0111     }
0112 
0113   protected:
0114     /// maximal number of tracking layers
0115     static const unsigned int nMaxTrackingLayers_;
0116 
0117     /// charge
0118     double charge_;
0119 
0120     /// vector of trajectory points
0121     std::vector<reco::PFTrajectoryPoint> trajectoryPoints_;
0122 
0123     /// index innermost tracker measurement
0124     unsigned int indexInnermost_;
0125 
0126     /// index outermost tracker measurement
0127     unsigned int indexOutermost_;
0128   };
0129   std::ostream& operator<<(std::ostream& out, const PFTrack& track);
0130 
0131 }  // namespace reco
0132 
0133 #endif