Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:20

0001 #ifndef TrackerSingleRecHit_H
0002 #define TrackerSingleRecHit_H
0003 
0004 #include "DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h"
0005 #include "DataFormats/TrackerRecHit2D/interface/OmniClusterRef.h"
0006 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
0007 
0008 /*  a Hit composed by a "single" measurement
0009  * it has a reference to a cluster and a local position&error
0010  */
0011 class TrackerSingleRecHit : public BaseTrackerRecHit {
0012 public:
0013   typedef BaseTrackerRecHit Base;
0014 
0015   TrackerSingleRecHit() {}
0016 
0017   typedef OmniClusterRef::ClusterPixelRef ClusterPixelRef;
0018   typedef OmniClusterRef::ClusterStripRef ClusterStripRef;
0019   typedef OmniClusterRef::Phase2Cluster1DRef ClusterPhase2Ref;
0020   typedef OmniClusterRef::ClusterMTDRef ClusterMTDRef;
0021 
0022   // no position (as in persistent)
0023   TrackerSingleRecHit(DetId id, OmniClusterRef const& clus) : Base(id, trackerHitRTTI::single), cluster_(clus) {}
0024 
0025   template <typename CluRef>
0026   TrackerSingleRecHit(const LocalPoint& p, const LocalError& e, GeomDet const& idet, CluRef const& clus)
0027       : Base(p, e, idet, trackerHitRTTI::single), cluster_(clus) {}
0028 
0029   // for projected or timing...
0030   template <typename CluRef>
0031   TrackerSingleRecHit(
0032       const LocalPoint& p, const LocalError& e, GeomDet const& idet, trackerHitRTTI::RTTI rt, CluRef const& clus)
0033       : Base(p, e, idet, rt), cluster_(clus) {}
0034 
0035   // a single hit is on a detunit
0036   const GeomDetUnit* detUnit() const override { return det(); }
0037 
0038   // used by trackMerger (to be improved)
0039   OmniClusterRef const& firstClusterRef() const final { return cluster_; }
0040 
0041   OmniClusterRef const& omniClusterRef() const { return cluster_; }
0042   OmniClusterRef const& omniCluster() const { return cluster_; }
0043   // for rekeying...
0044   OmniClusterRef& omniClusterRef() { return cluster_; }
0045   OmniClusterRef& omniCluster() { return cluster_; }
0046 
0047   ClusterPixelRef cluster_pixel() const { return cluster_.cluster_pixel(); }
0048 
0049   ClusterStripRef cluster_strip() const { return cluster_.cluster_strip(); }
0050 
0051   ClusterPhase2Ref cluster_phase2OT() const { return cluster_.cluster_phase2OT(); }
0052 
0053   ClusterMTDRef cluster_mtd() const { return cluster_.cluster_mtd(); }
0054 
0055   SiStripCluster const& stripCluster() const { return cluster_.stripCluster(); }
0056 
0057   SiPixelCluster const& pixelCluster() const { return cluster_.pixelCluster(); }
0058 
0059   Phase2TrackerCluster1D const& phase2OTCluster() const { return cluster_.phase2OTCluster(); }
0060 
0061   FTLCluster const& mtdCluster() const { return cluster_.mtdCluster(); }
0062 
0063   // void setClusterRef(const &  OmniClusterRef ref) {  cluster_ =ref;}
0064   void setClusterPixelRef(ClusterPixelRef const& ref) { cluster_ = OmniClusterRef(ref); }
0065   void setClusterStripRef(ClusterStripRef const& ref) { cluster_ = OmniClusterRef(ref); }
0066   void setClusterPhase2Ref(ClusterPhase2Ref const& ref) { cluster_ = OmniClusterRef(ref); }
0067   void setClusterMTDRef(ClusterMTDRef const& ref) { cluster_ = OmniClusterRef(ref); }
0068 
0069   bool sharesInput(const TrackingRecHit* other, SharedInputType what) const final;
0070 
0071   bool sharesInput(TrackerSingleRecHit const& other) const { return cluster_ == other.cluster_; }
0072 
0073   bool sameCluster(OmniClusterRef const& oh) const { return oh == cluster_; }
0074 
0075   std::vector<const TrackingRecHit*> recHits() const override;
0076   std::vector<TrackingRecHit*> recHits() override;
0077 
0078 private:
0079   // new game
0080   OmniClusterRef cluster_;
0081 };
0082 
0083 #endif