LDMX Software
SimSpecialID.cxx
1#include "DetDescr/SimSpecialID.h"
2
3#include "DetDescr/DetectorIDInterpreter.h"
4
5std::ostream& operator<<(std::ostream& s, const ldmx::SimSpecialID& id) {
6 if (id.getSubtype() == ldmx::SimSpecialID::SCORING_PLANE)
7 s << "SimSpecial(ScoringPlane " << id.plane() << ')';
8 else
9 s << "SimSpecial(Type " << id.getSubtype() << ',' << id.subtypePayload()
10 << ')';
11 return s;
12}
13
14namespace ldmx {
15
16void SimSpecialID::createInterpreters() {
18 fields.push_back(new IDField("subdetector", 0, SUBDETECTORID_SHIFT, 31));
19 fields.push_back(
20 new IDField("subtype", 1, SUBTYPE_SHIFT,
21 SUBTYPE_SHIFT + IDField::countOnes(SUBTYPE_MASK) - 1));
22 fields.push_back(
23 new IDField("payload", 2, 0, IDField::countOnes(SUBTYPE_DATA_MASK) - 1));
24
25 DetectorIDInterpreter::registerInterpreter(SD_SIM_SPECIAL, fields);
26}
27
28} // namespace ldmx
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
Implements detector ids for special simulation-derived hits like scoring planes.