CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/RecoTracker/MeasurementDet/plugins/TkGluedMeasurementDet.h

Go to the documentation of this file.
00001 #ifndef TkGluedMeasurementDet_H
00002 #define TkGluedMeasurementDet_H
00003 
00004 #include "TrackingTools/MeasurementDet/interface/MeasurementDet.h"
00005 #include "TkStripMeasurementDet.h"
00006 
00007 class GluedGeomDet;
00008 //class SiStripRecHitMatcher;
00009 #include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripRecHitMatcher.h"
00010 #include "RecoTracker/TransientTrackingRecHit/interface/TSiStripMatchedRecHit.h"
00011 #include <TrackingTools/PatternTools/interface/MeasurementEstimator.h>
00012 #include <TrackingTools/PatternTools/interface/TrajectoryMeasurement.h>
00013 
00014 
00015 #include "FWCore/Utilities/interface/Visibility.h"
00016 
00017 
00018 class TkGluedMeasurementDet : public MeasurementDet {
00019 public:
00020 
00021   TkGluedMeasurementDet( const GluedGeomDet* gdet,const SiStripRecHitMatcher* matcher,
00022                          const MeasurementDet* monoDet,
00023                          const MeasurementDet* stereoDet);
00024 
00025   virtual RecHitContainer recHits( const TrajectoryStateOnSurface&) const;
00026 
00027   const GluedGeomDet& specificGeomDet() const {return *theGeomDet;}
00028 
00029   virtual std::vector<TrajectoryMeasurement> 
00030   fastMeasurements( const TrajectoryStateOnSurface& stateOnThisDet, 
00031                     const TrajectoryStateOnSurface& startingState, 
00032                     const Propagator&, 
00033                     const MeasurementEstimator&) const;
00034 
00035   const TkStripMeasurementDet* monoDet() const{ return theMonoDet;} 
00036   const TkStripMeasurementDet* stereoDet() const{ return theStereoDet;} 
00037 
00039   bool isActive() const {return monoDet()->isActive() && stereoDet()->isActive(); }
00040                  
00042   bool hasBadComponents( const TrajectoryStateOnSurface &tsos ) const {
00043     return (monoDet()->hasBadComponents(tsos) || stereoDet()->hasBadComponents(tsos));}
00044 
00045 private:
00046   const GluedGeomDet*         theGeomDet;
00047   const SiStripRecHitMatcher*       theMatcher;
00048   const TkStripMeasurementDet*       theMonoDet;
00049   const TkStripMeasurementDet*       theStereoDet;
00050 
00051 
00052   template<typename Collector>
00053   void doubleMatch(const TrajectoryStateOnSurface& ts, Collector & collector) const  dso_internal;
00054 
00055   template<typename Collector>
00056   void collectRecHits(const TrajectoryStateOnSurface&, Collector &coll) const dso_internal;
00057 
00058   class dso_internal  HitCollectorForRecHits {
00059   public:
00060     typedef SiStripRecHitMatcher::Collector Collector;
00061     HitCollectorForRecHits(const GeomDet * geomDet, 
00062                            const SiStripRecHitMatcher * matcher,
00063                            RecHitContainer & target) ;
00064     void add(SiStripMatchedRecHit2D const& hit) {
00065       target_.push_back(
00066                         TSiStripMatchedRecHit::build( geomDet_, std::auto_ptr<TrackingRecHit>(hit.clone()), matcher_)
00067                         );
00068       hasNewHits_ = true; 
00069     }
00070     void addProjected(const TransientTrackingRecHit& hit,
00071                       const GlobalVector & gdir) ;
00072     SiStripRecHitMatcher::Collector & collector() { return collector_; }
00073     bool hasNewMatchedHits() const { return hasNewHits_;  }
00074     void clearNewMatchedHitsFlag() { hasNewHits_ = false; }
00075   private: 
00076     const GeomDet              * geomDet_;
00077     const SiStripRecHitMatcher * matcher_;
00078     RecHitContainer       & target_;
00079     SiStripRecHitMatcher::Collector collector_;       
00080     bool hasNewHits_;
00081   };
00082 
00083 
00084   class dso_internal HitCollectorForFastMeasurements {
00085   public:
00086     typedef TransientTrackingRecHit::RecHitPointer RecHitPointer;
00087     typedef SiStripRecHitMatcher::Collector Collector;
00088     
00089     HitCollectorForFastMeasurements(const GeomDet * geomDet, 
00090                                     const SiStripRecHitMatcher * matcher,
00091                                     const TrajectoryStateOnSurface& stateOnThisDet,
00092                                     const MeasurementEstimator& est,
00093                                     std::vector<TrajectoryMeasurement> & target) ;
00094     void add(SiStripMatchedRecHit2D const& hit) ;
00095     void addProjected(const TransientTrackingRecHit& hit,
00096                       const GlobalVector & gdir) ;
00097     
00098     SiStripRecHitMatcher::Collector & collector() { return collector_; }
00099     bool hasNewMatchedHits() const { return hasNewHits_;  }
00100     void clearNewMatchedHitsFlag() { hasNewHits_ = false; }
00101   private: 
00102     const GeomDet              * geomDet_;
00103     const SiStripRecHitMatcher * matcher_;
00104     const TrajectoryStateOnSurface & stateOnThisDet_;
00105     const MeasurementEstimator     & est_;
00106     std::vector<TrajectoryMeasurement> & target_;
00107     SiStripRecHitMatcher::Collector collector_;       
00108     bool hasNewHits_;
00109   };
00110   
00111   
00112   RecHitContainer 
00113   projectOnGluedDet( const RecHitContainer& hits,
00114                      const TrajectoryStateOnSurface& ts) const dso_internal;
00115 
00116   template<typename HitCollector>
00117   void
00118   projectOnGluedDet( HitCollector & collector, 
00119                      const RecHitContainer& hits,
00120                      const GlobalVector & gdir ) const  dso_internal;
00121 
00122   void checkProjection(const TrajectoryStateOnSurface& ts, 
00123                        const RecHitContainer& monoHits, 
00124                        const RecHitContainer& stereoHits) const;
00125   void checkHitProjection(const TransientTrackingRecHit& hit,
00126                           const TrajectoryStateOnSurface& ts, 
00127                           const GeomDet& det) const dso_internal;
00128 
00130   bool testStrips(const TrajectoryStateOnSurface& tsos,
00131                   const BoundPlane &gluedPlane,
00132                   const TkStripMeasurementDet &mdet) const  dso_internal;
00133 
00134 };
00135 
00136 #endif