ATLAS Offline Software
Loading...
Searching...
No Matches
InDetDD::SiCellId Class Reference

Identifier for the strip or pixel cell. More...

#include <SiCellId.h>

Inheritance diagram for InDetDD::SiCellId:
Collaboration diagram for InDetDD::SiCellId:

Public Member Functions

 SiCellId ()
 Constructor. Set in invalid state.
 SiCellId (int strip)
 Construct with strip number.
 SiCellId (int phiIndex, int etaIndex)
 Construct with phi, eta index.
int etaIndex () const
 Get eta index.
int phiIndex () const
 Get phi index. Equivalent to strip().
int strip () const
 Get strip number. Equivalent to phiIndex().
bool isValid () const
 Test if its in a valid state.
bool operator== (const SiCellId &other) const
 Test equality.
bool operator!= (const SiCellId &other) const
 Test inequality.
bool operator< (const SiCellId &other) const
 Operator for sorting.
unsigned int word () const

Private Types

enum  MaskAndShiftConstants {
  PHI_MASK = 0x0000ffff , PHI_NEG = 0x00008000 , ETA_MASK = 0x00007fff , ETA_SHIFT = 16 ,
  ETA_NEG = 0x40000000 , VALID = 0x80000000
}

Private Attributes

unsigned int m_word

Detailed Description

Identifier for the strip or pixel cell.

Just the strip number for SCT or phi_index, eta_index for pixel. Packs the numbers in an int. Supports negative indices and is initialized in an invalid state when using the default constructor.

Author
Grant Gorfine

Definition at line 29 of file SiCellId.h.

Member Enumeration Documentation

◆ MaskAndShiftConstants

Enumerator
PHI_MASK 
PHI_NEG 
ETA_MASK 
ETA_SHIFT 
ETA_NEG 
VALID 

Definition at line 76 of file SiCellId.h.

76 {
77 PHI_MASK = 0x0000ffff,
78 PHI_NEG = 0x00008000, // (PHI_MASK >> 1 + 1)
79 ETA_MASK = 0x00007fff,
80 ETA_SHIFT = 16,
81 ETA_NEG = 0x40000000, // ((ETA_MASK >> 1 + 1) << ETA_SHIFT)
82 VALID = 0x80000000
83 };

Constructor & Destructor Documentation

◆ SiCellId() [1/3]

InDetDD::SiCellId::SiCellId ( )
inline

Constructor. Set in invalid state.

Definition at line 92 of file SiCellId.h.

93{
94 // set in invalid state
95 // This sets the invalid bit plus set phi and eta index to their most negative value
97}
unsigned int m_word
Definition SiCellId.h:70

◆ SiCellId() [2/3]

InDetDD::SiCellId::SiCellId ( int strip)
inline

Construct with strip number.

Definition at line 108 of file SiCellId.h.

109{
110 if (strip < 0) strip = PHI_MASK + strip + 1;
112}
int strip() const
Get strip number. Equivalent to phiIndex().
Definition SiCellId.h:131

◆ SiCellId() [3/3]

InDetDD::SiCellId::SiCellId ( int phiIndex,
int etaIndex )
inline

Construct with phi, eta index.

Definition at line 99 of file SiCellId.h.

100{
101 // The negative check is not really necessary if negative numbers are represented as twos complement but
102 // I don't think that assumption is guaranteed to be portable.
103 if (phiIndex < 0) phiIndex = PHI_MASK + phiIndex + 1; // For negative number store as two's complement
104 if (etaIndex < 0) etaIndex = ETA_MASK + etaIndex + 1;
106}
int phiIndex() const
Get phi index. Equivalent to strip().
Definition SiCellId.h:122
int etaIndex() const
Get eta index.
Definition SiCellId.h:114

Member Function Documentation

◆ etaIndex()

int InDetDD::SiCellId::etaIndex ( ) const
inline

Get eta index.

Definition at line 114 of file SiCellId.h.

115{
116 if (m_word & ETA_NEG) { // Negative index
117 return ((m_word >> ETA_SHIFT) & ETA_MASK) - ETA_MASK - 1;
118 }
119 return (m_word >> ETA_SHIFT) & ETA_MASK;
120}

◆ isValid()

bool InDetDD::SiCellId::isValid ( ) const
inline

Test if its in a valid state.

Definition at line 136 of file SiCellId.h.

137{
138 return !(m_word & VALID);
139}

◆ operator!=()

bool InDetDD::SiCellId::operator!= ( const SiCellId & other) const
inline

Test inequality.

Definition at line 146 of file SiCellId.h.

147{
148 return (m_word != other.m_word);
149}

◆ operator<()

bool InDetDD::SiCellId::operator< ( const SiCellId & other) const
inline

Operator for sorting.

Definition at line 151 of file SiCellId.h.

152{
153 return (m_word < other.m_word);
154}

◆ operator==()

bool InDetDD::SiCellId::operator== ( const SiCellId & other) const
inline

Test equality.

Definition at line 141 of file SiCellId.h.

142{
143 return (m_word == other.m_word);
144}

◆ phiIndex()

int InDetDD::SiCellId::phiIndex ( ) const
inline

Get phi index. Equivalent to strip().

Definition at line 122 of file SiCellId.h.

123{
124 if (m_word & PHI_NEG) { // Negative index
125 return (m_word & PHI_MASK) - PHI_MASK - 1;
126 }
127 return (m_word & PHI_MASK);
128
129}

◆ strip()

int InDetDD::SiCellId::strip ( ) const
inline

Get strip number. Equivalent to phiIndex().

Definition at line 131 of file SiCellId.h.

132{
133 return phiIndex();
134}

◆ word()

unsigned int InDetDD::SiCellId::word ( ) const
inline

Definition at line 67 of file SiCellId.h.

67{ return m_word; }

Member Data Documentation

◆ m_word

unsigned int InDetDD::SiCellId::m_word
private

Definition at line 70 of file SiCellId.h.


The documentation for this class was generated from the following file: