Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef MeasurementDetWithData_H
0002 #define MeasurementDetWithData_H
0003 
0004 #include "TrackingTools/MeasurementDet/interface/MeasurementDet.h"
0005 
0006 class MeasurementDetWithData {
0007 public:
0008   MeasurementDetWithData() : det_(nullptr), data_(nullptr) {}
0009 
0010   MeasurementDetWithData(const MeasurementDet& det, const MeasurementTrackerEvent& data) : det_(&det), data_(&data) {}
0011 
0012   bool isValid() const { return det_ != nullptr; }
0013   bool isNull() const { return det_ == nullptr; }
0014 
0015   const MeasurementDet& mdet() const { return *det_; }
0016 
0017   // duplicate interface of MeasurementDet
0018   typedef MeasurementDet::TempMeasurements TempMeasurements;
0019   typedef MeasurementDet::RecHitContainer RecHitContainer;
0020 
0021   using SimpleHitContainer = MeasurementDet::SimpleHitContainer;
0022 
0023   RecHitContainer recHits(const TrajectoryStateOnSurface& tsos) const { return mdet().recHits(tsos, data()); }
0024 
0025   // use a MeasurementEstimator to filter the hits (same algo as below..)
0026   // default as above
0027   bool recHits(const TrajectoryStateOnSurface& stateOnThisDet,
0028                const MeasurementEstimator& me,
0029                RecHitContainer& result,
0030                std::vector<float>& out) const {
0031     return mdet().recHits(stateOnThisDet, me, data(), result, out);
0032   }
0033 
0034   bool recHits(SimpleHitContainer& result,
0035                const TrajectoryStateOnSurface& stateOnThisDet,
0036                const MeasurementEstimator& me) const {
0037     return mdet().recHits(result, stateOnThisDet, me, data());
0038   }
0039 
0040   /** obsolete version in case the TrajectoryState on the surface of the
0041    *  Det is already available. The first TrajectoryStateOnSurface is on the surface of this 
0042    *  Det, and the second TrajectoryStateOnSurface is not used, as the propagator...
0043    * The stateOnThisDet should the result of <BR>
0044    *  prop.propagate( startingState, this->surface())
0045    */
0046   std::vector<TrajectoryMeasurement> fastMeasurements(const TrajectoryStateOnSurface& stateOnThisDet,
0047                                                       const TrajectoryStateOnSurface& tsos2,
0048                                                       const Propagator& prop,
0049                                                       const MeasurementEstimator& est) const {
0050     return mdet().fastMeasurements(stateOnThisDet, tsos2, prop, est, data());
0051   }
0052 
0053   // return false if missing (if inactive is true and one hit)
0054   bool measurements(const TrajectoryStateOnSurface& stateOnThisDet,
0055                     const MeasurementEstimator& est,
0056                     TempMeasurements& result) const {
0057     return mdet().measurements(stateOnThisDet, est, data(), result);
0058   }
0059 
0060   // forward methods which don't actually depend on data
0061   const GeomDet& fastGeomDet() const { return mdet().fastGeomDet(); }
0062   const GeomDet& geomDet() const { return mdet().geomDet(); }
0063   const Surface& surface() const { return mdet().geomDet().surface(); }
0064   const Surface::PositionType& position() const { return mdet().geomDet().position(); }
0065 
0066   // these instead potentially depend on the data
0067   bool isActive() const { return mdet().isActive(data()); }
0068   bool hasBadComponents(const TrajectoryStateOnSurface& tsos) const { return mdet().hasBadComponents(tsos, data()); }
0069 
0070 private:
0071   const MeasurementTrackerEvent& data() const { return *data_; }
0072   const MeasurementDet* det_;
0073   const MeasurementTrackerEvent* data_;
0074 };
0075 
0076 #endif