LDMX Software
TrigScintID.h
1#ifndef DETDESCR_TRIGSCINTID_H
2#define DETDESCR_TRIGSCINTID_H
3
4/*~~~~~~~~~~~~~~*/
5/* DetDescr */
6/*~~~~~~~~~~~~~~*/
7#include "DetDescr/DetectorID.h"
8
9namespace ldmx {
10
14class TrigScintID : public DetectorID {
15 public:
16 static const RawValue MODULE_MASK{0xFF};
17 static const RawValue MODULE_SHIFT{8};
18 static const RawValue BAR_MASK{0xFF};
19 static const RawValue BAR_SHIFT{0};
20
22 TrigScintID() : DetectorID(SD_TRIGGER_SCINT, 0) {}
23
25 TrigScintID(unsigned int rawid) : DetectorID(rawid) {
26 SUBDETECTORID_TEST("TrigScintID", SD_TRIGGER_SCINT);
27 }
28
33 SUBDETECTORID_TEST("TrigScintID", SD_TRIGGER_SCINT);
34 }
35
39 TrigScintID(unsigned int module, unsigned int bar)
40 : DetectorID(SD_TRIGGER_SCINT, 0) {
41 id_ |= (module & MODULE_MASK) << MODULE_SHIFT;
42 id_ |= (bar & BAR_MASK) << BAR_SHIFT;
43 }
44
47
52 int module() const { return (id_ >> MODULE_SHIFT) & MODULE_MASK; }
53
58 int getModule() const { return (id_ >> MODULE_SHIFT) & MODULE_MASK; }
59
64 int bar() const { return (id_ >> BAR_SHIFT) & BAR_MASK; }
70 int getBarID() const { return (id_ >> BAR_SHIFT) & BAR_MASK; }
71
72 static void createInterpreters();
73}; // TrigScintID
74
75} // namespace ldmx
76
77std::ostream& operator<<(std::ostream&, const ldmx::TrigScintID&);
78
79#endif // DETDESCR_TRIGSCINTID_H
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
Class that defines the detector ID of the trigger scintillator.
Definition TrigScintID.h:14
TrigScintID(unsigned int module, unsigned int bar)
Create from pieces.
Definition TrigScintID.h:39
~TrigScintID()
Destructor.
Definition TrigScintID.h:46
TrigScintID()
Constructor.
Definition TrigScintID.h:22
int module() const
Get the value of the module field from the ID.
Definition TrigScintID.h:52
int getModule() const
Get the value of the module field from the ID.
Definition TrigScintID.h:58
TrigScintID(const DetectorID id)
Create from a DetectorID, but check.
Definition TrigScintID.h:32
TrigScintID(unsigned int rawid)
Constructor with raw id.
Definition TrigScintID.h:25
int getBarID() const
Get the bar ID.
Definition TrigScintID.h:70
int bar() const
Get the value of the bar field from the ID.
Definition TrigScintID.h:64