File indexing completed on 2024-04-06 12:04:18
0001 #ifndef DIGIHCAL_HOTRIGGERPRIMITIVEDIGI_H
0002 #define DIGIHCAL_HOTRIGGERPRIMITIVEDIGI_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 HOTriggerPrimitiveDigi {
0016 public:
0017 typedef HcalDetId key_type;
0018
0019 HOTriggerPrimitiveDigi() { theHO_TP = 0; }
0020 HOTriggerPrimitiveDigi(uint32_t data) { theHO_TP = data; }
0021 HOTriggerPrimitiveDigi(int ieta, int iphi, int nsamples, int whichSampleTriggered, int databits);
0022
0023 const HcalDetId id() const { return HcalDetId(HcalOuter, ieta(), iphi(), 4); }
0024
0025
0026 uint32_t raw() const { return theHO_TP; }
0027
0028 int raw_ieta() const { return theHO_TP & 0x1F; }
0029
0030 int ieta_sign() const { return ((theHO_TP & 0x10) ? (-1) : (1)); }
0031
0032 int ieta_abs() const { return (theHO_TP & 0x000F); }
0033
0034 int ieta() const { return ieta_abs() * ieta_sign(); }
0035
0036 int iphi() const { return (theHO_TP >> 5) & 0x007F; }
0037
0038 int nsamples() const { return (theHO_TP >> 12) & 0x000F; }
0039
0040 int whichSampleTriggered() const { return (theHO_TP >> 16) & 0x000F; }
0041
0042 int bits() const { return (theHO_TP >> 20) & 0x03FF; }
0043
0044 static const int HO_TP_SAMPLES_MAX = 10;
0045
0046
0047
0048 bool data(int whichbit = HO_TP_SAMPLES_MAX) const;
0049
0050
0051 uint32_t operator()() { return theHO_TP; }
0052
0053 private:
0054 uint32_t theHO_TP;
0055 };
0056
0057 std::ostream& operator<<(std::ostream&, const HOTriggerPrimitiveDigi&);
0058
0059 #endif