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 
14  static const unsigned int kInvalid = 0x80000000; // bit 31 on
15  static const unsigned int kIsStrip = 0x20000000; // bit 29 on
16  // FIXME:: need to check when introducing phase2 pixel
17  static const unsigned int kIsPhase2 = 0x40000000; // bit 30 on
18  static const unsigned int kIsTiming = 0x10000000; // bit 28 on
19  static const unsigned int kIsRegional = 0x60000000; // bit 30 and 29 on (will become fastsim???)
20 
21  static const unsigned int indexMask = 0xFFFFFF;
22  static const unsigned int subClusMask = 0xF000000;
23  static const unsigned int subClusShift = 24;
24 
25 public:
30 
31  OmniClusterRef() : me(edm::RefCore(),kInvalid) {}
32  explicit OmniClusterRef(ClusterPixelRef const & ref, unsigned int subClus=0) : me(ref.refCore(), (ref.isNonnull() ? ref.key() | (subClus<<subClusShift) : kInvalid) ){ }
33  explicit OmniClusterRef(ClusterStripRef const & ref, unsigned int subClus=0) : me(ref.refCore(), (ref.isNonnull() ? (ref.key() | kIsStrip ) | (subClus<<subClusShift) : kInvalid) ){ }
34  explicit OmniClusterRef(Phase2Cluster1DRef const & ref, unsigned int subClus=0) : me(ref.refCore(), (ref.isNonnull() ? (ref.key() | kIsPhase2) | (subClus<<subClusShift) : kInvalid) ){ }
35  explicit OmniClusterRef(ClusterMTDRef const & ref) : me(ref.refCore(), (ref.isNonnull() ? (ref.key() | kIsTiming) : kInvalid) ){ }
36 
37  ClusterPixelRef cluster_pixel() const {
38  return (isPixel() && isValid()) ? ClusterPixelRef(me.toRefCore(),index()) : ClusterPixelRef();
39  }
40 
41  ClusterStripRef cluster_strip() const {
43  }
44 
45  Phase2Cluster1DRef cluster_phase2OT() const {
47  }
48 
49  ClusterMTDRef cluster_mtd() const {
51  }
52 
53  SiPixelCluster const & pixelCluster() const {
54  return *ClusterPixelRef(me.toRefCore(),index());
55  }
56  SiStripCluster const & stripCluster() const {
57  return *ClusterStripRef(me.toRefCore(),index());
58  }
60  return *Phase2Cluster1DRef(me.toRefCore(),index());
61  }
62  FTLCluster const & mtdCluster() const {
63  return *ClusterMTDRef(me.toRefCore(),index());
64  }
65 
66  bool operator==(OmniClusterRef const & lh) const {
67  return rawIndex() == lh.rawIndex(); // in principle this is enough!
68  }
69 
70  bool operator<(OmniClusterRef const & lh) const {
71  return rawIndex() < lh.rawIndex(); // in principle this is enough!
72  }
73 
74 public:
75  // edm Ref interface
76  /* auto */ edm::ProductID id() const { return me.id();}
77  unsigned int key() const { return index();}
78 
79  unsigned int rawIndex() const { return me.index();}
80 
81  unsigned int index() const { return rawIndex() & indexMask;}
82 
83  unsigned int subCluster() const { return (rawIndex() & subClusMask)>>subClusShift; }
84 
85  bool isValid() const { return !(rawIndex() & kInvalid); }
86  bool isPixel() const { return !isStrip() && !isPhase2(); } //NOTE: non-valid will also show up as a pixel
87  bool isStrip() const { return rawIndex() & kIsStrip; }
88  bool isPhase2() const { return rawIndex() & kIsPhase2; }
89  bool isTiming() const { return rawIndex() & kIsTiming; }
90  // bool isRegional() const { return (rawIndex() & kIsRegional)==kIsRegional; }
91  // bool isNonRegionalStrip() const {return (rawIndex() & kIsRegional)==kIsStrip;}
92 
93 private:
95 };
96 
97 #endif // TrackerRecHit2D_OmniClusterRef_H
bool isTiming() const
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
edm::Ref< FTLClusterCollection, FTLCluster > ClusterMTDRef
bool int lh
Definition: SIMDVec.h:21
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)
ClusterStripRef cluster_strip() const
edm::Ref< edmNew::DetSetVector< SiPixelCluster >, SiPixelCluster > ClusterPixelRef
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< edmNew::DetSetVector< SiStripCluster >, SiStripCluster > ClusterStripRef
static const unsigned int subClusShift
bool isPhase2() const
static const unsigned int kIsRegional
unsigned int key() const
static const unsigned int kInvalid