CMS 3D CMS Logo

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