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_TEST2("TrackerID", SD_TRACKER_TAGGER, SD_TRACKER_RECOIL);
37 }
38
42 TrackerID(RawValue rawid) : DetectorID(rawid) {
43 SUBDETECTORID_TEST2("TrackerID", SD_TRACKER_TAGGER, SD_TRACKER_RECOIL);
44 }
45
48 TrackerID(SubdetectorIDType system, unsigned int layer, unsigned int module)
49 : DetectorID(system, 0) {
50 id_ |= (layer & LAYER_MASK) << LAYER_SHIFT;
51 id_ |= (module & MODULE_MASK) << MODULE_SHIFT;
52 }
53
58 int module() const { return (id_ >> MODULE_SHIFT) & MODULE_MASK; }
59
64 int layer() const { return (id_ >> LAYER_SHIFT) & LAYER_MASK; }
65
66 static void createInterpreters();
67};
68} // namespace ldmx
69
70std::ostream& operator<<(std::ostream&, const ldmx::TrackerID&);
71
72#endif
Defines a 32-bit packed ID for uniquely identifying hits and detector components.
Definition DetectorID.h:35
RawValue id_
The raw, packed value of the ID.
Definition DetectorID.h:84
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:58
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:48
TrackerID(RawValue rawid)
Create from a raw id, but check.
Definition TrackerID.h:42
int layer() const
Get the value of the layer field from the ID.
Definition TrackerID.h:64