Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:58:13

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     bool operator()(const PixelHdwAddress& roc1, const PixelHdwAddress& roc2) const;
0050 
0051     // Checks for equality of all parts except the ROC numbers and portaddress.
0052     const bool operator|=(const PixelHdwAddress& aHdwAddress) const {
0053       return (fecnumber_ == aHdwAddress.fecnumber_ && mfec_ == aHdwAddress.mfec_ &&
0054               mfecchannel_ == aHdwAddress.mfecchannel_ && hubaddress_ == aHdwAddress.hubaddress_ &&
0055               fednumber_ == aHdwAddress.fednumber_ && fedchannel_ == aHdwAddress.fedchannel_);
0056     }
0057 
0058     const bool operator<(const PixelHdwAddress& aHdwAddress) const {
0059       if (fednumber_ < aHdwAddress.fednumber_)
0060         return true;
0061       if (fednumber_ > aHdwAddress.fednumber_)
0062         return false;
0063       if (fedchannel_ < aHdwAddress.fedchannel_)
0064         return true;
0065       if (fedchannel_ > aHdwAddress.fedchannel_)
0066         return false;
0067       return (fedrocnumber_ < aHdwAddress.fedrocnumber_);
0068     }
0069 
0070     void setAddress(std::string what, int value);                                                  // Added by Dario
0071     void compare(std::string what, bool& changed, unsigned int newValue, unsigned int& oldValue);  // Added by Dario
0072 
0073   private:
0074     unsigned int fecnumber_;
0075     unsigned int mfec_;
0076     unsigned int mfecchannel_;
0077     unsigned int portaddress_;
0078     unsigned int hubaddress_;
0079     unsigned int rocid_;
0080     unsigned int fednumber_;
0081     unsigned int fedchannel_;
0082     unsigned int fedrocnumber_;
0083   };
0084 
0085 }  // namespace pos
0086 #endif