CMS 3D CMS Logo

OmniClusterRef.h
Go to the documentation of this file.
1 #ifndef TrackerRecHit2D_OmniClusterRef_H
2 #define TrackerRecHit2D_OmniClusterRef_H
3 
5 
11 
13  static const unsigned int kInvalid = 0x80000000; // bit 31 on
14  static const unsigned int kIsStrip = 0x20000000; // bit 29 on
15  // FIXME:: need to check when introducing phase2 pixel
16  static const unsigned int kIsPhase2 = 0x40000000; // bit 30 on
17  static const unsigned int kIsTiming = 0x10000000; // bit 28 on
18  static const unsigned int kIsRegional = 0x60000000; // bit 30 and 29 on (will become fastsim???)
19 
20  static const unsigned int indexMask = 0xFFFFFF;
21  static const unsigned int subClusMask = 0xF000000;
22  static const unsigned int subClusShift = 24;
23 
24 public:
29 
30  OmniClusterRef() : me(edm::RefCore(), kInvalid) {}
31  explicit OmniClusterRef(ClusterPixelRef const& ref, unsigned int subClus = 0)
32  : me(ref.refCore(), (ref.isNonnull() ? ref.key() | (subClus << subClusShift) : kInvalid)) {}
33  explicit OmniClusterRef(ClusterStripRef const& ref, unsigned int subClus = 0)
34  : me(ref.refCore(), (ref.isNonnull() ? (ref.key() | kIsStrip) | (subClus << subClusShift) : kInvalid)) {}
35  explicit OmniClusterRef(Phase2Cluster1DRef const& ref, unsigned int subClus = 0)
36  : me(ref.refCore(), (ref.isNonnull() ? (ref.key() | kIsPhase2) | (subClus << subClusShift) : kInvalid)) {}
37  explicit OmniClusterRef(ClusterMTDRef const& ref)
38  : me(ref.refCore(), (ref.isNonnull() ? (ref.key() | kIsTiming) : kInvalid)) {}
39 
41  return (isPixel() && isValid()) ? ClusterPixelRef(me.toRefCore(), index()) : ClusterPixelRef();
42  }
43 
46  }
47 
50  }
51 
53 
54  SiPixelCluster const& pixelCluster() const { return *ClusterPixelRef(me.toRefCore(), index()); }
55  SiStripCluster const& stripCluster() const { return *ClusterStripRef(me.toRefCore(), index()); }
57  FTLCluster const& mtdCluster() const { return *ClusterMTDRef(me.toRefCore(), index()); }
58 
59  bool operator==(OmniClusterRef const& lh) const {
60  return rawIndex() == lh.rawIndex(); // in principle this is enough!
61  }
62 
63  bool operator<(OmniClusterRef const& lh) const {
64  return rawIndex() < lh.rawIndex(); // in principle this is enough!
65  }
66 
67 public:
68  // edm Ref interface
69  /* auto */ edm::ProductID id() const { return me.id(); }
70  unsigned int key() const { return index(); }
71 
72  unsigned int rawIndex() const { return me.index(); }
73 
74  unsigned int index() const { return rawIndex() & indexMask; }
75 
76  unsigned int subCluster() const { return (rawIndex() & subClusMask) >> subClusShift; }
77 
78  bool isValid() const { return !(rawIndex() & kInvalid); }
79  bool isPixel() const { return !isStrip() && !isPhase2(); } //NOTE: non-valid will also show up as a pixel
80  bool isStrip() const { return rawIndex() & kIsStrip; }
81  bool isPhase2() const { return rawIndex() & kIsPhase2; }
82  bool isTiming() const { return rawIndex() & kIsTiming; }
83  // bool isRegional() const { return (rawIndex() & kIsRegional)==kIsRegional; }
84  // bool isNonRegionalStrip() const {return (rawIndex() & kIsRegional)==kIsStrip;}
85 
86 private:
88 };
89 
90 #endif // TrackerRecHit2D_OmniClusterRef_H
edm::Ref< edmNew::DetSetVector< SiPixelCluster >, SiPixelCluster > ClusterPixelRef
bool isStrip() const
bool isPixel() const
OmniClusterRef(ClusterPixelRef const &ref, unsigned int subClus=0)
OmniClusterRef(ClusterMTDRef const &ref)
static const unsigned int kIsPhase2
SiPixelCluster const & pixelCluster() const
ClusterMTDRef cluster_mtd() const
unsigned int index() const
bool int lh
Definition: SIMDVec.h:20
unsigned int subCluster() const
edm::ProductID id() const
ClusterPixelRef cluster_pixel() const
OmniClusterRef(Phase2Cluster1DRef const &ref, unsigned int subClus=0)
bool isValid() const
edm::Ref< edmNew::DetSetVector< Phase2TrackerCluster1D >, Phase2TrackerCluster1D > Phase2Cluster1DRef
edm::RefCoreWithIndex me
OmniClusterRef(ClusterStripRef const &ref, unsigned int subClus=0)
edm::Ref< edmNew::DetSetVector< SiStripCluster >, SiStripCluster > ClusterStripRef
bool isPhase2() const
static const unsigned int kIsStrip
Phase2TrackerCluster1D const & phase2OTCluster() const
FTLCluster const & mtdCluster() const
bool isTiming() const
static const unsigned int indexMask
Phase2Cluster1DRef cluster_phase2OT() const
ProductID id() const
Pixel cluster – collection of neighboring pixels above threshold.
HLT enums.
static const unsigned int kIsTiming
SiStripCluster const & stripCluster() const
bool operator<(OmniClusterRef const &lh) const
static const unsigned int subClusMask
unsigned int rawIndex() const
edm::Ref< FTLClusterCollection, FTLCluster > ClusterMTDRef
bool operator==(OmniClusterRef const &lh) const
ClusterStripRef cluster_strip() const
unsigned int key() const
static const unsigned int subClusShift
RefCore const & toRefCore() const
static const unsigned int kIsRegional
static const unsigned int kInvalid
unsigned int index() const