LDMX Software
ldmx::HcalAbstractID Class Reference

Parent of HcalIDs. More...

#include <HcalAbstractID.h>

Public Types

enum  HcalBarType { Global = 0 , Digi = 1 , Trigger = 2 , Special = 7 }
 Encodes whether the side of the strips of the HCal is saved. More...
 
- Public Types inherited from ldmx::DetectorID
typedef uint32_t RawValue
 

Public Member Functions

 HcalAbstractID ()
 Empty HCAL id (but not null!)
 
 HcalAbstractID (RawValue rawid)
 Create from raw number.
 
 HcalAbstractID (const DetectorID id)
 Create from a DetectorID, but check.
 
 HcalAbstractID (unsigned int bar_type, unsigned int payload)
 Create from pieces.
 
int barType () const
 Get the value of the bar field from the ID.
 
int payload () const
 Get the value of the payload 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 Attributes

static const RawValue BAR_TYPE_MASK {0x7}
 
static const RawValue BAR_TYPE_SHIFT {23}
 
static const RawValue HCAL_PAYLOAD_MASK {0x007FFFFF}
 
- 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}
 

Friends

std::ostream & operator<< (std::ostream &s, const ldmx::HcalAbstractID &id)
 

Additional Inherited Members

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

Detailed Description

Parent of HcalIDs.

Definition at line 20 of file HcalAbstractID.h.

Member Enumeration Documentation

◆ HcalBarType

Encodes whether the side of the strips of the HCal is saved.

Definition at line 25 of file HcalAbstractID.h.

25 {
26 Global = 0,
27 Digi = 1,
28 Trigger = 2,
29 Special = 7,
30 };
Definition objdef.h:26

Constructor & Destructor Documentation

◆ HcalAbstractID() [1/4]

ldmx::HcalAbstractID::HcalAbstractID ( )
inline

Empty HCAL id (but not null!)

Definition at line 38 of file HcalAbstractID.h.

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

◆ HcalAbstractID() [2/4]

ldmx::HcalAbstractID::HcalAbstractID ( RawValue rawid)
inline

Create from raw number.

Definition at line 43 of file HcalAbstractID.h.

43 : DetectorID(rawid) {
44 SUBDETECTORID_TEST("HcalAbstractID", SD_HCAL);
45 }

◆ HcalAbstractID() [3/4]

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

Create from a DetectorID, but check.

Definition at line 50 of file HcalAbstractID.h.

50 : DetectorID(id) {
51 SUBDETECTORID_TEST("HcalAbstractID", SD_HCAL);
52 }

◆ HcalAbstractID() [4/4]

ldmx::HcalAbstractID::HcalAbstractID ( unsigned int bar_type,
unsigned int payload )
inline

Create from pieces.

Definition at line 57 of file HcalAbstractID.h.

58 : DetectorID(SD_HCAL, 0) {
59 id_ |= (bar_type & BAR_TYPE_MASK) << BAR_TYPE_SHIFT;
60 id_ |= (payload & HCAL_PAYLOAD_MASK);
61 }
RawValue id_
The raw, packed value of the ID.
Definition DetectorID.h:84
int payload() const
Get the value of the payload field from the ID.

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

Member Function Documentation

◆ barType()

int ldmx::HcalAbstractID::barType ( ) const
inline

Get the value of the bar field from the ID.

Returns
The value of the bar field.

Definition at line 67 of file HcalAbstractID.h.

67{ return (id_ >> BAR_TYPE_SHIFT) & BAR_TYPE_MASK; }

References ldmx::DetectorID::id_.

Referenced by ldmx::HcalDigiID::HcalDigiID(), ldmx::HcalDigiID::HcalDigiID(), ldmx::HcalID::HcalID(), ldmx::HcalID::HcalID(), ldmx::HcalTriggerID::HcalTriggerID(), and ldmx::HcalTriggerID::HcalTriggerID().

◆ payload()

int ldmx::HcalAbstractID::payload ( ) const
inline

Get the value of the payload field from the ID.

Returns
The value of the payload field.

Definition at line 73 of file HcalAbstractID.h.

73{ return id_ & HCAL_PAYLOAD_MASK; }

References ldmx::DetectorID::id_.

Referenced by HcalAbstractID().

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & s,
const ldmx::HcalAbstractID & id )
friend

Definition at line 10 of file HcalAbstractID.cxx.

10 {
11 switch (id.barType()) {
12 case (ldmx::HcalAbstractID::Global):
13 return s << ldmx::HcalID(id);
14 case (ldmx::HcalAbstractID::Digi):
15 return s << ldmx::HcalDigiID(id);
16 // case(ldmx::HcalAbstractID::Trigger): return s <<
17 // ldmx::HcalTriggerID(id);
18 default:
19 return s << "HcalAbstractID(" << id.barType() << ":0x"
20 << std::setfill('0') << std::setw(6) << std::right << std::hex
21 << id.payload();
22 }
23}
int barType() const
Get the value of the bar field from the ID.
Extension of HcalAbstractID providing access to HCal digi information.
Definition HcalDigiID.h:13
Implements detector ids for HCal subdetector.
Definition HcalID.h:19

Member Data Documentation

◆ BAR_TYPE_MASK

const RawValue ldmx::HcalAbstractID::BAR_TYPE_MASK {0x7}
static

Definition at line 31 of file HcalAbstractID.h.

31{0x7}; // space for up to eight bar types

◆ BAR_TYPE_SHIFT

const RawValue ldmx::HcalAbstractID::BAR_TYPE_SHIFT {23}
static

Definition at line 32 of file HcalAbstractID.h.

32{23};

◆ HCAL_PAYLOAD_MASK

const RawValue ldmx::HcalAbstractID::HCAL_PAYLOAD_MASK {0x007FFFFF}
static

Definition at line 33 of file HcalAbstractID.h.

33{0x007FFFFF};

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