File indexing completed on 2021-02-14 12:53:21
0001 #ifndef DataFormats_ForwardDetId_HGCalTriggerDetId_H
0002 #define DataFormats_ForwardDetId_HGCalTriggerDetId_H 1
0003
0004 #include <iosfwd>
0005 #include <vector>
0006 #include "DataFormats/DetId/interface/DetId.h"
0007 #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h"
0008 #include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h"
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 class HGCalTriggerDetId : public DetId {
0027 public:
0028 static const int HGCalTriggerCell = 4;
0029
0030
0031 HGCalTriggerDetId();
0032
0033 HGCalTriggerDetId(uint32_t rawid);
0034
0035 HGCalTriggerDetId(int subdet, int zp, int type, int layer, int waferU, int waferV, int cellU, int cellV);
0036
0037 HGCalTriggerDetId(const DetId& id);
0038
0039 HGCalTriggerDetId& operator=(const DetId& id);
0040
0041
0042 HGCalTriggerSubdetector subdet() const {
0043 return (HGCalTriggerSubdetector)((id_ >> kHGCalSubdetOffset) & kHGCalSubdetMask);
0044 }
0045
0046
0047 int type() const { return (id_ >> kHGCalTypeOffset) & kHGCalTypeMask; }
0048
0049
0050 int zside() const { return (((id_ >> kHGCalZsideOffset) & kHGCalZsideMask) ? -1 : 1); }
0051
0052
0053 int layer() const { return (id_ >> kHGCalLayerOffset) & kHGCalLayerMask; }
0054
0055
0056 HGCSiliconDetId geometryCell() const { return HGCSiliconDetId(det(), zside(), 0, layer(), waferU(), waferV(), 0, 0); }
0057 HGCSiliconDetId moduleId() const {
0058 return HGCSiliconDetId(det(), zside(), type(), layer(), waferU(), waferV(), 0, 0);
0059 }
0060
0061
0062 int triggerCellU() const { return (id_ >> kHGCalCellUOffset) & kHGCalCellUMask; }
0063 int triggerCellV() const { return (id_ >> kHGCalCellVOffset) & kHGCalCellVMask; }
0064 std::pair<int, int> triggerCellUV() const { return std::pair<int, int>(triggerCellU(), triggerCellV()); }
0065 int triggerCellX() const;
0066 int triggerCellY() const;
0067 std::pair<int, int> triggerCellXY() const { return std::pair<int, int>(triggerCellX(), triggerCellY()); }
0068
0069
0070 int waferUAbs() const { return (id_ >> kHGCalWaferUOffset) & kHGCalWaferUMask; }
0071 int waferVAbs() const { return (id_ >> kHGCalWaferVOffset) & kHGCalWaferVMask; }
0072 int waferU() const { return (((id_ >> kHGCalWaferUSignOffset) & kHGCalWaferUSignMask) ? -waferUAbs() : waferUAbs()); }
0073 int waferV() const { return (((id_ >> kHGCalWaferVSignOffset) & kHGCalWaferVSignMask) ? -waferVAbs() : waferVAbs()); }
0074 std::pair<int, int> waferUV() const { return std::pair<int, int>(waferU(), waferV()); }
0075 int waferX() const { return (-2 * waferU() + waferV()); }
0076 int waferY() const { return (2 * waferV()); }
0077 std::pair<int, int> waferXY() const { return std::pair<int, int>(waferX(), waferY()); }
0078
0079
0080 std::vector<int> cellU() const;
0081 std::vector<int> cellV() const;
0082 std::vector<std::pair<int, int> > cellUV() const;
0083
0084
0085 bool isEE() const { return (subdet() == HGCalEETrigger); }
0086 bool isHSilicon() const { return (subdet() == HGCalHSiTrigger); }
0087 bool isForward() const { return true; }
0088
0089 static const HGCalTriggerDetId Undefined;
0090
0091 static const int kHGCalCellUOffset = 0;
0092 static const int kHGCalCellUMask = 0xF;
0093 static const int kHGCalCellVOffset = 4;
0094 static const int kHGCalCellVMask = 0xF;
0095 static const int kHGCalWaferUOffset = 8;
0096 static const int kHGCalWaferUMask = 0xF;
0097 static const int kHGCalWaferUSignOffset = 12;
0098 static const int kHGCalWaferUSignMask = 0x1;
0099 static const int kHGCalWaferVOffset = 13;
0100 static const int kHGCalWaferVMask = 0xF;
0101 static const int kHGCalWaferVSignOffset = 17;
0102 static const int kHGCalWaferVSignMask = 0x1;
0103 static const int kHGCalLayerOffset = 18;
0104 static const int kHGCalLayerMask = 0x1F;
0105 static const int kHGCalTypeOffset = 23;
0106 static const int kHGCalTypeMask = 0x3;
0107 static const int kHGCalZsideOffset = 27;
0108 static const int kHGCalZsideMask = 0x1;
0109 static const int kHGCalSubdetOffset = 25;
0110 static const int kHGCalSubdetMask = 0x3;
0111 };
0112
0113 std::ostream& operator<<(std::ostream&, const HGCalTriggerDetId& id);
0114
0115 #endif