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

Extension of HcalAbstractID providing access to HCal digi information. More...

#include <HcalDigiID.h>

Public Member Functions

 HcalDigiID ()
 Empty HCAL id (but not null!)
 
 HcalDigiID (RawValue rawid)
 Create from raw number.
 
 HcalDigiID (const DetectorID id)
 Create from a DetectorID, but check.
 
 HcalDigiID (unsigned int section, unsigned int layer, unsigned int strip, unsigned int end)
 Create from pieces.
 
int getSection () const
 Get the value of the 'section' field from the ID.
 
int section () const
 Get the value of the 'section' field from the ID.
 
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 getStrip () const
 Get the value of the 'strip' field from the ID.
 
int strip () const
 Get the value of the 'strip' 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.
 
- 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 {0x1}
 
static const RawValue END_SHIFT {19}
 
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 STRIP_MASK {0xFF}
 
static const RawValue STRIP_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

- 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
 
- Protected Attributes inherited from ldmx::DetectorID
RawValue id_
 The raw, packed value of the ID.
 

Detailed Description

Extension of HcalAbstractID providing access to HCal digi information.

Definition at line 13 of file HcalDigiID.h.

Constructor & Destructor Documentation

◆ HcalDigiID() [1/4]

ldmx::HcalDigiID::HcalDigiID ( )
inline

Empty HCAL id (but not null!)

Definition at line 27 of file HcalDigiID.h.

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

◆ HcalDigiID() [2/4]

ldmx::HcalDigiID::HcalDigiID ( RawValue  rawid)
inline

Create from raw number.

Definition at line 32 of file HcalDigiID.h.

32 : HcalAbstractID(rawid) {
33 if (!null() && bar_type() != Digi) {
34 EXCEPTION_RAISE(
35 "DetectorIDMismatch",
36 "Attempted to create HcalDigiID from mismatched Hcal bar_type " +
37 std::to_string(bar_type()));
38 }
39 }
bool null() const
Definition DetectorID.h:60
int bar_type() const
Get the value of the bar field from the ID.
Definition objdef.h:26

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

◆ HcalDigiID() [3/4]

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

Create from a DetectorID, but check.

Definition at line 44 of file HcalDigiID.h.

44 : HcalAbstractID(id) {
45 if (!null() && bar_type() != Digi) {
46 EXCEPTION_RAISE(
47 "DetectorIDMismatch",
48 "Attempted to create HcalDigiID from mismatched Hcal bar_type " +
49 std::to_string(bar_type()));
50 }
51 }

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

◆ HcalDigiID() [4/4]

ldmx::HcalDigiID::HcalDigiID ( unsigned int  section,
unsigned int  layer,
unsigned int  strip,
unsigned int  end 
)
inline

Create from pieces.

Definition at line 56 of file HcalDigiID.h.

58 : HcalAbstractID(Digi, 0) {
59 id_ |= (section & SECTION_MASK) << SECTION_SHIFT;
60 id_ |= (layer & LAYER_MASK) << LAYER_SHIFT;
61 id_ |= (strip & STRIP_MASK) << STRIP_SHIFT;
62 id_ |= (end & END_MASK) << END_SHIFT;
63 }
RawValue id_
The raw, packed value of the ID.
Definition DetectorID.h:84
int strip() const
Get the value of the 'strip' field from the ID.
Definition HcalDigiID.h:99
int section() const
Get the value of the 'section' field from the ID.
Definition HcalDigiID.h:75
int layer() const
Get the value of the layer field from the ID.
Definition HcalDigiID.h:81
int end() const
Get the value of the 'end' field from the ID.
Definition HcalDigiID.h:105

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

Member Function Documentation

◆ createInterpreters()

void ldmx::HcalDigiID::createInterpreters ( )
static

Definition at line 15 of file HcalDigiID.cxx.

15 {
17 fields.push_back(new IDField("subdetector", 0, SUBDETECTORID_SHIFT, 31));
18 fields.push_back(
19 new IDField("section", 1, SECTION_SHIFT,
20 SECTION_SHIFT + IDField::countOnes(SECTION_MASK) - 1));
21 fields.push_back(
22 new IDField("layer", 2, LAYER_SHIFT,
23 LAYER_SHIFT + IDField::countOnes(LAYER_MASK) - 1));
24 fields.push_back(
25 new IDField("strip", 3, STRIP_SHIFT,
26 STRIP_SHIFT + IDField::countOnes(STRIP_MASK) - 1));
27 fields.push_back(new IDField("end", 4, END_SHIFT,
28 END_SHIFT + IDField::countOnes(END_MASK) - 1));
29
31 SD_HCAL, HcalAbstractID::BAR_TYPE_MASK << HcalAbstractID::BAR_TYPE_SHIFT,
32 HcalAbstractID::Digi << HcalAbstractID::BAR_TYPE_SHIFT, fields);
33}
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::HcalDigiID::end ( ) const
inline

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

Returns
The value of the 'end' field.

Definition at line 105 of file HcalDigiID.h.

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

References ldmx::DetectorID::id_.

Referenced by dqm::NtuplizeHgcrocDigiCollection::analyze(), hcal::HcalTriggerGeometry::belongsToQuad(), HcalDigiID(), isNegativeEnd(), and hcal::HcalSingleEndRecProducer::produce().

◆ getLayerID()

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

Get the value of the layer field from the ID.

Returns
The value of the layer field.

Definition at line 87 of file HcalDigiID.h.

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

References ldmx::DetectorID::id_.

◆ getSection()

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

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

Returns
The value of the 'section' field.

Definition at line 69 of file HcalDigiID.h.

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

References ldmx::DetectorID::id_.

◆ getStrip()

int ldmx::HcalDigiID::getStrip ( ) const
inline

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

Returns
The value of 'strip' field.

Definition at line 93 of file HcalDigiID.h.

93{ return (id_ >> STRIP_SHIFT) & STRIP_MASK; }

References ldmx::DetectorID::id_.

◆ isNegativeEnd()

bool ldmx::HcalDigiID::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 111 of file HcalDigiID.h.

111 {
112 if (end() == 1)
113 return true;
114 else
115 return false;
116 }

References end().

Referenced by hcal::HcalDoubleEndRecProducer::produce(), and hcal::HcalRecProducer::produce().

◆ layer()

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

Get the value of the layer field from the ID.

Returns
The value of the layer field.

Definition at line 81 of file HcalDigiID.h.

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

References ldmx::DetectorID::id_.

Referenced by dqm::NtuplizeHgcrocDigiCollection::analyze(), hcal::HcalTriggerGeometry::belongsToQuad(), HcalDigiID(), hcal::HcalRecProducer::produce(), and hcal::HcalSingleEndRecProducer::produce().

◆ section()

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

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

Returns
The value of the 'section' field.

Definition at line 75 of file HcalDigiID.h.

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

References ldmx::DetectorID::id_.

Referenced by dqm::NtuplizeHgcrocDigiCollection::analyze(), hcal::HcalTriggerGeometry::belongsToQuad(), HcalDigiID(), hcal::HcalRecProducer::produce(), and hcal::HcalSingleEndRecProducer::produce().

◆ strip()

int ldmx::HcalDigiID::strip ( ) const
inline

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

Returns
The value of 'strip' field.

Definition at line 99 of file HcalDigiID.h.

99{ return (id_ >> STRIP_SHIFT) & STRIP_MASK; }

References ldmx::DetectorID::id_.

Referenced by dqm::NtuplizeHgcrocDigiCollection::analyze(), hcal::HcalTriggerGeometry::belongsToQuad(), HcalDigiID(), hcal::HcalRecProducer::produce(), and hcal::HcalSingleEndRecProducer::produce().

Member Data Documentation

◆ END_MASK

const RawValue ldmx::HcalDigiID::END_MASK {0x1}
static

Definition at line 15 of file HcalDigiID.h.

15{0x1}; // space for up to 2 ends of a strip

◆ END_SHIFT

const RawValue ldmx::HcalDigiID::END_SHIFT {19}
static

Definition at line 16 of file HcalDigiID.h.

16{19};

◆ LAYER_MASK

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

Definition at line 19 of file HcalDigiID.h.

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

◆ LAYER_SHIFT

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

Definition at line 20 of file HcalDigiID.h.

20{8};

◆ SECTION_MASK

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

Definition at line 17 of file HcalDigiID.h.

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

◆ SECTION_SHIFT

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

Definition at line 18 of file HcalDigiID.h.

18{16};

◆ STRIP_MASK

const RawValue ldmx::HcalDigiID::STRIP_MASK {0xFF}
static

Definition at line 21 of file HcalDigiID.h.

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

◆ STRIP_SHIFT

const RawValue ldmx::HcalDigiID::STRIP_SHIFT {0}
static

Definition at line 22 of file HcalDigiID.h.

22{0};

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