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
OmniClusterRef::indexMask
static const unsigned int indexMask
Definition: OmniClusterRef.h:20
OmniClusterRef::mtdCluster
FTLCluster const & mtdCluster() const
Definition: OmniClusterRef.h:57
Phase2TrackerCluster1D
Definition: Phase2TrackerCluster1D.h:10
edm::RefCoreWithIndex::index
unsigned int index() const
Definition: RefCoreWithIndex.h:78
FTLCluster
Definition: FTLCluster.h:20
edm
HLT enums.
Definition: AlignableModifier.h:19
OmniClusterRef::isTiming
bool isTiming() const
Definition: OmniClusterRef.h:82
OmniClusterRef::isPixel
bool isPixel() const
Definition: OmniClusterRef.h:79
OmniClusterRef::cluster_mtd
ClusterMTDRef cluster_mtd() const
Definition: OmniClusterRef.h:52
SiPixelCluster.h
RefCoreWithIndex.h
mathSSE::lh
bool int lh
Definition: SIMDVec.h:20
SiPixelCluster
Pixel cluster – collection of neighboring pixels above threshold.
Definition: SiPixelCluster.h:28
OmniClusterRef::rawIndex
unsigned int rawIndex() const
Definition: OmniClusterRef.h:72
OmniClusterRef
Definition: OmniClusterRef.h:12
OmniClusterRef::index
unsigned int index() const
Definition: OmniClusterRef.h:74
edm::Ref
Definition: AssociativeIterator.h:58
OmniClusterRef::cluster_phase2OT
Phase2Cluster1DRef cluster_phase2OT() const
Definition: OmniClusterRef.h:48
OmniClusterRef::operator<
bool operator<(OmniClusterRef const &lh) const
Definition: OmniClusterRef.h:63
OmniClusterRef::cluster_strip
ClusterStripRef cluster_strip() const
Definition: OmniClusterRef.h:44
OmniClusterRef::OmniClusterRef
OmniClusterRef(ClusterStripRef const &ref, unsigned int subClus=0)
Definition: OmniClusterRef.h:33
OmniClusterRef::stripCluster
SiStripCluster const & stripCluster() const
Definition: OmniClusterRef.h:55
OmniClusterRef::ClusterMTDRef
edm::Ref< FTLClusterCollection, FTLCluster > ClusterMTDRef
Definition: OmniClusterRef.h:28
OmniClusterRef::subClusShift
static const unsigned int subClusShift
Definition: OmniClusterRef.h:22
OmniClusterRef::kInvalid
static const unsigned int kInvalid
Definition: OmniClusterRef.h:13
OmniClusterRef::ClusterStripRef
edm::Ref< edmNew::DetSetVector< SiStripCluster >, SiStripCluster > ClusterStripRef
Definition: OmniClusterRef.h:26
OmniClusterRef::OmniClusterRef
OmniClusterRef()
Definition: OmniClusterRef.h:30
OmniClusterRef::isPhase2
bool isPhase2() const
Definition: OmniClusterRef.h:81
SiStripCluster.h
OmniClusterRef::isStrip
bool isStrip() const
Definition: OmniClusterRef.h:80
OmniClusterRef::kIsPhase2
static const unsigned int kIsPhase2
Definition: OmniClusterRef.h:16
OmniClusterRef::phase2OTCluster
Phase2TrackerCluster1D const & phase2OTCluster() const
Definition: OmniClusterRef.h:56
OmniClusterRef::OmniClusterRef
OmniClusterRef(ClusterPixelRef const &ref, unsigned int subClus=0)
Definition: OmniClusterRef.h:31
OmniClusterRef::OmniClusterRef
OmniClusterRef(ClusterMTDRef const &ref)
Definition: OmniClusterRef.h:37
OmniClusterRef::pixelCluster
SiPixelCluster const & pixelCluster() const
Definition: OmniClusterRef.h:54
OmniClusterRef::kIsRegional
static const unsigned int kIsRegional
Definition: OmniClusterRef.h:18
OmniClusterRef::subCluster
unsigned int subCluster() const
Definition: OmniClusterRef.h:76
OmniClusterRef::id
edm::ProductID id() const
Definition: OmniClusterRef.h:69
OmniClusterRef::kIsTiming
static const unsigned int kIsTiming
Definition: OmniClusterRef.h:17
OmniClusterRef::subClusMask
static const unsigned int subClusMask
Definition: OmniClusterRef.h:21
Phase2TrackerCluster1D.h
edm::RefCoreWithIndex
Definition: RefCoreWithIndex.h:25
OmniClusterRef::ClusterPixelRef
edm::Ref< edmNew::DetSetVector< SiPixelCluster >, SiPixelCluster > ClusterPixelRef
Definition: OmniClusterRef.h:25
OmniClusterRef::me
edm::RefCoreWithIndex me
Definition: OmniClusterRef.h:87
edm::RefCoreWithIndex::toRefCore
RefCore const & toRefCore() const
Definition: RefCoreWithIndex.h:95
edm::RefCoreWithIndex::id
ProductID id() const
Definition: RefCoreWithIndex.h:59
OmniClusterRef::isValid
bool isValid() const
Definition: OmniClusterRef.h:78
FTLClusterCollections.h
OmniClusterRef::operator==
bool operator==(OmniClusterRef const &lh) const
Definition: OmniClusterRef.h:59
SiStripCluster
Definition: SiStripCluster.h:8
OmniClusterRef::Phase2Cluster1DRef
edm::Ref< edmNew::DetSetVector< Phase2TrackerCluster1D >, Phase2TrackerCluster1D > Phase2Cluster1DRef
Definition: OmniClusterRef.h:27
OmniClusterRef::OmniClusterRef
OmniClusterRef(Phase2Cluster1DRef const &ref, unsigned int subClus=0)
Definition: OmniClusterRef.h:35
OmniClusterRef::key
unsigned int key() const
Definition: OmniClusterRef.h:70
DetSetVectorNew.h
OmniClusterRef::cluster_pixel
ClusterPixelRef cluster_pixel() const
Definition: OmniClusterRef.h:40
edm::ProductID
Definition: ProductID.h:27
OmniClusterRef::kIsStrip
static const unsigned int kIsStrip
Definition: OmniClusterRef.h:14