00001 #ifndef DIGIHCAL_HOTRIGGERPRIMITIVEDIGI_H 00002 #define DIGIHCAL_HOTRIGGERPRIMITIVEDIGI_H 00003 00004 #include <boost/cstdint.hpp> 00005 #include <ostream> 00006 #include "DataFormats/HcalDetId/interface/HcalDetId.h" 00007 00017 class HOTriggerPrimitiveDigi { 00018 public: 00019 typedef HcalDetId key_type; 00020 00021 HOTriggerPrimitiveDigi() { theHO_TP=0; } 00022 HOTriggerPrimitiveDigi(uint32_t data) { theHO_TP=data; } 00023 HOTriggerPrimitiveDigi(int ieta, int iphi, int nsamples, int whichSampleTriggered, int databits); 00024 00025 const HcalDetId id() const { return HcalDetId(HcalOuter,ieta(),iphi(),4); } 00026 00028 uint32_t raw() const { return theHO_TP; } 00030 int raw_ieta() const { return theHO_TP&0x1F; } 00032 int ieta_sign() const { return ((theHO_TP&0x10)?(-1):(1)); } 00034 int ieta_abs() const { return (theHO_TP&0x000F); } 00036 int ieta() const { return ieta_abs()*ieta_sign(); } 00038 int iphi() const { return (theHO_TP>>5)&0x007F; } 00040 int nsamples() const { return (theHO_TP>>12)&0x000F; } 00042 int whichSampleTriggered() const { return (theHO_TP>>16)&0x000F; } 00044 int bits() const { return (theHO_TP>>20)&0x03FF; } 00045 00046 static const int HO_TP_SAMPLES_MAX = 10; 00047 00050 bool data(int whichbit=HO_TP_SAMPLES_MAX) const; 00051 00053 uint32_t operator()() { return theHO_TP; } 00054 00055 private: 00056 uint32_t theHO_TP; 00057 }; 00058 00059 std::ostream& operator<<(std::ostream&, const HOTriggerPrimitiveDigi&); 00060 00061 #endif