LDMX Software
HcalAbstractID.h
Go to the documentation of this file.
1
8#ifndef DETDESCR_HCALABSTRACTID_H_
9#define DETDESCR_HCALABSTRACTID_H_
10
11// LDMX
12#include "DetDescr/DetectorID.h"
13
14namespace ldmx {
15
20class HcalAbstractID : public DetectorID {
21 public:
26 Global = 0,
27 Digi = 1,
28 Trigger = 2,
29 Special = 7,
30 };
31 static const RawValue BAR_TYPE_MASK{0x7}; // space for up to eight bar types
32 static const RawValue BAR_TYPE_SHIFT{23};
33 static const RawValue HCAL_PAYLOAD_MASK{0x007FFFFF};
34
38 HcalAbstractID() : DetectorID(SD_HCAL, 0) {}
39
43 HcalAbstractID(RawValue rawid) : DetectorID(rawid) {
44 SUBDETECTORID_TEST("HcalAbstractID", SD_HCAL);
45 }
46
51 SUBDETECTORID_TEST("HcalAbstractID", SD_HCAL);
52 }
53
57 HcalAbstractID(unsigned int bar_type, unsigned int payload)
58 : DetectorID(SD_HCAL, 0) {
59 id_ |= (bar_type & BAR_TYPE_MASK) << BAR_TYPE_SHIFT;
60 id_ |= (payload & HCAL_PAYLOAD_MASK);
61 }
62
67 int barType() const { return (id_ >> BAR_TYPE_SHIFT) & BAR_TYPE_MASK; }
68
73 int payload() const { return id_ & HCAL_PAYLOAD_MASK; }
74
75 friend std::ostream& operator<<(std::ostream& s,
76 const ldmx::HcalAbstractID& id);
77};
78
79} // namespace ldmx
80
81#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
Parent of HcalIDs.
int barType() const
Get the value of the bar field from the ID.
int payload() const
Get the value of the payload field from the ID.
HcalBarType
Encodes whether the side of the strips of the HCal is saved.
HcalAbstractID(const DetectorID id)
Create from a DetectorID, but check.
HcalAbstractID(RawValue rawid)
Create from raw number.
HcalAbstractID()
Empty HCAL id (but not null!)
HcalAbstractID(unsigned int bar_type, unsigned int payload)
Create from pieces.
Definition objdef.h:26