Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:47:22

0001 #ifndef PixelHdwAddress_h
0002 #define PixelHdwAddress_h
0003 /**
0004 *   \file CalibFormats/SiPixelObjects/interface/PixelHdwAddress.h
0005 *   \brief Store mfec, mfecchannel etc.
0006 *
0007 *   A longer explanation will be placed here later
0008 */
0009 
0010 #include <iosfwd>
0011 #include <string>
0012 
0013 namespace pos {
0014   /*! \class PixelHdwAddress PixelHdwAddress.h "interface/PixelHdwAddress.h"
0015 *   \brief Store mfec, mfecchannel etc.
0016 *
0017 *   A longer explanation will be placed here later
0018 */
0019   class PixelHdwAddress;
0020 
0021   std::ostream& operator<<(std::ostream& s, const PixelHdwAddress& pixelroc);
0022 
0023   class PixelHdwAddress {
0024   public:
0025     PixelHdwAddress();
0026 
0027     PixelHdwAddress(int fecnumber,
0028                     int mfec,
0029                     int mfecchannel,
0030                     int hubaddress,
0031                     int portaddress,
0032                     int rocid,
0033                     int fednumber,
0034                     int fedchannel,
0035                     int fedrocnumber);
0036 
0037     unsigned int fecnumber() const { return fecnumber_; }
0038     unsigned int mfec() const { return mfec_; }
0039     unsigned int mfecchannel() const { return mfecchannel_; }
0040     unsigned int hubaddress() const { return hubaddress_; }
0041     unsigned int portaddress() const { return portaddress_; }
0042     unsigned int rocid() const { return rocid_; }
0043     unsigned int fednumber() const { return fednumber_; }
0044     unsigned int fedchannel() const { return fedchannel_; }
0045     unsigned int fedrocnumber() const { return fedrocnumber_; }
0046 
0047     friend std::ostream& pos::operator<<(std::ostream& s, const PixelHdwAddress& pixelroc);
0048 
0049     const PixelHdwAddress& operator=(const PixelHdwAddress& aROC);
0050 
0051     bool operator()(const PixelHdwAddress& roc1, const PixelHdwAddress& roc2) const;
0052 
0053     // Checks for equality of all parts except the ROC numbers and portaddress.
0054     const bool operator|=(const PixelHdwAddress& aHdwAddress) const {
0055       return (fecnumber_ == aHdwAddress.fecnumber_ && mfec_ == aHdwAddress.mfec_ &&
0056               mfecchannel_ == aHdwAddress.mfecchannel_ && hubaddress_ == aHdwAddress.hubaddress_ &&
0057               fednumber_ == aHdwAddress.fednumber_ && fedchannel_ == aHdwAddress.fedchannel_);
0058     }
0059 
0060     const bool operator<(const PixelHdwAddress& aHdwAddress) const {
0061       if (fednumber_ < aHdwAddress.fednumber_)
0062         return true;
0063       if (fednumber_ > aHdwAddress.fednumber_)
0064         return false;
0065       if (fedchannel_ < aHdwAddress.fedchannel_)
0066         return true;
0067       if (fedchannel_ > aHdwAddress.fedchannel_)
0068         return false;
0069       return (fedrocnumber_ < aHdwAddress.fedrocnumber_);
0070     }
0071 
0072     void setAddress(std::string what, int value);                                                  // Added by Dario
0073     void compare(std::string what, bool& changed, unsigned int newValue, unsigned int& oldValue);  // Added by Dario
0074 
0075   private:
0076     unsigned int fecnumber_;
0077     unsigned int mfec_;
0078     unsigned int mfecchannel_;
0079     unsigned int portaddress_;
0080     unsigned int hubaddress_;
0081     unsigned int rocid_;
0082     unsigned int fednumber_;
0083     unsigned int fedchannel_;
0084     unsigned int fedrocnumber_;
0085   };
0086 
0087 }  // namespace pos
0088 #endif