LDMX Software
TrackerID.cxx
2
3#include "DetDescr/DetectorIDInterpreter.h"
4
5std::ostream& operator<<(std::ostream& s, const ldmx::TrackerID& id) {
6 if (id.null())
7 s << "NULL";
8 else if (id.subdet() == ldmx::SD_TRACKER_RECOIL)
9 s << "Recoil(";
10 else if (id.subdet() == ldmx::SD_TRACKER_TAGGER)
11 s << "Tagger(";
12 else
13 s << "UnknownTk(";
14 s << id.layer() << ',' << id.module() << ')';
15 return s;
16}
17
18namespace ldmx {
19
20void TrackerID::createInterpreters() {
22 fields.push_back(new IDField("subdetector", 0, SUBDETECTORID_SHIFT, 31));
23 fields.push_back(
24 new IDField("layer", 1, LAYER_SHIFT,
25 LAYER_SHIFT + IDField::countOnes(LAYER_MASK) - 1));
26 fields.push_back(
27 new IDField("module", 2, MODULE_SHIFT,
28 MODULE_SHIFT + IDField::countOnes(MODULE_MASK) - 1));
29
30 DetectorIDInterpreter::registerInterpreter(SD_TRACKER_TAGGER, fields);
31 DetectorIDInterpreter::registerInterpreter(SD_TRACKER_RECOIL, fields);
32}
33
34} // namespace ldmx
Class that defines a Tracker detector ID with a module number.
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
Extension of DetectorID providing access to layer and module number for tracker IDs.
Definition TrackerID.h:20