LDMX Software
EcalAbstractID.h
Go to the documentation of this file.
1
7#ifndef DETDESCR_ECALABSTRACTID_H_
8#define DETDESCR_ECALABSTRACTID_H_
9
10// LDMX
11#include "DetDescr/DetectorID.h"
12
13namespace ldmx {
14
19class EcalAbstractID : public DetectorID {
20 public:
21 enum EcalCellType {
22 PrecisionGlobal = 0, // full-granularity cells, transformed to a uniform
23 // grid not alternating by layer
24 PrecisionLocal = 1, // full-granularity cells, labelled by their local
25 // coordinatate system as from DAQ
26 TriggerCell = 2, // trigger cells
27 Special = 7 // common-mode, calibration cells, etc
28 };
29
30 static const RawValue CELL_TYPE_MASK{
31 0x7}; // space for up to eight cell types
32 static const RawValue CELL_TYPE_SHIFT{23};
33 static const RawValue ECAL_PAYLOAD_MASK{0x007FFFFF};
34
38 EcalAbstractID() : DetectorID(SD_ECAL, 0) {}
39
43 EcalAbstractID(RawValue rawid) : DetectorID(rawid) {
44 SUBDETECTORID_TEST("EcalAbstractID", SD_ECAL);
45 }
46
51 SUBDETECTORID_TEST("EcalAbstractID", SD_ECAL);
52 }
53
57 EcalAbstractID(unsigned int cell_type, unsigned int payload)
58 : DetectorID(SD_ECAL, 0) {
59 id_ |= (cell_type & CELL_TYPE_MASK) << CELL_TYPE_SHIFT;
60 id_ |= (payload & ECAL_PAYLOAD_MASK);
61 }
62
67 int cell_type() const { return (id_ >> CELL_TYPE_SHIFT) & CELL_TYPE_MASK; }
68
73 int payload() const { return id_ & ECAL_PAYLOAD_MASK; }
74};
75
76} // namespace ldmx
77
78std::ostream& operator<<(std::ostream& s, const ldmx::EcalAbstractID& id);
79
80#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 precision and trigger EcalIDs.
EcalAbstractID(RawValue rawid)
Create from raw number.
int payload() const
Get the value of the payload field from the ID.
EcalAbstractID()
Empty ECAL id (but not null!)
int cell_type() const
Get the value of the cell field from the ID.
EcalAbstractID(unsigned int cell_type, unsigned int payload)
Create from pieces.
EcalAbstractID(const DetectorID id)
Create from a DetectorID, but check.