7#ifndef DETDESCR_ECALDETECTORID_H_
8#define DETDESCR_ECALDETECTORID_H_
22 static const RawValue LAYER_MASK{0x3F};
23 static const RawValue LAYER_SHIFT{17};
24 static const RawValue MODULE_MASK{0x1F};
25 static const RawValue MODULE_SHIFT{12};
26 static const RawValue CELL_MASK{0xFFF};
27 static const RawValue CELL_SHIFT{0};
42 "Attempted to create EcalID from mismatched Ecal cell_type " +
55 "Attempted to create EcalID from mismatched Ecal cell_type " +
65 id_ |= (
layer & LAYER_MASK) << LAYER_SHIFT;
66 id_ |= (
module & MODULE_MASK) << MODULE_SHIFT;
67 id_ |= (
cell & CELL_MASK) << CELL_SHIFT;
80 std::pair<unsigned int, unsigned int> uv)
87 int module()
const {
return (
id_ >> MODULE_SHIFT) & MODULE_MASK; }
99 int layer()
const {
return (
id_ >> LAYER_SHIFT) & LAYER_MASK; }
111 int cell()
const {
return (
id_ >> CELL_SHIFT) & CELL_MASK; }
123 std::pair<unsigned int, unsigned int>
getCellUV()
const;
125 static void createInterpreters();
130std::ostream& operator<<(std::ostream&,
const ldmx::EcalID&);
Class that serves as a parent for ECal detector IDs of various types.
Defines a 32-bit packed ID for uniquely identifying hits and detector components.
RawValue id_
The raw, packed value of the ID.
Parent of precision and trigger EcalIDs.
int cell_type() const
Get the value of the cell field from the ID.
Extension of DetectorID providing access to ECal layers and cell numbers in a hex grid.
EcalID(unsigned int layer, unsigned int module, unsigned int cell)
Create from pieces.
int cell() const
Get the value of the cell field from the ID.
int getCellID() const
Get the value of the cell field from the ID.
std::pair< unsigned int, unsigned int > getCellUV() const
Get the cell u,v index assuming a CMS-standard 432-cell sensor.
int getLayerID() const
Get the value of the layer field from the ID.
int getModuleID() const
Get the value of the module field from the ID.
EcalID(unsigned int layer, unsigned int module, std::pair< unsigned int, unsigned int > uv)
Create from pieces including u/v cell.
EcalID(const DetectorID id)
Create from a DetectorID, but check.
EcalID()
Empty ECAL id (but not null!)
int module() const
Get the value of the module field from the ID.
EcalID(RawValue rawid)
Create from raw number.
int layer() const
Get the value of the layer field from the ID.