CMS 3D CMS Logo

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