LDMX Software
HcalID.cxx
1#include "DetDescr/HcalID.h"
2
3#include "DetDescr/DetectorIDInterpreter.h"
4
5std::ostream& operator<<(std::ostream& s, const ldmx::HcalID& id) {
6 s << "Hcal(" << id.section() << ',' << id.layer() << ',' << id.strip() << ')';
7 return s;
8}
9
10namespace ldmx {
11
12void HcalID::createInterpreters() {
14 fields.push_back(new IDField("subdetector", 0, SUBDETECTORID_SHIFT, 31));
15 fields.push_back(
16 new IDField("section", 1, SECTION_SHIFT,
17 SECTION_SHIFT + IDField::countOnes(SECTION_MASK) - 1));
18 fields.push_back(
19 new IDField("layer", 2, LAYER_SHIFT,
20 LAYER_SHIFT + IDField::countOnes(LAYER_MASK) - 1));
21 fields.push_back(
22 new IDField("strip", 3, STRIP_SHIFT,
23 STRIP_SHIFT + IDField::countOnes(STRIP_MASK) - 1));
24
26 SD_HCAL, HcalAbstractID::BAR_TYPE_MASK << HcalAbstractID::BAR_TYPE_SHIFT,
27 HcalAbstractID::Global << HcalAbstractID::BAR_TYPE_SHIFT, fields);
28}
29
30} // namespace ldmx
Class that defines an HCal sensitive detector.
static void registerInterpreter(SubdetectorIDType idtype, const IDField::IDFieldList &fieldList)
Register a new field interpreter for a given subdetector id.
Implements detector ids for HCal subdetector.
Definition HcalID.h:19
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