Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:34

0001 #ifndef _TRACKER_TRAJECTORYMEASUREMENT_H_
0002 #define _TRACKER_TRAJECTORYMEASUREMENT_H_
0003 
0004 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
0005 
0006 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
0007 #include <algorithm>
0008 
0009 class DetLayer;
0010 
0011 /** The TrajectoryMeasurement contains the full information about the
0012  *  measurement of a trajectory by a Det, namely <BR>
0013  *    - the TrackingRecHit <BR>
0014  *    - the predicted TrajectoryStateOnSurface from forward propagation (fitter)<BR>
0015  *    - the predicted TrajectoryStateOnSurface from backward propagation (smoother)<BR>
0016  *    - the (combination of the) predicted TrajectoryStateOnSurfaces updated with the TrackingRecHit information <BR>
0017  *    - the compatibility estimate between the TrackingRecHit and the predicted state. <BR>
0018  *
0019  *  A container of TrajectoryMeasurements is the result of querying a Det for
0020  *  measurements compatible with a TrajectoryState.
0021  *  A reconstructed track also consists of an ordered collection of 
0022  *  TrajectoryMeasurements.
0023  */
0024 
0025 class TrajectoryMeasurement {
0026 public:
0027   using RecHitPointer = TrackingRecHit::RecHitPointer;
0028   using ConstRecHitPointer = TrackingRecHit::ConstRecHitPointer;
0029 
0030   TrajectoryMeasurement() {}
0031 
0032   /// Constructor with forward predicted state, const TrackingRecHit*
0033   TrajectoryMeasurement(TrajectoryStateOnSurface fwdTrajectoryStateOnSurface, ConstRecHitPointer aRecHit)
0034       : theFwdPredictedState(fwdTrajectoryStateOnSurface),
0035         theUpdatedState(fwdTrajectoryStateOnSurface),
0036         theRecHit(aRecHit),
0037         theLayer(nullptr),
0038         theEstimate(0) {}
0039 
0040   /// Constructor with forward predicted state, RecHit, estimate
0041   TrajectoryMeasurement(TrajectoryStateOnSurface fwdTrajectoryStateOnSurface,
0042                         ConstRecHitPointer aRecHit,
0043                         float aEstimate)
0044       : theFwdPredictedState(fwdTrajectoryStateOnSurface),
0045         theUpdatedState(fwdTrajectoryStateOnSurface),
0046         theRecHit(aRecHit),
0047         theLayer(nullptr),
0048         theEstimate(aEstimate) {}
0049 
0050   TrajectoryMeasurement(TrajectoryStateOnSurface fwdTrajectoryStateOnSurface,
0051                         ConstRecHitPointer aRecHit,
0052                         float aEstimate,
0053                         const DetLayer* layer)
0054       : theFwdPredictedState(std::move(fwdTrajectoryStateOnSurface)),
0055         theUpdatedState(theFwdPredictedState),
0056         theRecHit(std::move(aRecHit)),
0057         theLayer(layer),
0058         theEstimate(aEstimate) {}
0059 
0060   /// Constructor with forward predicted & updated state, RecHit
0061   TrajectoryMeasurement(TrajectoryStateOnSurface fwdPredTrajectoryStateOnSurface,
0062                         TrajectoryStateOnSurface uTrajectoryStateOnSurface,
0063                         ConstRecHitPointer aRecHit)
0064       : theFwdPredictedState(std::move(fwdPredTrajectoryStateOnSurface)),
0065         theUpdatedState(std::move(uTrajectoryStateOnSurface)),
0066         theRecHit(std::move(aRecHit)),
0067         theLayer(nullptr),
0068         theEstimate(0) {}
0069 
0070   /// Constructor with forward predicted & updated state, RecHit, estimate
0071   TrajectoryMeasurement(TrajectoryStateOnSurface fwdPredTrajectoryStateOnSurface,
0072                         TrajectoryStateOnSurface uTrajectoryStateOnSurface,
0073                         ConstRecHitPointer aRecHit,
0074                         float aEstimate)
0075       : theFwdPredictedState(std::move(fwdPredTrajectoryStateOnSurface)),
0076         theUpdatedState(std::move(uTrajectoryStateOnSurface)),
0077         theRecHit(std::move(aRecHit)),
0078         theLayer(nullptr),
0079         theEstimate(aEstimate) {}
0080   TrajectoryMeasurement(TrajectoryStateOnSurface fwdPredTrajectoryStateOnSurface,
0081                         TrajectoryStateOnSurface uTrajectoryStateOnSurface,
0082                         ConstRecHitPointer aRecHit,
0083                         float aEstimate,
0084                         const DetLayer* layer)
0085       : theFwdPredictedState(std::move(fwdPredTrajectoryStateOnSurface)),
0086         theUpdatedState(std::move(uTrajectoryStateOnSurface)),
0087         theRecHit(std::move(aRecHit)),
0088         theLayer(layer),
0089         theEstimate(aEstimate) {}
0090   /** Constructor with forward predicted, backward predicted & updated state, 
0091    *  RecHit
0092    */
0093   TrajectoryMeasurement(TrajectoryStateOnSurface fwdPredTrajectoryStateOnSurface,
0094                         TrajectoryStateOnSurface bwdPredTrajectoryStateOnSurface,
0095                         TrajectoryStateOnSurface uTrajectoryStateOnSurface,
0096                         ConstRecHitPointer aRecHit)
0097       : theFwdPredictedState(fwdPredTrajectoryStateOnSurface),
0098         theBwdPredictedState(bwdPredTrajectoryStateOnSurface),
0099         theUpdatedState(uTrajectoryStateOnSurface),
0100         theRecHit(aRecHit),
0101         theLayer(nullptr),
0102         theEstimate(0) {}
0103 
0104   /** Constructor with forward predicted, backward predicted & updated state, 
0105    *  RecHit, estimate
0106    */
0107   TrajectoryMeasurement(TrajectoryStateOnSurface fwdPredTrajectoryStateOnSurface,
0108                         TrajectoryStateOnSurface bwdPredTrajectoryStateOnSurface,
0109                         TrajectoryStateOnSurface uTrajectoryStateOnSurface,
0110                         ConstRecHitPointer aRecHit,
0111                         float aEstimate)
0112       : theFwdPredictedState(fwdPredTrajectoryStateOnSurface),
0113         theBwdPredictedState(bwdPredTrajectoryStateOnSurface),
0114         theUpdatedState(uTrajectoryStateOnSurface),
0115         theRecHit(aRecHit),
0116         theLayer(nullptr),
0117         theEstimate(aEstimate) {}
0118 
0119   TrajectoryMeasurement(TrajectoryStateOnSurface fwdPredTrajectoryStateOnSurface,
0120                         TrajectoryStateOnSurface bwdPredTrajectoryStateOnSurface,
0121                         TrajectoryStateOnSurface uTrajectoryStateOnSurface,
0122                         ConstRecHitPointer aRecHit,
0123                         float aEstimate,
0124                         const DetLayer* layer)
0125       : theFwdPredictedState(fwdPredTrajectoryStateOnSurface),
0126         theBwdPredictedState(bwdPredTrajectoryStateOnSurface),
0127         theUpdatedState(uTrajectoryStateOnSurface),
0128         theRecHit(aRecHit),
0129         theLayer(layer),
0130         theEstimate(aEstimate) {}
0131 
0132   TrajectoryMeasurement(TrajectoryMeasurement const& rh)
0133       : theFwdPredictedState(rh.theFwdPredictedState),
0134         theBwdPredictedState(rh.theBwdPredictedState),
0135         theUpdatedState(rh.theUpdatedState),
0136         theRecHit(rh.theRecHit),
0137         theLayer(rh.theLayer),
0138         theEstimate(rh.theEstimate) {}
0139 
0140   TrajectoryMeasurement& operator=(TrajectoryMeasurement const& rh) {
0141     theFwdPredictedState = rh.theFwdPredictedState;
0142     theBwdPredictedState = rh.theBwdPredictedState;
0143     theUpdatedState = rh.theUpdatedState;
0144     theRecHit = rh.theRecHit;
0145     theEstimate = rh.theEstimate;
0146     theLayer = rh.theLayer;
0147 
0148     return *this;
0149   }
0150 
0151   TrajectoryMeasurement(TrajectoryMeasurement&& rh) noexcept
0152       : theFwdPredictedState(std::move(rh.theFwdPredictedState)),
0153         theBwdPredictedState(std::move(rh.theBwdPredictedState)),
0154         theUpdatedState(std::move(rh.theUpdatedState)),
0155         theRecHit(std::move(rh.theRecHit)),
0156         theLayer(rh.theLayer),
0157         theEstimate(rh.theEstimate) {}
0158 
0159   TrajectoryMeasurement& operator=(TrajectoryMeasurement&& rh) noexcept {
0160     using std::swap;
0161     swap(theFwdPredictedState, rh.theFwdPredictedState);
0162     swap(theBwdPredictedState, rh.theBwdPredictedState);
0163     swap(theUpdatedState, rh.theUpdatedState);
0164     swap(theRecHit, rh.theRecHit);
0165     theEstimate = rh.theEstimate;
0166     theLayer = rh.theLayer;
0167 
0168     return *this;
0169   }
0170 
0171   /** Access to forward predicted state (from fitter or builder).
0172    *  To be replaced by forwardPredictedState.
0173    */
0174   TrajectoryStateOnSurface const& predictedState() const { return theFwdPredictedState; }
0175 
0176   /// Access to forward predicted state (from fitter or builder)
0177   TrajectoryStateOnSurface const& forwardPredictedState() const { return theFwdPredictedState; }
0178   /// Access to backward predicted state (from smoother)
0179   TrajectoryStateOnSurface const& backwardPredictedState() const { return theBwdPredictedState; }
0180 
0181   /** Access to updated state (combination of forward predicted state
0182    *  and hit for fitter, + backward predicted state for smoother)
0183    */
0184   TrajectoryStateOnSurface const& updatedState() const { return theUpdatedState; }
0185 
0186   ConstRecHitPointer::element_type const& recHitR() const { return *theRecHit; }
0187 
0188   ConstRecHitPointer const& recHitP() const { return theRecHit; }
0189 
0190   ConstRecHitPointer const& recHit() const { return recHitP(); }
0191 
0192   float estimate() const { return theEstimate; }
0193 
0194   const DetLayer* layer() const { return theLayer; }
0195 
0196   // void setLayer( DetLayer const * il) const { theLayer=il;}
0197 
0198 private:
0199   TrajectoryStateOnSurface theFwdPredictedState;
0200   TrajectoryStateOnSurface theBwdPredictedState;
0201   TrajectoryStateOnSurface theUpdatedState;
0202   ConstRecHitPointer theRecHit;
0203   DetLayer const* theLayer;
0204   float theEstimate;
0205 };
0206 
0207 #endif