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

Extension of DetectorID providing access to HCal trigger cell. More...

#include <HcalTriggerID.h>

Public Types

enum  HcalSection {
  BACK = 0 , TOP = 1 , BOTTOM = 2 , LEFT = 4 ,
  RIGHT = 3
}
 Encodes the section of the HCal based on the 'section' field value. More...
 
- Public Types inherited from ldmx::HcalAbstractID
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

 HcalTriggerID ()
 Empty HCAL trigger id (but not null!)
 
 HcalTriggerID (RawValue rawid)
 Create from raw number.
 
 HcalTriggerID (const HcalAbstractID id)
 Create from a DetectorID, but check.
 
 HcalTriggerID (unsigned int section, unsigned int layer, unsigned int superstrip, unsigned int end)
 Create from pieces.
 
int getSection () const
 
int section () const
 
int layer () const
 Get the value of the layer field from the ID.
 
int getLayerID () const
 Get the value of the layer field from the ID.
 
int getSuperstrip () const
 Get the value of the 'superstrip' field from the ID.
 
int superstrip () const
 Get the value of the 'superstrip' field from the ID.
 
int end () const
 Get the value of the 'end' field from the ID.
 
bool isNegativeEnd () const
 Get whether the 'end' field from the ID is negative.
 
bool isComposite () const
 Get whether the ID is the composite of two bar ends.
 
- Public Member Functions inherited from ldmx::HcalAbstractID
 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 bar_type () 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 Member Functions

static void createInterpreters ()
 

Static Public Attributes

static const RawValue END_MASK {0x3}
 
static const RawValue END_SHIFT {20}
 
static const RawValue SECTION_MASK {0x7}
 
static const RawValue SECTION_SHIFT {16}
 
static const RawValue LAYER_MASK {0xFF}
 
static const RawValue LAYER_SHIFT {8}
 
static const RawValue SUPERSTRIP_MASK {0xFF}
 
static const RawValue SUPERSTRIP_SHIFT {0}
 
- Static Public Attributes inherited from ldmx::HcalAbstractID
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}
 

Additional Inherited Members

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

Detailed Description

Extension of DetectorID providing access to HCal trigger cell.

Definition at line 19 of file HcalTriggerID.h.

Member Enumeration Documentation

◆ HcalSection

Encodes the section of the HCal based on the 'section' field value.

Definition at line 24 of file HcalTriggerID.h.

24{ BACK = 0, TOP = 1, BOTTOM = 2, LEFT = 4, RIGHT = 3 };

Constructor & Destructor Documentation

◆ HcalTriggerID() [1/4]

ldmx::HcalTriggerID::HcalTriggerID ( )
inline

Empty HCAL trigger id (but not null!)

Definition at line 38 of file HcalTriggerID.h.

38: HcalAbstractID() {}
HcalAbstractID()
Empty HCAL id (but not null!)

◆ HcalTriggerID() [2/4]

ldmx::HcalTriggerID::HcalTriggerID ( RawValue  rawid)
inline

Create from raw number.

Definition at line 43 of file HcalTriggerID.h.

43 : HcalAbstractID(rawid) {
44 if (!null() && bar_type() != Trigger) {
45 EXCEPTION_RAISE(
46 "DetectorIDMismatch",
47 "Attempted to create HcalTriggerID from mismatched Hcal bar_type " +
48 std::to_string(bar_type()));
49 }
50 }
bool null() const
Definition DetectorID.h:60
int bar_type() const
Get the value of the bar field from the ID.

References ldmx::HcalAbstractID::bar_type(), and ldmx::DetectorID::null().

◆ HcalTriggerID() [3/4]

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

Create from a DetectorID, but check.

Definition at line 55 of file HcalTriggerID.h.

55 : HcalAbstractID(id) {
56 if (!null() && bar_type() != Trigger) {
57 EXCEPTION_RAISE(
58 "DetectorIDMismatch",
59 "Attempted to create HcalTriggerID from mismatched Hcal bar_type " +
60 std::to_string(bar_type()));
61 }
62 }

References ldmx::HcalAbstractID::bar_type(), and ldmx::DetectorID::null().

◆ HcalTriggerID() [4/4]

ldmx::HcalTriggerID::HcalTriggerID ( unsigned int  section,
unsigned int  layer,
unsigned int  superstrip,
unsigned int  end 
)
inline

Create from pieces.

Definition at line 67 of file HcalTriggerID.h.

69 : HcalAbstractID(Trigger, 0) {
70 id_ |= (section & SECTION_MASK) << SECTION_SHIFT;
71 id_ |= (layer & LAYER_MASK) << LAYER_SHIFT;
72 id_ |= (superstrip & SUPERSTRIP_MASK) << SUPERSTRIP_SHIFT;
73 id_ |= (end & END_MASK) << END_SHIFT;
74 }
RawValue id_
The raw, packed value of the ID.
Definition DetectorID.h:84
int superstrip() const
Get the value of the 'superstrip' field from the ID.
int end() const
Get the value of the 'end' field from the ID.
int layer() const
Get the value of the layer field from the ID.

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

Member Function Documentation

◆ createInterpreters()

void ldmx::HcalTriggerID::createInterpreters ( )
static

Definition at line 13 of file HcalTriggerID.cxx.

13 {
15 fields.push_back(new IDField("subdetector", 0, SUBDETECTORID_SHIFT, 31));
16 fields.push_back(
17 new IDField("section", 1, SECTION_SHIFT,
18 SECTION_SHIFT + IDField::countOnes(SECTION_MASK) - 1));
19 fields.push_back(
20 new IDField("layer", 2, LAYER_SHIFT,
21 LAYER_SHIFT + IDField::countOnes(LAYER_MASK) - 1));
22 fields.push_back(
23 new IDField("superstrip", 3, SUPERSTRIP_SHIFT,
24 SUPERSTRIP_SHIFT + IDField::countOnes(SUPERSTRIP_MASK) - 1));
25 fields.push_back(new IDField("end", 4, END_SHIFT,
26 END_SHIFT + IDField::countOnes(END_MASK) - 1));
27
29 SD_HCAL, HcalAbstractID::BAR_TYPE_MASK << HcalAbstractID::BAR_TYPE_SHIFT,
30 HcalAbstractID::Trigger << HcalAbstractID::BAR_TYPE_SHIFT, fields);
31}
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

◆ end()

int ldmx::HcalTriggerID::end ( ) const
inline

Get the value of the 'end' field from the ID.

Returns
The value of the 'end' field.

Definition at line 118 of file HcalTriggerID.h.

118{ return (id_ >> END_SHIFT) & END_MASK; }

References ldmx::DetectorID::id_.

Referenced by hcal::HcalTriggerGeometry::contentsOfQuad(), HcalTriggerID(), isComposite(), isNegativeEnd(), and hcal::HcalTrigPrimDigiProducer::produce().

◆ getLayerID()

int ldmx::HcalTriggerID::getLayerID ( ) const
inline

Get the value of the layer field from the ID.

Returns
The value of the layer field.

Definition at line 98 of file HcalTriggerID.h.

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

References ldmx::DetectorID::id_.

◆ getSection()

int ldmx::HcalTriggerID::getSection ( ) const
inline

Definition at line 80 of file HcalTriggerID.h.

80{ return (id_ >> SECTION_SHIFT) & SECTION_MASK; }

◆ getSuperstrip()

int ldmx::HcalTriggerID::getSuperstrip ( ) const
inline

Get the value of the 'superstrip' field from the ID.

Returns
The value of 'superstrip' field.

Definition at line 104 of file HcalTriggerID.h.

104 {
105 return (id_ >> SUPERSTRIP_SHIFT) & SUPERSTRIP_MASK;
106 }

References ldmx::DetectorID::id_.

◆ isComposite()

bool ldmx::HcalTriggerID::isComposite ( ) const
inline

Get whether the ID is the composite of two bar ends.

Returns
True if the ID corresponds to a composite TP.

Definition at line 130 of file HcalTriggerID.h.

130{ return end() == 2; }

References end().

◆ isNegativeEnd()

bool ldmx::HcalTriggerID::isNegativeEnd ( ) const
inline

Get whether the 'end' field from the ID is negative.

Returns
True if the end of the strip is negative

Definition at line 124 of file HcalTriggerID.h.

124{ return end() == 1; }

References end().

◆ layer()

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

Get the value of the layer field from the ID.

Returns
The value of the layer field.

Definition at line 92 of file HcalTriggerID.h.

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

References ldmx::DetectorID::id_.

Referenced by hcal::HcalTriggerGeometry::contentsOfQuad(), HcalTriggerID(), trigger::TrigHcalEnergySum::produce(), and hcal::HcalTrigPrimDigiProducer::produce().

◆ section()

int ldmx::HcalTriggerID::section ( ) const
inline

Definition at line 86 of file HcalTriggerID.h.

86{ return (id_ >> SECTION_SHIFT) & SECTION_MASK; }

◆ superstrip()

int ldmx::HcalTriggerID::superstrip ( ) const
inline

Get the value of the 'superstrip' field from the ID.

Returns
The value of 'superstrip' field.

Definition at line 112 of file HcalTriggerID.h.

112{ return (id_ >> SUPERSTRIP_SHIFT) & SUPERSTRIP_MASK; }

References ldmx::DetectorID::id_.

Referenced by hcal::HcalTriggerGeometry::contentsOfQuad(), HcalTriggerID(), trigger::TrigHcalEnergySum::produce(), and hcal::HcalTrigPrimDigiProducer::produce().

Member Data Documentation

◆ END_MASK

const RawValue ldmx::HcalTriggerID::END_MASK {0x3}
static

Definition at line 26 of file HcalTriggerID.h.

26{0x3}; // space for 2 ends plus a combined TP

◆ END_SHIFT

const RawValue ldmx::HcalTriggerID::END_SHIFT {20}
static

Definition at line 27 of file HcalTriggerID.h.

27{20};

◆ LAYER_MASK

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

Definition at line 30 of file HcalTriggerID.h.

30{0xFF}; // space for up to 255 layers

◆ LAYER_SHIFT

const RawValue ldmx::HcalTriggerID::LAYER_SHIFT {8}
static

Definition at line 31 of file HcalTriggerID.h.

31{8};

◆ SECTION_MASK

const RawValue ldmx::HcalTriggerID::SECTION_MASK {0x7}
static

Definition at line 28 of file HcalTriggerID.h.

28{0x7}; // space for up to 7 sections

◆ SECTION_SHIFT

const RawValue ldmx::HcalTriggerID::SECTION_SHIFT {16}
static

Definition at line 29 of file HcalTriggerID.h.

29{16};

◆ SUPERSTRIP_MASK

const RawValue ldmx::HcalTriggerID::SUPERSTRIP_MASK {0xFF}
static

Definition at line 32 of file HcalTriggerID.h.

32{0xFF}; // space for 255 strips/layer

◆ SUPERSTRIP_SHIFT

const RawValue ldmx::HcalTriggerID::SUPERSTRIP_SHIFT {0}
static

Definition at line 33 of file HcalTriggerID.h.

33{0};

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