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 
40  ClusterPixelRef cluster_pixel() const {
41  return (isPixel() && isValid()) ? ClusterPixelRef(me.toRefCore(), index()) : ClusterPixelRef();
42  }
43 
44  ClusterStripRef cluster_strip() const {
46  }
47 
48  Phase2Cluster1DRef cluster_phase2OT() const {
50  }
51 
52  ClusterMTDRef cluster_mtd() const { return isTiming() ? ClusterMTDRef(me.toRefCore(), index()) : ClusterMTDRef(); }
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
bool isTiming() const
edm::Ref< edmNew::DetSetVector< SiPixelCluster >, SiPixelCluster > ClusterPixelRef
unsigned int rawIndex() const
Phase2Cluster1DRef cluster_phase2OT() const
bool isStrip() const
Phase2TrackerCluster1D const & phase2OTCluster() const
SiPixelCluster const & pixelCluster() const
OmniClusterRef(ClusterPixelRef const &ref, unsigned int subClus=0)
unsigned int subCluster() const
OmniClusterRef(ClusterMTDRef const &ref)
static const unsigned int kIsPhase2
unsigned int index() const
bool int lh
Definition: SIMDVec.h:20
FTLCluster const & mtdCluster() const
ProductID id() const
ClusterPixelRef cluster_pixel() const
bool operator==(OmniClusterRef const &lh) const
bool isValid() const
OmniClusterRef(Phase2Cluster1DRef const &ref, unsigned int subClus=0)
SiStripCluster const & stripCluster() const
RefCore const & toRefCore() const
bool operator<(OmniClusterRef const &lh) 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
ClusterStripRef cluster_strip() const
static const unsigned int kIsStrip
bool isPixel() const
static const unsigned int indexMask
ClusterMTDRef cluster_mtd() const
unsigned int index() const
Pixel cluster – collection of neighboring pixels above threshold.
edm::ProductID id() const
HLT enums.
static const unsigned int kIsTiming
static const unsigned int subClusMask
edm::Ref< FTLClusterCollection, FTLCluster > ClusterMTDRef
static const unsigned int subClusShift
bool isPhase2() const
static const unsigned int kIsRegional
unsigned int key() const
static const unsigned int kInvalid