LDMX Software
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
ldmx::TrackerID Class Reference

Extension of DetectorID providing access to layer and module number for tracker IDs. More...

#include <TrackerID.h>

Public Member Functions

 TrackerID ()
 Create a null TrackerID (not useful)
 
 TrackerID (const DetectorID id)
 Create from a DetectorID, but check.
 
 TrackerID (RawValue rawid)
 Create from a raw id, but check.
 
 TrackerID (SubdetectorIDType system, unsigned int layer, unsigned int module)
 Create from values.
 
int module () const
 Get the value of the module field from the ID.
 
int layer () const
 Get the value of the layer field from the ID.
 
- Public Member Functions inherited from ldmx::DetectorID
 DetectorID ()
 Class constructor for a null DetectorID.
 
 DetectorID (RawValue rawid)
 Class constructor from a raw 32-bit integer.
 
 DetectorID (SubdetectorIDType sdtype, RawValue raw_subpayload)
 Class constructor from a subdetector id and a subdetector-specific section (masked to.
 
bool null () const
 
SubdetectorIDType subdet () const
 
RawValue raw () const
 
void setRawValue (RawValue rawValue)
 Set the raw value of the detector ID.
 
bool operator< (const DetectorID &id) const
 
bool operator== (const DetectorID &id) const
 
bool operator!= (const DetectorID &id) const
 

Static Public Member Functions

static void createInterpreters ()
 

Static Public Attributes

static const RawValue LAYER_MASK {0xFF}
 
static const RawValue LAYER_SHIFT {0}
 
static const RawValue MODULE_MASK {0x1F}
 
static const RawValue MODULE_SHIFT {8}
 
- Static Public Attributes inherited from ldmx::DetectorID
static const RawValue SUBDETECTORID_MASK {0x3F}
 
static const RawValue SUBDETECTORID_SHIFT {26}
 
static const RawValue SUBDETECTOR_PAYLOAD_MASK {0x3FFFFFF}
 

Additional Inherited Members

- Public Types inherited from ldmx::DetectorID
typedef uint32_t RawValue
 
- Protected Attributes inherited from ldmx::DetectorID
RawValue id_
 The raw, packed value of the ID.
 

Detailed Description

Extension of DetectorID providing access to layer and module number for tracker IDs.

Definition at line 20 of file TrackerID.h.

Constructor & Destructor Documentation

◆ TrackerID() [1/4]

ldmx::TrackerID::TrackerID ( )
inline

Create a null TrackerID (not useful)

Definition at line 30 of file TrackerID.h.

30{}

◆ TrackerID() [2/4]

ldmx::TrackerID::TrackerID ( const DetectorID  id)
inline

Create from a DetectorID, but check.

Definition at line 35 of file TrackerID.h.

35 : DetectorID(id) {
36 SUBDETECTORID_TEST2("TrackerID", SD_TRACKER_TAGGER, SD_TRACKER_RECOIL);
37 }
DetectorID()
Class constructor for a null DetectorID.
Definition DetectorID.h:44

◆ TrackerID() [3/4]

ldmx::TrackerID::TrackerID ( RawValue  rawid)
inline

Create from a raw id, but check.

Definition at line 42 of file TrackerID.h.

42 : DetectorID(rawid) {
43 SUBDETECTORID_TEST2("TrackerID", SD_TRACKER_TAGGER, SD_TRACKER_RECOIL);
44 }

◆ TrackerID() [4/4]

ldmx::TrackerID::TrackerID ( SubdetectorIDType  system,
unsigned int  layer,
unsigned int  module 
)
inline

Create from values.

Definition at line 48 of file TrackerID.h.

49 : DetectorID(system, 0) {
50 id_ |= (layer & LAYER_MASK) << LAYER_SHIFT;
51 id_ |= (module & MODULE_MASK) << MODULE_SHIFT;
52 }
RawValue id_
The raw, packed value of the ID.
Definition DetectorID.h:84
int layer() const
Get the value of the layer field from the ID.
Definition TrackerID.h:64

References ldmx::DetectorID::id_, and layer().

Member Function Documentation

◆ createInterpreters()

void ldmx::TrackerID::createInterpreters ( )
static

Definition at line 20 of file TrackerID.cxx.

20 {
22 fields.push_back(new IDField("subdetector", 0, SUBDETECTORID_SHIFT, 31));
23 fields.push_back(
24 new IDField("layer", 1, LAYER_SHIFT,
25 LAYER_SHIFT + IDField::countOnes(LAYER_MASK) - 1));
26 fields.push_back(
27 new IDField("module", 2, MODULE_SHIFT,
28 MODULE_SHIFT + IDField::countOnes(MODULE_MASK) - 1));
29
30 DetectorIDInterpreter::registerInterpreter(SD_TRACKER_TAGGER, fields);
31 DetectorIDInterpreter::registerInterpreter(SD_TRACKER_RECOIL, fields);
32}
static void registerInterpreter(SubdetectorIDType idtype, const IDField::IDFieldList &fieldList)
Register a new field interpreter for a given subdetector id.
static unsigned countOnes(unsigned mask)
Utility for counting number of 1 in a mask.
Definition IDField.cxx:33
std::vector< IDField * > IDFieldList
List of fields.
Definition IDField.h:25

◆ layer()

int ldmx::TrackerID::layer ( ) const
inline

Get the value of the layer field from the ID.

Returns
The value of the layer field.

Definition at line 64 of file TrackerID.h.

64{ return (id_ >> LAYER_SHIFT) & LAYER_MASK; }

References ldmx::DetectorID::id_.

Referenced by TEST_CASE(), and TrackerID().

◆ module()

int ldmx::TrackerID::module ( ) const
inline

Get the value of the module field from the ID.

Returns
The value of the module field.

Definition at line 58 of file TrackerID.h.

58{ return (id_ >> MODULE_SHIFT) & MODULE_MASK; }

References ldmx::DetectorID::id_.

Referenced by TEST_CASE().

Member Data Documentation

◆ LAYER_MASK

const RawValue ldmx::TrackerID::LAYER_MASK {0xFF}
static

Definition at line 22 of file TrackerID.h.

22{0xFF};

◆ LAYER_SHIFT

const RawValue ldmx::TrackerID::LAYER_SHIFT {0}
static

Definition at line 23 of file TrackerID.h.

23{0};

◆ MODULE_MASK

const RawValue ldmx::TrackerID::MODULE_MASK {0x1F}
static

Definition at line 24 of file TrackerID.h.

24{0x1F};

◆ MODULE_SHIFT

const RawValue ldmx::TrackerID::MODULE_SHIFT {8}
static

Definition at line 25 of file TrackerID.h.

25{8};

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