File indexing completed on 2024-04-06 12:04:38
0001 #ifndef DataFormats_L1Trigger_HOTPDigiTwinMux_h
0002 #define DataFormats_L1Trigger_HOTPDigiTwinMux_h
0003
0004 #include <ostream>
0005 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0006 #include <cstdint>
0007
0008
0009
0010
0011
0012
0013
0014
0015 class HOTPDigiTwinMux {
0016 public:
0017 typedef HcalDetId key_type;
0018
0019 HOTPDigiTwinMux() { theTP_HO = 0; }
0020 HOTPDigiTwinMux(uint64_t data) { theTP_HO = data; }
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 HOTPDigiTwinMux(int ieta, int iphi, int bx, int mip, int validbit, int wheel, int sector, int index, int link);
0041
0042 const HcalDetId id() const { return HcalDetId(HcalOuter, ieta(), iphi(), 4); }
0043
0044
0045 uint64_t raw() const { return theTP_HO; }
0046
0047
0048 int raw_ieta() const { return theTP_HO & 0x1F; }
0049
0050
0051 int ieta_sign() const { return ((theTP_HO & 0x10) ? (-1) : (+1)); }
0052
0053
0054 int ieta_abs() const { return (theTP_HO & 0x000F); }
0055
0056
0057 int ieta() const { return (ieta_abs() * ieta_sign()); }
0058
0059
0060 int iphi() const { return (theTP_HO >> 5) & 0x007F; }
0061
0062
0063 int bx_abs() const { return (theTP_HO >> 12) & 0x1; }
0064
0065
0066
0067 int bx_sign() const { return (((theTP_HO >> 13) & 0x1) ? (-1) : (+1)); }
0068
0069
0070 int bx() const { return (bx_abs() * bx_sign()); }
0071
0072
0073 int mip() const { return (theTP_HO >> 14) & 0x1; }
0074
0075
0076 int validbit() const { return (theTP_HO >> 15) & 0x1; }
0077
0078
0079 int raw_wheel() const { return (theTP_HO >> 16) & 0x7; }
0080
0081
0082 int wheel_sign() const { return (((theTP_HO >> 18) & 0x1) ? (-1) : (+1)); }
0083
0084
0085 int wheel_abs() const { return (theTP_HO >> 16) & 0x03; }
0086
0087
0088 int wheel() const { return (wheel_abs() * wheel_sign()); }
0089
0090
0091 int sector() const { return (theTP_HO >> 19) & 0xF; }
0092
0093
0094 int index() const { return (theTP_HO >> 23) & 0x1F; }
0095
0096
0097 int link() const { return (theTP_HO >> 28) & 0x3; }
0098
0099 static const int HO_SECTOR_MAX = 12;
0100
0101 private:
0102 uint64_t theTP_HO;
0103 };
0104
0105 std::ostream& operator<<(std::ostream&, const HOTPDigiTwinMux&);
0106
0107 #endif