File indexing completed on 2024-04-06 12:04:08
0001 #ifndef DataFormats_ForwardDetId_HFNoseTriggerDetId_H
0002 #define DataFormats_ForwardDetId_HFNoseTriggerDetId_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/HFNoseDetId.h"
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 class HFNoseTriggerDetId : public DetId {
0027 public:
0028 static const int HFNoseTriggerCell = 4;
0029
0030
0031 HFNoseTriggerDetId();
0032
0033 HFNoseTriggerDetId(uint32_t rawid);
0034
0035 HFNoseTriggerDetId(int subdet, int zp, int type, int layer, int waferU, int waferV, int cellU, int cellV);
0036
0037 HFNoseTriggerDetId(const DetId& id);
0038
0039 HFNoseTriggerDetId& operator=(const DetId& id);
0040
0041
0042 HGCalTriggerSubdetector subdet() const {
0043 return (HGCalTriggerSubdetector)((id_ >> kHFNoseSubdetOffset) & kHFNoseSubdetMask);
0044 }
0045
0046
0047 int type() const { return (id_ >> kHFNoseTypeOffset) & kHFNoseTypeMask; }
0048
0049
0050 int zside() const { return (((id_ >> kHFNoseZsideOffset) & kHFNoseZsideMask) ? -1 : 1); }
0051
0052
0053 int layer() const { return (id_ >> kHFNoseLayerOffset) & kHFNoseLayerMask; }
0054
0055
0056 HFNoseDetId geometryCell() const { return HFNoseDetId(zside(), 0, layer(), waferU(), waferV(), 0, 0); }
0057 HFNoseDetId moduleId() const { return HFNoseDetId(zside(), type(), layer(), waferU(), waferV(), 0, 0); }
0058
0059
0060 int triggerCellU() const { return (id_ >> kHFNoseCellUOffset) & kHFNoseCellUMask; }
0061 int triggerCellV() const { return (id_ >> kHFNoseCellVOffset) & kHFNoseCellVMask; }
0062 std::pair<int, int> triggerCellUV() const { return std::pair<int, int>(triggerCellU(), triggerCellV()); }
0063 int triggerCellX() const;
0064 int triggerCellY() const;
0065 std::pair<int, int> triggerCellXY() const { return std::pair<int, int>(triggerCellX(), triggerCellY()); }
0066
0067
0068 int waferUAbs() const { return (id_ >> kHFNoseWaferUOffset) & kHFNoseWaferUMask; }
0069 int waferVAbs() const { return (id_ >> kHFNoseWaferVOffset) & kHFNoseWaferVMask; }
0070 int waferU() const {
0071 return (((id_ >> kHFNoseWaferUSignOffset) & kHFNoseWaferUSignMask) ? -waferUAbs() : waferUAbs());
0072 }
0073 int waferV() const {
0074 return (((id_ >> kHFNoseWaferVSignOffset) & kHFNoseWaferVSignMask) ? -waferVAbs() : waferVAbs());
0075 }
0076 std::pair<int, int> waferUV() const { return std::pair<int, int>(waferU(), waferV()); }
0077 int waferX() const { return (-2 * waferU() + waferV()); }
0078 int waferY() const { return (2 * waferV()); }
0079 std::pair<int, int> waferXY() const { return std::pair<int, int>(waferX(), waferY()); }
0080
0081
0082 std::vector<int> cellU() const;
0083 std::vector<int> cellV() const;
0084 std::vector<std::pair<int, int> > cellUV() const;
0085
0086
0087 bool isEE() const { return (layer() <= kHFNoseMaxEELayer); }
0088 bool isHSilicon() const { return (layer() > kHFNoseMaxEELayer); }
0089 bool isForward() const { return true; }
0090
0091 static const HFNoseTriggerDetId Undefined;
0092
0093 static const int kHFNoseCellUOffset = 0;
0094 static const int kHFNoseCellUMask = 0xF;
0095 static const int kHFNoseCellVOffset = 4;
0096 static const int kHFNoseCellVMask = 0xF;
0097 static const int kHFNoseWaferUOffset = 8;
0098 static const int kHFNoseWaferUMask = 0xF;
0099 static const int kHFNoseWaferUSignOffset = 12;
0100 static const int kHFNoseWaferUSignMask = 0x1;
0101 static const int kHFNoseWaferVOffset = 13;
0102 static const int kHFNoseWaferVMask = 0xF;
0103 static const int kHFNoseWaferVSignOffset = 17;
0104 static const int kHFNoseWaferVSignMask = 0x1;
0105 static const int kHFNoseLayerOffset = 18;
0106 static const int kHFNoseLayerMask = 0x1F;
0107 static const int kHFNoseTypeOffset = 23;
0108 static const int kHFNoseTypeMask = 0x3;
0109 static const int kHFNoseZsideOffset = 27;
0110 static const int kHFNoseZsideMask = 0x1;
0111 static const int kHFNoseSubdetOffset = 25;
0112 static const int kHFNoseSubdetMask = 0x3;
0113 static const int kHFNoseMaxEELayer = 6;
0114 };
0115
0116 std::ostream& operator<<(std::ostream&, const HFNoseTriggerDetId& id);
0117
0118 #endif