File indexing completed on 2024-04-06 12:04:08
0001 #ifndef DataFormats_ForwardDetId_HGCalTriggerBackendDetId_H
0002 #define DataFormats_ForwardDetId_HGCalTriggerBackendDetId_H 1
0003
0004 #include "DataFormats/DetId/interface/DetId.h"
0005 #include "DataFormats/ForwardDetId/interface/HGCalTriggerBackendCommon.h"
0006 #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h"
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 class HGCalTriggerBackendDetId : public DetId {
0023 public:
0024
0025 HGCalTriggerBackendDetId();
0026
0027 HGCalTriggerBackendDetId(uint32_t rawid);
0028
0029 HGCalTriggerBackendDetId(int zp, int type, int sector, int label);
0030
0031 HGCalTriggerBackendDetId(const DetId& id);
0032
0033 HGCalTriggerBackendDetId& operator=(const DetId& id);
0034
0035
0036 int classId() const { return (id_ >> kHGCalTriggerClassIdentifierOffset) & kHGCalTriggerClassIdentifierMask; }
0037
0038
0039 int type() const { return (id_ >> kHGCalTypeOffset) & kHGCalTypeMask; }
0040
0041
0042 int zside() const { return ((id_ >> kHGCalZsideOffset) & kHGCalZsideMask ? -1 : 1); }
0043
0044
0045 int sector() const { return (id_ >> kHGCalSectorOffset) & kHGCalSectorMask; }
0046
0047
0048 int label() const { return (id_ >> kHGCalLabelOffset) & kHGCalLabelMask; }
0049
0050 bool isLpGBT() const { return (type() == BackendType::LpGBT); }
0051 bool isStage1FPGA() const { return (type() == BackendType::Stage1FPGA); }
0052 bool isStage1Link() const { return (type() == BackendType::Stage1Link); }
0053 bool isStage2FPGA() const { return (type() == BackendType::Stage2FPGA); }
0054 bool isForward() const { return true; }
0055 bool isHGCalModuleDetId() const { return (classId() == HGCalTriggerClassIdentifier::ModuleDetId); }
0056 bool isHGCalBackendDetId() const { return (classId() == HGCalTriggerClassIdentifier::BackendDetId); }
0057
0058 static const HGCalTriggerBackendDetId Undefined;
0059
0060 static const int kHGCalLabelOffset = 0;
0061 static const int kHGCalLabelMask = 0x7FF;
0062 static const int kHGCalSectorOffset = 11;
0063 static const int kHGCalSectorMask = 0x3;
0064 static const int kHGCalTypeOffset = 13;
0065 static const int kHGCalTypeMask = 0x7;
0066 static const int kHGCalZsideOffset = 16;
0067 static const int kHGCalZsideMask = 0x1;
0068 static const int kHGCalTriggerClassIdentifierOffset = 24;
0069 static const int kHGCalTriggerClassIdentifierMask = 0x1;
0070
0071 enum BackendType { LpGBT, Stage1FPGA, Stage1Link, Stage2FPGA };
0072 };
0073
0074 std::ostream& operator<<(std::ostream&, const HGCalTriggerBackendDetId& id);
0075
0076 #endif