Public Member Functions | Private Attributes | List of all members
WireCell::WirePlaneId Class Reference

#include <WirePlaneId.h>

Public Member Functions

 WirePlaneId (WirePlaneLayer_t layer, int face=0, int apa=0)
 
 WirePlaneId (int packed)
 
int ident () const
 Unit ID as integer. More...
 
WirePlaneLayer_t layer () const
 Layer as enum. More...
 
int ilayer () const
 Layer as integer (not index!) More...
 
int index () const
 Layer as index number (0,1 or 2). -1 if unknown. More...
 
int face () const
 APA face number. More...
 
int apa () const
 APA number. More...
 
bool valid () const
 return true if valid More...
 
bool operator== (const WirePlaneId &rhs)
 
bool operator!= (const WirePlaneId &rhs)
 
bool operator< (const WirePlaneId &rhs)
 

Private Attributes

int m_pack
 

Detailed Description

Definition at line 16 of file WirePlaneId.h.

Constructor & Destructor Documentation

WireCell::WirePlaneId::WirePlaneId ( WirePlaneLayer_t  layer,
int  face = 0,
int  apa = 0 
)
explicit

Definition at line 9 of file WirePlaneId.cxx.

10  : m_pack( (((int)layer)&layer_mask) | (face << face_shift) | (apa<<apa_shift))
11 {
12 }
WirePlaneLayer_t layer() const
Layer as enum.
Definition: WirePlaneId.cxx:25
static const int face_shift
Definition: WirePlaneId.cxx:6
static const int apa_shift
Definition: WirePlaneId.cxx:7
static const int layer_mask
Definition: WirePlaneId.cxx:5
int face() const
APA face number.
Definition: WirePlaneId.cxx:44
WireCell::WirePlaneId::WirePlaneId ( int  packed)
explicit

Definition at line 13 of file WirePlaneId.cxx.

14  : m_pack(packed)
15 {
16  // It is very dubious that I allow this constructor. I do it for
17  // reading WireSchema files where the packing is done by the user.
18  // Very dubious indeed.
19 }

Member Function Documentation

int WireCell::WirePlaneId::apa ( ) const

APA number.

Definition at line 48 of file WirePlaneId.cxx.

49 {
50  return m_pack>>apa_shift;
51 }
static const int apa_shift
Definition: WirePlaneId.cxx:7
int WireCell::WirePlaneId::face ( ) const

APA face number.

Definition at line 44 of file WirePlaneId.cxx.

45 {
46  return (m_pack&(1<<face_shift))>>3;
47 }
static const int face_shift
Definition: WirePlaneId.cxx:6
int WireCell::WirePlaneId::ident ( ) const

Unit ID as integer.

Definition at line 21 of file WirePlaneId.cxx.

22 {
23  return m_pack;
24 }
int WireCell::WirePlaneId::ilayer ( ) const

Layer as integer (not index!)

Definition at line 29 of file WirePlaneId.cxx.

30 {
31  return m_pack & layer_mask;
32 }
static const int layer_mask
Definition: WirePlaneId.cxx:5
int WireCell::WirePlaneId::index ( ) const

Layer as index number (0,1 or 2). -1 if unknown.

Definition at line 34 of file WirePlaneId.cxx.

35 {
36  switch (layer()) {
37  case kUlayer : return 0;
38  case kVlayer : return 1;
39  case kWlayer : return 2;
40  case kUnknownLayer: return -1;
41  }
42  return -1;
43 }
WirePlaneLayer_t layer() const
Layer as enum.
Definition: WirePlaneId.cxx:25
WireCell::WirePlaneLayer_t WireCell::WirePlaneId::layer ( ) const

Layer as enum.

Definition at line 25 of file WirePlaneId.cxx.

26 {
27  return WirePlaneLayer_t(ilayer());
28 }
int ilayer() const
Layer as integer (not index!)
Definition: WirePlaneId.cxx:29
WirePlaneLayer_t
Enumerate layer IDs. These are not indices!
Definition: WirePlaneId.h:13
bool WireCell::WirePlaneId::operator!= ( const WirePlaneId rhs)

Definition at line 64 of file WirePlaneId.cxx.

65 {
66  return !(*this == rhs);
67 }
bool WireCell::WirePlaneId::operator< ( const WirePlaneId rhs)

Definition at line 69 of file WirePlaneId.cxx.

70 {
71  if (!this->valid() || !rhs.valid()) { return false; }
72 
73  if (apa() == rhs.apa()) {
74  if (face() == rhs.face()) {
75  return index() < rhs.index();
76  }
77  return face() < rhs.face();
78  }
79  return apa() < rhs.apa();
80 }
bool valid() const
return true if valid
Definition: WirePlaneId.cxx:53
int apa() const
APA number.
Definition: WirePlaneId.cxx:48
int index() const
Layer as index number (0,1 or 2). -1 if unknown.
Definition: WirePlaneId.cxx:34
int face() const
APA face number.
Definition: WirePlaneId.cxx:44
bool WireCell::WirePlaneId::operator== ( const WirePlaneId rhs)

Definition at line 59 of file WirePlaneId.cxx.

60 {
61  return m_pack == rhs.m_pack;
62 }
bool WireCell::WirePlaneId::valid ( ) const

return true if valid

Definition at line 53 of file WirePlaneId.cxx.

54 {
55  int ind = index();
56  return 0 <= ind && ind < 3;
57 }
int index() const
Layer as index number (0,1 or 2). -1 if unknown.
Definition: WirePlaneId.cxx:34

Member Data Documentation

int WireCell::WirePlaneId::m_pack
private

Definition at line 51 of file WirePlaneId.h.


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