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

Identifies a location in the Hcal readout chain. More...

#include <HcalElectronicsID.h>

Public Types

typedef PackedIndex< 38, 48, 97 > Index
 
- Public Types inherited from ldmx::DetectorID
typedef uint32_t RawValue
 

Public Member Functions

 HcalElectronicsID ()
 Empty HCAL id (but not null!)
 
 HcalElectronicsID (RawValue rawid)
 Create from raw number.
 
 HcalElectronicsID (const DetectorID id)
 Create from a DetectorID, but check.
 
 HcalElectronicsID (unsigned int fiber, unsigned int elink, unsigned int channel)
 Create from pieces.
 
int fiber () const
 Get the value of the fiber from the ID.
 
int elink () const
 Get the value of the elink from the ID.
 
int channel () const
 Get the value of the channel from the ID.
 
unsigned int index () const
 Get the compact index value.
 
- 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 HcalElectronicsID idFromIndex (unsigned int index)
 Construct an electronics id from an index.
 

Static Public Attributes

static const RawValue INDEX_MASK {0xFFFFFF}
 
static const unsigned int MAX_INDEX {38 * 48 * 200}
 
- 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

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

Detailed Description

Identifies a location in the Hcal readout chain.

– fiber : optical fiber number (backend number), range assumed O(0-96) – elink : electronic link number, range assumed O(0-47) – channel : channel-on-elink, range O(0-37)

For transient use only i.e. we use this ID to help translate the digitized data coming off the detector into spatially-important HcalDigiIDs.

TODO update the ranges in the packed index template. These were originally copied from the EcalElectronicsID implementation and may not align with the Hcal readout design.

Definition at line 26 of file HcalElectronicsID.h.

Member Typedef Documentation

◆ Index

typedef PackedIndex<38, 48, 97> ldmx::HcalElectronicsID::Index

Definition at line 30 of file HcalElectronicsID.h.

Constructor & Destructor Documentation

◆ HcalElectronicsID() [1/4]

ldmx::HcalElectronicsID::HcalElectronicsID ( )
inline

Empty HCAL id (but not null!)

Definition at line 37 of file HcalElectronicsID.h.

37: DetectorID(EID_HCAL, 0) {}
DetectorID()
Class constructor for a null DetectorID.
Definition DetectorID.h:44

◆ HcalElectronicsID() [2/4]

ldmx::HcalElectronicsID::HcalElectronicsID ( RawValue  rawid)
inline

Create from raw number.

Definition at line 42 of file HcalElectronicsID.h.

42 : DetectorID(rawid) {
43 SUBDETECTORID_TEST("HcalElectronicsID", EID_HCAL);
44 }

◆ HcalElectronicsID() [3/4]

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

Create from a DetectorID, but check.

Definition at line 49 of file HcalElectronicsID.h.

49 : DetectorID(id) {
50 SUBDETECTORID_TEST("HcalElectronicsID", EID_HCAL);
51 }

◆ HcalElectronicsID() [4/4]

ldmx::HcalElectronicsID::HcalElectronicsID ( unsigned int  fiber,
unsigned int  elink,
unsigned int  channel 
)
inline

Create from pieces.

Definition at line 56 of file HcalElectronicsID.h.

58 : DetectorID(EID_HCAL, 0) {
59 Index index(channel, elink, fiber);
60 id_ |= index.value();
61 }
RawValue id_
The raw, packed value of the ID.
Definition DetectorID.h:84
unsigned int index() const
Get the compact index value.
int elink() const
Get the value of the elink from the ID.
int fiber() const
Get the value of the fiber from the ID.
int channel() const
Get the value of the channel from the ID.

References channel(), elink(), fiber(), ldmx::DetectorID::id_, and index().

Member Function Documentation

◆ channel()

int ldmx::HcalElectronicsID::channel ( ) const
inline

Get the value of the channel from the ID.

Returns
The value of the channel field.

Definition at line 91 of file HcalElectronicsID.h.

91{ return Index(id_ & INDEX_MASK).field0(); }

References ldmx::DetectorID::id_.

Referenced by dqm::NtuplizeHgcrocDigiCollection::analyze(), and HcalElectronicsID().

◆ elink()

int ldmx::HcalElectronicsID::elink ( ) const
inline

Get the value of the elink from the ID.

Returns
The value of the elink field.

Definition at line 86 of file HcalElectronicsID.h.

86{ return Index(id_ & INDEX_MASK).field1(); }

References ldmx::DetectorID::id_.

Referenced by dqm::NtuplizeHgcrocDigiCollection::analyze(), and HcalElectronicsID().

◆ fiber()

int ldmx::HcalElectronicsID::fiber ( ) const
inline

Get the value of the fiber from the ID.

Returns
The value of the fiber field.

Definition at line 81 of file HcalElectronicsID.h.

81{ return Index(id_ & INDEX_MASK).field2(); }

References ldmx::DetectorID::id_.

Referenced by dqm::NtuplizeHgcrocDigiCollection::analyze(), and HcalElectronicsID().

◆ idFromIndex()

static HcalElectronicsID ldmx::HcalElectronicsID::idFromIndex ( unsigned int  index)
inlinestatic

Construct an electronics id from an index.

This looks ugly (and it is) because we already have a constructor that uses the unsigned int type. This means we need a different static method for translating something we know to be an EID index rather than a full DetID raw value.

Definition at line 71 of file HcalElectronicsID.h.

71 {
73 eid.id_ |= index;
74 return eid;
75 }
HcalElectronicsID()
Empty HCAL id (but not null!)

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

◆ index()

unsigned int ldmx::HcalElectronicsID::index ( ) const
inline

Get the compact index value.

Definition at line 96 of file HcalElectronicsID.h.

96{ return id_ & INDEX_MASK; }

References ldmx::DetectorID::id_.

Referenced by dqm::NtuplizeHgcrocDigiCollection::analyze(), HcalElectronicsID(), and idFromIndex().

Member Data Documentation

◆ INDEX_MASK

const RawValue ldmx::HcalElectronicsID::INDEX_MASK {0xFFFFFF}
static

Definition at line 28 of file HcalElectronicsID.h.

28{0xFFFFFF};

◆ MAX_INDEX

const unsigned int ldmx::HcalElectronicsID::MAX_INDEX {38 * 48 * 200}
static

Definition at line 32 of file HcalElectronicsID.h.

32{38 * 48 * 200};

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