Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:11

0001 #ifndef TkGluedMeasurementDet_H
0002 #define TkGluedMeasurementDet_H
0003 
0004 #include "TrackingTools/MeasurementDet/interface/MeasurementDet.h"
0005 #include "TkStripMeasurementDet.h"
0006 
0007 class GluedGeomDet;
0008 //class SiStripRecHitMatcher;
0009 #include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripRecHitMatcher.h"
0010 #include "RecoLocalTracker/ClusterParameterEstimator/interface/StripClusterParameterEstimator.h"
0011 #include "RecoTracker/TransientTrackingRecHit/interface/TSiStripMatchedRecHit.h"
0012 #include <TrackingTools/DetLayers/interface/MeasurementEstimator.h>
0013 #include <TrackingTools/PatternTools/interface/TrajectoryMeasurement.h>
0014 
0015 #include "FWCore/Utilities/interface/Visibility.h"
0016 
0017 class dso_hidden TkGluedMeasurementDet final : public MeasurementDet {
0018 public:
0019   TkGluedMeasurementDet(const GluedGeomDet* gdet,
0020                         const SiStripRecHitMatcher* matcher,
0021                         const StripClusterParameterEstimator* cpe);
0022   void init(const MeasurementDet* monoDet, const MeasurementDet* stereoDet, const TrackerTopology* tTopo);
0023 
0024   RecHitContainer recHits(const TrajectoryStateOnSurface&, const MeasurementTrackerEvent& data) const override;
0025 
0026   // simple hits
0027   bool recHits(SimpleHitContainer& result,
0028                const TrajectoryStateOnSurface& stateOnThisDet,
0029                const MeasurementEstimator&,
0030                const MeasurementTrackerEvent& data) const override;
0031 
0032   const GluedGeomDet& specificGeomDet() const { return static_cast<GluedGeomDet const&>(fastGeomDet()); }
0033 
0034   bool measurements(const TrajectoryStateOnSurface& stateOnThisDet,
0035                     const MeasurementEstimator& est,
0036                     const MeasurementTrackerEvent& data,
0037                     TempMeasurements& result) const override;
0038 
0039   const TkStripMeasurementDet* monoDet() const { return theMonoDet; }
0040   const TkStripMeasurementDet* stereoDet() const { return theStereoDet; }
0041 
0042   unsigned int rawId() const { return fastGeomDet().geographicalId(); }
0043 
0044   /// return TRUE if both mono and stereo components are active
0045   bool isActive(const MeasurementTrackerEvent& data) const override {
0046     return monoDet()->isActive(data) && stereoDet()->isActive(data);
0047   }
0048 
0049   /// return TRUE if at least one of the mono and stereo components has badChannels
0050   bool hasBadComponents(const TrajectoryStateOnSurface& tsos, const MeasurementTrackerEvent& data) const override {
0051     return (monoDet()->hasBadComponents(tsos, data) || stereoDet()->hasBadComponents(tsos, data));
0052   }
0053 
0054 private:
0055   const SiStripRecHitMatcher* theMatcher;
0056   const StripClusterParameterEstimator* theCPE;
0057   const TkStripMeasurementDet* theMonoDet;
0058   const TkStripMeasurementDet* theStereoDet;
0059   const TrackerTopology* theTopology;
0060 
0061   template <typename Collector>
0062   void doubleMatch(const TrajectoryStateOnSurface& ts,
0063                    const MeasurementTrackerEvent& data,
0064                    Collector& collector) const dso_internal;
0065 
0066   template <typename Collector>
0067   void collectRecHits(const TrajectoryStateOnSurface&,
0068                       const MeasurementTrackerEvent& data,
0069                       Collector& coll) const dso_internal;
0070 
0071   // for TTRH
0072   class dso_internal HitCollectorForRecHits {
0073   public:
0074     typedef SiStripRecHitMatcher::Collector Collector;
0075     HitCollectorForRecHits(const GeomDet* geomDet,
0076                            const SiStripRecHitMatcher* matcher,
0077                            const StripClusterParameterEstimator* cpe,
0078                            RecHitContainer& target);
0079     void add(SiStripMatchedRecHit2D const& hit) {
0080       target_.emplace_back(hit.cloneSH());
0081       hasNewHits_ = true;
0082     }
0083     void addProjected(const TrackingRecHit& hit, const GlobalVector& gdir);
0084     SiStripRecHitMatcher::Collector& collector() { return collector_; }
0085     bool hasNewMatchedHits() const { return hasNewHits_; }
0086     void clearNewMatchedHitsFlag() { hasNewHits_ = false; }
0087     static bool filter() { return false; }  /// always fast as no estimator available here!
0088     size_t size() const { return target_.size(); }
0089 
0090     static const MeasurementEstimator& estimator() {
0091       static const MeasurementEstimator* dummy = nullptr;
0092       return *dummy;
0093     }
0094 
0095   private:
0096     const GeomDet* geomDet_;
0097     const SiStripRecHitMatcher* matcher_;
0098     const StripClusterParameterEstimator* cpe_;
0099     RecHitContainer& target_;
0100     SiStripRecHitMatcher::Collector collector_;
0101     bool hasNewHits_;
0102   };
0103 
0104   // for TRH
0105   class dso_internal HitCollectorForSimpleHits {
0106   public:
0107     typedef SiStripRecHitMatcher::Collector Collector;
0108     HitCollectorForSimpleHits(const GeomDet* geomDet,
0109                               const SiStripRecHitMatcher* matcher,
0110                               const StripClusterParameterEstimator* cpe,
0111                               const TrajectoryStateOnSurface& stateOnThisDet,
0112                               const MeasurementEstimator& est,
0113                               SimpleHitContainer& target);
0114     void add(SiStripMatchedRecHit2D const& hit);
0115     void addProjected(const TrackingRecHit& hit, const GlobalVector& gdir);
0116     SiStripRecHitMatcher::Collector& collector() { return collector_; }
0117     bool hasNewMatchedHits() const { return hasNewHits_; }
0118     void clearNewMatchedHitsFlag() { hasNewHits_ = false; }
0119     bool filter() const {
0120       return matcher_->preFilter();
0121     }  // if true mono-colection will been filter using the estimator before matching
0122     size_t size() const { return target_.size(); }
0123     const MeasurementEstimator& estimator() { return est_; }
0124 
0125   private:
0126     const GeomDet* geomDet_;
0127     const SiStripRecHitMatcher* matcher_;
0128     const StripClusterParameterEstimator* cpe_;
0129     const TrajectoryStateOnSurface& stateOnThisDet_;
0130     const MeasurementEstimator& est_;
0131     SimpleHitContainer& target_;
0132     SiStripRecHitMatcher::Collector collector_;
0133     bool hasNewHits_;
0134   };
0135 
0136   class dso_internal HitCollectorForFastMeasurements {
0137   public:
0138     typedef TransientTrackingRecHit::RecHitPointer RecHitPointer;
0139     typedef SiStripRecHitMatcher::Collector Collector;
0140 
0141     HitCollectorForFastMeasurements(const GeomDet* geomDet,
0142                                     const SiStripRecHitMatcher* matcher,
0143                                     const StripClusterParameterEstimator* cpe,
0144                                     const TrajectoryStateOnSurface& stateOnThisDet,
0145                                     const MeasurementEstimator& est,
0146                                     TempMeasurements& target);
0147     void add(SiStripMatchedRecHit2D const& hit);
0148     void addProjected(const TrackingRecHit& hit, const GlobalVector& gdir);
0149 
0150     SiStripRecHitMatcher::Collector& collector() { return collector_; }
0151     bool hasNewMatchedHits() const { return hasNewHits_; }
0152     void clearNewMatchedHitsFlag() { hasNewHits_ = false; }
0153     bool filter() const {
0154       return matcher_->preFilter();
0155     }  // if true mono-colection will been filter using the estimator before matching
0156     size_t size() const { return target_.size(); }
0157     const MeasurementEstimator& estimator() { return est_; }
0158 
0159   private:
0160     const GeomDet* geomDet_;
0161     const SiStripRecHitMatcher* matcher_;
0162     const StripClusterParameterEstimator* cpe_;
0163     const TrajectoryStateOnSurface& stateOnThisDet_;
0164     const MeasurementEstimator& est_;
0165     TempMeasurements& target_;
0166     SiStripRecHitMatcher::Collector collector_;
0167     bool hasNewHits_;
0168   };
0169 
0170   RecHitContainer projectOnGluedDet(const std::vector<SiStripRecHit2D>& hits,
0171                                     const TrajectoryStateOnSurface& ts) const dso_internal;
0172   template <typename HitCollector>
0173   void projectOnGluedDet(HitCollector& collector,
0174                          const std::vector<SiStripRecHit2D>& hits,
0175                          const GlobalVector& gdir) const dso_internal;
0176 
0177   RecHitContainer projectOnGluedDet(const RecHitContainer& hits, const TrajectoryStateOnSurface& ts) const dso_internal;
0178   template <typename HitCollector>
0179   void projectOnGluedDet(HitCollector& collector,
0180                          const RecHitContainer& hits,
0181                          const GlobalVector& gdir) const dso_internal;
0182 
0183   void checkProjection(const TrajectoryStateOnSurface& ts,
0184                        const RecHitContainer& monoHits,
0185                        const RecHitContainer& stereoHits) const;
0186   void checkHitProjection(const TrackingRecHit& hit,
0187                           const TrajectoryStateOnSurface& ts,
0188                           const GeomDet& det) const dso_internal;
0189 
0190   /** \brief Test the strips on one of the two dets with projection */
0191   bool testStrips(const TrajectoryStateOnSurface& tsos,
0192                   const BoundPlane& gluedPlane,
0193                   const TkStripMeasurementDet& mdet) const dso_internal;
0194 };
0195 
0196 #endif