test
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 public:
19 
20  OmniClusterRef() : me(edm::RefCore(),kInvalid) {}
21  explicit OmniClusterRef(ClusterPixelRef const & ref) : me(ref.refCore(), (ref.isNonnull() ? ref.key() : kInvalid) ){}
22  explicit OmniClusterRef(ClusterStripRef const & ref) : me(ref.refCore(), (ref.isNonnull() ? ref.key() | kIsStrip : kInvalid) ){}
23 
25  return (isPixel() && isValid()) ? ClusterPixelRef(me.toRefCore(),index()) : ClusterPixelRef();
26  }
27 
30  }
31 
32  SiPixelCluster const & pixelCluster() const {
33  return *ClusterPixelRef(me.toRefCore(),index());
34  }
35  SiStripCluster const & stripCluster() const {
36  return *ClusterStripRef(me.toRefCore(),index());
37  }
38 
39  bool operator==(OmniClusterRef const & lh) const {
40  return rawIndex() == lh.rawIndex(); // in principle this is enough!
41  }
42 
43  bool operator<(OmniClusterRef const & lh) const {
44  return rawIndex() < lh.rawIndex(); // in principle this is enough!
45  }
46 
47 public:
48  // edm Ref interface
49  /* auto */ edm::ProductID id() const { return me.id();}
50  unsigned int key() const { return index();}
51 
52 
53  unsigned int rawIndex() const { return me.index();}
54 
55  unsigned int index() const { return rawIndex() & (~kIsRegional);}
56 
57 
58  bool isValid() const { return !(rawIndex() & kInvalid); }
59  bool isPixel() const { return !isStrip(); } //NOTE: non-valid will also show up as a pixel
60  bool isStrip() const { return rawIndex() & kIsStrip; }
61  // bool isRegional() const { return (rawIndex() & kIsRegional)==kIsRegional; }
62  // bool isNonRegionalStrip() const {return (rawIndex() & kIsRegional)==kIsStrip;}
63 
65 
66 
67 };
68 
69 #endif // TrackerRecHit2D_OmniClusterRef_H
70 
unsigned int rawIndex() const
bool isStrip() const
SiPixelCluster const & pixelCluster() const
OmniClusterRef(ClusterPixelRef const &ref)
unsigned int index() const
bool int lh
Definition: SIMDVec.h:19
ProductID id() const
ClusterPixelRef cluster_pixel() const
bool operator==(OmniClusterRef const &lh) const
bool isValid() const
OmniClusterRef(ClusterStripRef const &ref)
SiStripCluster const & stripCluster() const
RefCore const & toRefCore() const
bool operator<(OmniClusterRef const &lh) const
edm::RefCoreWithIndex me
ClusterStripRef cluster_strip() const
edm::Ref< edmNew::DetSetVector< SiPixelCluster >, SiPixelCluster > ClusterPixelRef
static const unsigned int kIsStrip
bool isPixel() const
unsigned int index() const
Pixel cluster – collection of neighboring pixels above threshold.
edm::ProductID id() const
edm::Ref< edmNew::DetSetVector< SiStripCluster >, SiStripCluster > ClusterStripRef
static const unsigned int kIsRegional
unsigned int key() const
static const unsigned int kInvalid