LDMX Software
HcalDigiID.cxx
1#include "DetDescr/HcalDigiID.h"
2
3#include "DetDescr/DetectorIDInterpreter.h"
4
5std::ostream& operator<<(std::ostream& s, const ldmx::HcalDigiID& id) {
6 s << "Hcal(" << id.section() << ',' << id.layer() << ',' << id.strip() << ','
7 << id.end() << ')';
8 return s;
9}
10
11// Section: 0 Back Hcal, > 0 Side Hcal
12// End: 0 Top/Left (positive y/x), 1 Bottom/Right (negative y/x)
13namespace ldmx {
14
15void HcalDigiID::createInterpreters() {
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}
34
35} // namespace ldmx
static void registerInterpreter(SubdetectorIDType idtype, const IDField::IDFieldList &fieldList)
Register a new field interpreter for a given subdetector id.
Extension of HcalAbstractID providing access to HCal digi information.
Definition HcalDigiID.h:13
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