CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OmniClusterRef.h
Go to the documentation of this file.
1 #ifndef TrackerRecHit2D_OmniClusterRef_H
2 #define TrackerRecHit2D_OmniClusterRef_H
3 
5 
9 
11 
12  static const unsigned int kInvalid = 0x80000000; // bit 31 on
13  static const unsigned int kIsStrip = 0x20000000; // bit 29 on
14  static const unsigned int kIsRegional = 0x60000000; // bit 30 and 29 on (will become fastsim???)
15 
16  static const unsigned int indexMask = 0xFFFFFF;
17  static const unsigned int subClusMask = 0xF000000;
18  static const unsigned int subClusShift = 24;
19 
20 public:
23 
24  OmniClusterRef() : me(edm::RefCore(),kInvalid) {}
25  explicit OmniClusterRef(ClusterPixelRef const & ref, unsigned int subClus=0) : me(ref.refCore(), (ref.isNonnull() ? ref.key() | (subClus<<subClusShift) : kInvalid) ){ }
26  explicit OmniClusterRef(ClusterStripRef const & ref, unsigned int subClus=0) : me(ref.refCore(), (ref.isNonnull() ? (ref.key() | kIsStrip ) | (subClus<<subClusShift) : kInvalid) ){ }
27 
29  return (isPixel() && isValid()) ? ClusterPixelRef(me.toRefCore(),index()) : ClusterPixelRef();
30  }
31 
34  }
35 
36  SiPixelCluster const & pixelCluster() const {
37  return *ClusterPixelRef(me.toRefCore(),index());
38  }
39  SiStripCluster const & stripCluster() const {
40  return *ClusterStripRef(me.toRefCore(),index());
41  }
42 
43  bool operator==(OmniClusterRef const & lh) const {
44  return rawIndex() == lh.rawIndex(); // in principle this is enough!
45  }
46 
47  bool operator<(OmniClusterRef const & lh) const {
48  return rawIndex() < lh.rawIndex(); // in principle this is enough!
49  }
50 
51 public:
52  // edm Ref interface
53  /* auto */ edm::ProductID id() const { return me.id();}
54  unsigned int key() const { return index();}
55 
56 
57  unsigned int rawIndex() const { return me.index();}
58 
59  unsigned int index() const { return rawIndex() & indexMask;}
60 
61  unsigned int subCluster() const { return (rawIndex() & subClusMask)>>subClusShift; }
62 
63  bool isValid() const { return !(rawIndex() & kInvalid); }
64  bool isPixel() const { return !isStrip(); } //NOTE: non-valid will also show up as a pixel
65  bool isStrip() const { return rawIndex() & kIsStrip; }
66  // bool isRegional() const { return (rawIndex() & kIsRegional)==kIsRegional; }
67  // bool isNonRegionalStrip() const {return (rawIndex() & kIsRegional)==kIsStrip;}
68 
69 private:
71 };
72 
73 #endif // TrackerRecHit2D_OmniClusterRef_H
unsigned int rawIndex() const
bool isStrip() const
SiPixelCluster const & pixelCluster() const
OmniClusterRef(ClusterPixelRef const &ref, unsigned int subClus=0)
unsigned int subCluster() const
unsigned int index() const
bool int lh
Definition: SIMDVec.h:21
ProductID id() const
ClusterPixelRef cluster_pixel() const
bool operator==(OmniClusterRef const &lh) const
bool isValid() const
SiStripCluster const & stripCluster() const
RefCore const & toRefCore() const
bool operator<(OmniClusterRef const &lh) const
edm::RefCoreWithIndex me
OmniClusterRef(ClusterStripRef const &ref, unsigned int subClus=0)
ClusterStripRef cluster_strip() const
edm::Ref< edmNew::DetSetVector< SiPixelCluster >, SiPixelCluster > ClusterPixelRef
static const unsigned int kIsStrip
bool isPixel() const
static const unsigned int indexMask
unsigned int index() const
Pixel cluster – collection of neighboring pixels above threshold.
edm::ProductID id() const
static const unsigned int subClusMask
edm::Ref< edmNew::DetSetVector< SiStripCluster >, SiStripCluster > ClusterStripRef
static const unsigned int subClusShift
static const unsigned int kIsRegional
unsigned int key() const
static const unsigned int kInvalid