LDMX Software
TrackerID.h
Go to the documentation of this file.
1
7#ifndef DETDESCR_TRACKERID_H_
8#define DETDESCR_TRACKERID_H_
9
10// LDMX
11#include "DetDescr/DetectorID.h"
12
13namespace ldmx {
14
20class TrackerID : public DetectorID {
21 public:
22 static const RawValue LAYER_MASK{0xFF};
23 static const RawValue LAYER_SHIFT{0};
24 static const RawValue MODULE_MASK{0x1F};
25 static const RawValue MODULE_SHIFT{8};
26
31
36 SUBDETECTORID_TEST3("TrackerID", SD_TRACKER_TAGGER, SD_TRACKER_RECOIL,
37 SD_TRACKER_TESTSTAND);
38 }
39
43 TrackerID(RawValue rawid) : DetectorID(rawid) {
44 SUBDETECTORID_TEST3("TrackerID", SD_TRACKER_TAGGER, SD_TRACKER_RECOIL,
45 SD_TRACKER_TESTSTAND);
46 }
47
50 TrackerID(SubdetectorIDType system, unsigned int layer, unsigned int module)
51 : DetectorID(system, 0) {
52 id_ |= (layer & LAYER_MASK) << LAYER_SHIFT;
53 id_ |= (module & MODULE_MASK) << MODULE_SHIFT;
54 }
55
60 int module() const { return (id_ >> MODULE_SHIFT) & MODULE_MASK; }
61
66 int layer() const { return (id_ >> LAYER_SHIFT) & LAYER_MASK; }
67
68 friend std::ostream& operator<<(std::ostream& o, const ldmx::TrackerID& d);
69
70 static void createInterpreters();
71};
72} // namespace ldmx
73
74#endif
Defines a 32-bit packed ID for uniquely identifying hits and detector components.
Definition DetectorID.h:36
RawValue id_
The raw, packed value of the ID.
Definition DetectorID.h:85
Extension of DetectorID providing access to layer and module number for tracker IDs.
Definition TrackerID.h:20
int module() const
Get the value of the module field from the ID.
Definition TrackerID.h:60
TrackerID(const DetectorID id)
Create from a DetectorID, but check.
Definition TrackerID.h:35
TrackerID()
Create a null TrackerID (not useful)
Definition TrackerID.h:30
TrackerID(SubdetectorIDType system, unsigned int layer, unsigned int module)
Create from values.
Definition TrackerID.h:50
TrackerID(RawValue rawid)
Create from a raw id, but check.
Definition TrackerID.h:43
int layer() const
Get the value of the layer field from the ID.
Definition TrackerID.h:66