Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:35

0001 #ifndef HcalFrontEndId_h
0002 #define HcalFrontEndId_h
0003 
0004 #include <string>
0005 #include <cstdint>
0006 #include <iosfwd>
0007 
0008 class HcalFrontEndId {
0009 public:
0010   HcalFrontEndId() : hcalFrontEndId_(0) {}
0011   HcalFrontEndId(uint32_t id) { hcalFrontEndId_ = id; };
0012   HcalFrontEndId(const std::string& rbx, int rm, int pixel, int rmfiber, int fiberchannel, int qiecard, int adc);
0013   ~HcalFrontEndId();
0014   uint32_t rawId() const { return hcalFrontEndId_; }
0015 
0016   // index which uniquely identifies an RBX within HCAL
0017   int rbxIndex() const { return (hcalFrontEndId_ >> 18); }
0018   static const int maxRbxIndex = 0xFF;
0019   // index which uniquely identifies an RM (e.g. HPD) within HCAL
0020   int rmIndex() const { return ((rm() - 1) & 0x3) + (rbxIndex() << 2); }
0021   static const int maxRmIndex = 0x3FF;
0022 
0023   bool null() const { return hcalFrontEndId_ == 0; }
0024 
0025   std::string rbx() const;
0026   int rm() const { return ((hcalFrontEndId_ >> 15) & 0x7) + 1; }
0027   int pixel() const { return (hcalFrontEndId_ >> 10) & 0x1F; }
0028   int rmFiber() const { return ((hcalFrontEndId_ >> 7) & 0x7) + 1; }
0029   int fiberChannel() const { return (hcalFrontEndId_ >> 5) & 0x3; }
0030   int qieCard() const { return ((hcalFrontEndId_ >> 3) & 0x3) + 1; }
0031   int adc() const { return (hcalFrontEndId_ & 0x7) - 1; }
0032 
0033   int operator==(const HcalFrontEndId& id) const { return id.hcalFrontEndId_ == hcalFrontEndId_; }
0034   int operator!=(const HcalFrontEndId& id) const { return id.hcalFrontEndId_ != hcalFrontEndId_; }
0035   int operator<(const HcalFrontEndId& id) const { return hcalFrontEndId_ < id.hcalFrontEndId_; }
0036 
0037 private:
0038   uint32_t hcalFrontEndId_;
0039 };
0040 
0041 std::ostream& operator<<(std::ostream&, const HcalFrontEndId& id);
0042 
0043 #endif