CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h

Go to the documentation of this file.
00001 #ifndef SiStripMatchedRecHit2D_H
00002 #define SiStripMatchedRecHit2D_H
00003 
00004 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h"
00005 
00006 class SiStripMatchedRecHit2D GCC11_FINAL : public BaseTrackerRecHit {
00007  public:
00008   typedef BaseTrackerRecHit Base;
00009 
00010   SiStripMatchedRecHit2D(){}
00011   ~SiStripMatchedRecHit2D(){}
00012 
00013   SiStripMatchedRecHit2D( const LocalPoint& pos, const LocalError& err, const DetId& id , 
00014                           const SiStripRecHit2D* rMono,const SiStripRecHit2D* rStereo):
00015     BaseTrackerRecHit(pos, err, id, trackerHitRTTI::match), clusterMono_(rMono->omniClusterRef()), clusterStereo_(rStereo->omniClusterRef()){}
00016 
00017   // by value, as they will not exists anymore...
00018   SiStripRecHit2D  stereoHit() const { return SiStripRecHit2D(stereoId(),stereoClusterRef()) ;}
00019   SiStripRecHit2D  monoHit() const { return SiStripRecHit2D(monoId(),monoClusterRef());}
00020  
00021   unsigned int stereoId() const { return rawId()+1;}
00022   unsigned int monoId()   const { return rawId()+2;}
00023 
00024   // (to be improved)
00025   virtual OmniClusterRef const & firstClusterRef() const { return monoClusterRef();}
00026 
00027 
00028   OmniClusterRef const & stereoClusterRef() const { return clusterStereo_;}
00029   OmniClusterRef const & monoClusterRef() const { return clusterMono_;}
00030   // Non const variants needed for cluster re-keying 
00031   OmniClusterRef & stereoClusterRef()  { return clusterStereo_;}
00032   OmniClusterRef  & monoClusterRef()  { return clusterMono_;}
00033   
00034   SiStripCluster const & stereoCluster() const { 
00035     return stereoClusterRef().stripCluster();
00036   }  
00037   SiStripCluster const & monoCluster() const { 
00038     return monoClusterRef().stripCluster();
00039   }  
00040 
00041 
00042   virtual SiStripMatchedRecHit2D * clone() const {return new SiStripMatchedRecHit2D( * this);}
00043  
00044   virtual int dimension() const {return 2;}
00045   virtual void getKfComponents( KfComponentsHolder & holder ) const { getKfComponents2D(holder); }
00046 
00047 
00048 
00049   virtual bool sharesInput( const TrackingRecHit* other, SharedInputType what) const;
00050 
00051   bool sharesInput(TrackerSingleRecHit const & other) const;
00052 
00053   virtual std::vector<const TrackingRecHit*> recHits() const; 
00054 
00055   virtual std::vector<TrackingRecHit*> recHits(); 
00056     
00057  private:
00058    OmniClusterRef clusterMono_, clusterStereo_;
00059 };
00060 
00061 
00062 inline 
00063 bool sharesClusters(SiStripMatchedRecHit2D const & h1, SiStripMatchedRecHit2D const & h2,
00064                     TrackingRecHit::SharedInputType what) {
00065   bool mono =  h1.monoClusterRef()== h2.monoClusterRef();
00066   bool stereo =  h1.stereoClusterRef()== h2.stereoClusterRef();
00067   
00068   return (what==TrackingRecHit::all) ? (mono&&stereo) : (mono||stereo);
00069   
00070 } 
00071 
00072 #endif