CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/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/DetLayers/interface/MeasurementEstimator.h>
00013 #include <TrackingTools/PatternTools/interface/TrajectoryMeasurement.h>
00014 
00015 
00016 #include "FWCore/Utilities/interface/Visibility.h"
00017 
00018 
00019 class TkGluedMeasurementDet GCC11_FINAL : 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 bool measurements( const TrajectoryStateOnSurface& stateOnThisDet,
00031                              const MeasurementEstimator& est,
00032                             TempMeasurements & result) const;
00033 
00034   const TkStripMeasurementDet* monoDet() const{ return theMonoDet;} 
00035   const TkStripMeasurementDet* stereoDet() const{ return theStereoDet;} 
00036 
00038   bool isActive() const {return monoDet()->isActive() && stereoDet()->isActive(); }
00039                  
00041   bool hasBadComponents( const TrajectoryStateOnSurface &tsos ) const {
00042     return (monoDet()->hasBadComponents(tsos) || stereoDet()->hasBadComponents(tsos));}
00043 
00044 private:
00045   const SiStripRecHitMatcher*       theMatcher;
00046   const StripClusterParameterEstimator* theCPE;
00047   const TkStripMeasurementDet*       theMonoDet;
00048   const TkStripMeasurementDet*       theStereoDet;
00049 
00050 
00051   template<typename Collector>
00052   void doubleMatch(const TrajectoryStateOnSurface& ts, Collector & collector) const  dso_internal;
00053 
00054   template<typename Collector>
00055   void collectRecHits(const TrajectoryStateOnSurface&, Collector &coll) const dso_internal;
00056 
00057   class dso_internal  HitCollectorForRecHits {
00058   public:
00059     typedef SiStripRecHitMatcher::Collector Collector;
00060     HitCollectorForRecHits(const GeomDet * geomDet, 
00061                            const SiStripRecHitMatcher * matcher,
00062                            const StripClusterParameterEstimator* cpe,
00063                            RecHitContainer & target) ;
00064     void add(SiStripMatchedRecHit2D const& hit) {
00065       target_.push_back(
00066                         TSiStripMatchedRecHit::build( geomDet_, std::auto_ptr<TrackingRecHit>(hit.clone()), 
00067                                                       matcher_,cpe_)
00068                         );
00069       hasNewHits_ = true; 
00070     }
00071     void addProjected(const TransientTrackingRecHit& hit,
00072                       const GlobalVector & gdir) ;
00073     SiStripRecHitMatcher::Collector & collector() { return collector_; }
00074     bool hasNewMatchedHits() const { return hasNewHits_;  }
00075     void clearNewMatchedHitsFlag() { hasNewHits_ = false; }
00076     static bool filter() { return false;}   
00077     size_t size() const { return target_.size();}
00078 
00079     static const MeasurementEstimator  & estimator() { static MeasurementEstimator * dummy=0; return *dummy;}
00080 
00081   private: 
00082     const GeomDet              * geomDet_;
00083     const SiStripRecHitMatcher * matcher_;
00084     const StripClusterParameterEstimator* cpe_;
00085     RecHitContainer       & target_;
00086     SiStripRecHitMatcher::Collector collector_;       
00087     bool hasNewHits_;
00088   };
00089 
00090 
00091   class dso_internal HitCollectorForFastMeasurements {
00092   public:
00093     typedef TransientTrackingRecHit::RecHitPointer RecHitPointer;
00094     typedef SiStripRecHitMatcher::Collector Collector;
00095     
00096     HitCollectorForFastMeasurements(const GeomDet * geomDet, 
00097                                     const SiStripRecHitMatcher * matcher,
00098                                     const StripClusterParameterEstimator* cpe,
00099                                     const TrajectoryStateOnSurface& stateOnThisDet,
00100                                     const MeasurementEstimator& est,
00101                                     TempMeasurements & target) ;
00102     void add(SiStripMatchedRecHit2D const& hit) ;
00103     void addProjected(const TransientTrackingRecHit& hit,
00104                       const GlobalVector & gdir) ;
00105     
00106     SiStripRecHitMatcher::Collector & collector() { return collector_; }
00107     bool hasNewMatchedHits() const { return hasNewHits_;  }
00108     void clearNewMatchedHitsFlag() { hasNewHits_ = false; }
00109     static bool filter() { return false;}   // if true mono-colection will been filter using the estimator before matching  
00110     size_t size() const { return target_.size();}
00111     const MeasurementEstimator  & estimator() { return est_;}
00112   private: 
00113     const GeomDet              * geomDet_;
00114     const SiStripRecHitMatcher * matcher_;
00115     const StripClusterParameterEstimator* cpe_;
00116     const TrajectoryStateOnSurface & stateOnThisDet_;
00117     const MeasurementEstimator     & est_;
00118     TempMeasurements & target_;
00119     SiStripRecHitMatcher::Collector collector_;       
00120     bool hasNewHits_;
00121   };
00122   
00123   
00124   RecHitContainer 
00125   projectOnGluedDet( const RecHitContainer& hits,
00126                      const TrajectoryStateOnSurface& ts) const dso_internal;
00127 
00128   template<typename HitCollector>
00129   void
00130   projectOnGluedDet( HitCollector & collector, 
00131                      const RecHitContainer& hits,
00132                      const GlobalVector & gdir ) const  dso_internal;
00133 
00134   void checkProjection(const TrajectoryStateOnSurface& ts, 
00135                        const RecHitContainer& monoHits, 
00136                        const RecHitContainer& stereoHits) const;
00137   void checkHitProjection(const TransientTrackingRecHit& hit,
00138                           const TrajectoryStateOnSurface& ts, 
00139                           const GeomDet& det) const dso_internal;
00140 
00142   bool testStrips(const TrajectoryStateOnSurface& tsos,
00143                   const BoundPlane &gluedPlane,
00144                   const TkStripMeasurementDet &mdet) const  dso_internal;
00145 
00146 };
00147 
00148 #endif