7#ifndef DETDESCR_HCALID_H_
8#define DETDESCR_HCALID_H_
24 enum HcalSection { BACK = 0, TOP = 1, BOTTOM = 2, RIGHT = 3, LEFT = 4 };
26 static const RawValue SECTION_MASK{0x7};
27 static const RawValue SECTION_SHIFT{18};
28 static const RawValue LAYER_MASK{0xFF};
29 static const RawValue LAYER_SHIFT{10};
30 static const RawValue STRIP_MASK{0xFF};
31 static const RawValue STRIP_SHIFT{0};
45 "Attempted to create HcalID from mismatched Hcal bar_type " +
57 "Attempted to create HcalID from mismatched Hcal bar_type " +
67 id_ |= (section & SECTION_MASK) << SECTION_SHIFT;
68 id_ |= (
layer & LAYER_MASK) << LAYER_SHIFT;
69 id_ |= (
strip & STRIP_MASK) << STRIP_SHIFT;
76 unsigned int getSection()
const {
77 return (
id_ >> SECTION_SHIFT) & SECTION_MASK;
84 unsigned int section()
const {
return (
id_ >> SECTION_SHIFT) & SECTION_MASK; }
90 unsigned int layer()
const {
return (
id_ >> LAYER_SHIFT) & LAYER_MASK; }
96 unsigned int getLayerID()
const {
return (
id_ >> LAYER_SHIFT) & LAYER_MASK; }
102 unsigned int getStrip()
const {
return (
id_ >> STRIP_SHIFT) & STRIP_MASK; }
108 unsigned int strip()
const {
return (
id_ >> STRIP_SHIFT) & STRIP_MASK; }
110 static void createInterpreters();
114std::ostream& operator<<(std::ostream&,
const ldmx::HcalID&);
Class that serves as a parent for HCal detector IDs of various types.
RawValue id_
The raw, packed value of the ID.
int bar_type() const
Get the value of the bar field from the ID.
Implements detector ids for HCal subdetector.
unsigned int strip() const
Get the value of the 'strip' field from the ID.
unsigned int getStrip() const
Get the value of the 'strip' field from the ID.
unsigned int layer() const
Get the value of the layer field from the ID.
HcalID()
Empty HCAL id (but not null!)
unsigned int getLayerID() const
Get the value of the layer field from the ID.
HcalSection
Encodes the section of the HCal based on the 'section' field value.
HcalID(RawValue rawid)
Create from raw number.
HcalID(const HcalAbstractID id)
Create from a DetectorID, but check.
HcalID(unsigned int section, unsigned int layer, unsigned int strip)
Create from pieces.