CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/CalibFormats/SiPixelObjects/interface/PixelHdwAddress.h

Go to the documentation of this file.
00001 #ifndef PixelHdwAddress_h
00002 #define PixelHdwAddress_h
00003 
00010 #include <iosfwd>
00011 #include <string>
00012 
00013 namespace pos{
00019   class PixelHdwAddress {
00020 
00021   public:
00022 
00023     PixelHdwAddress();
00024 
00025     PixelHdwAddress(int fecnumber,  int mfec,        int mfecchannel,
00026                     int hubaddress, int portaddress, int rocid,
00027                     int fednumber,  int fedchannel,  int fedrocnumber);
00028     
00029 
00030     unsigned int fecnumber()    const { return fecnumber_;    }
00031     unsigned int mfec()         const { return mfec_;         }
00032     unsigned int mfecchannel()  const { return mfecchannel_;  }
00033     unsigned int hubaddress()   const { return hubaddress_;   }
00034     unsigned int portaddress()  const { return portaddress_;  }
00035     unsigned int rocid()        const { return rocid_;        }
00036     unsigned int fednumber()    const { return fednumber_;    }
00037     unsigned int fedchannel()   const { return fedchannel_;   }
00038     unsigned int fedrocnumber() const { return fedrocnumber_; }
00039 
00040 
00041     friend std::ostream& pos::operator<<(std::ostream& s, const PixelHdwAddress& pixelroc);
00042 
00043 
00044     const PixelHdwAddress& operator=(const PixelHdwAddress& aROC);
00045 
00046     bool operator()(const PixelHdwAddress& roc1, const PixelHdwAddress& roc2) const;
00047     
00048     // Checks for equality of all parts except the ROC numbers and portaddress.
00049     const bool operator|=(const PixelHdwAddress& aHdwAddress) const{
00050       return ( fecnumber_    == aHdwAddress.fecnumber_ &&
00051                mfec_         == aHdwAddress.mfec_ &&
00052                mfecchannel_  == aHdwAddress.mfecchannel_ &&
00053                hubaddress_   == aHdwAddress.hubaddress_ &&
00054                fednumber_    == aHdwAddress.fednumber_ &&
00055                fedchannel_   == aHdwAddress.fedchannel_ );
00056     }
00057 
00058     const bool operator<(const PixelHdwAddress& aHdwAddress) const{
00059       if (fednumber_ < aHdwAddress.fednumber_ ) return true;
00060       if (fednumber_ > aHdwAddress.fednumber_ ) return false;
00061       if (fedchannel_ < aHdwAddress.fedchannel_ ) return true;
00062       if (fedchannel_ > aHdwAddress.fedchannel_ ) return false;
00063       return (fedrocnumber_ < aHdwAddress.fedrocnumber_ );
00064     }
00065 
00066     void setAddress(std::string what, int value);                                                    // Added by Dario
00067     void compare(   std::string what, bool &changed, unsigned int newValue, unsigned int &oldValue); // Added by Dario
00068 
00069   private:
00070 
00071 
00072     unsigned int fecnumber_;  
00073     unsigned int mfec_;  
00074     unsigned int mfecchannel_;  
00075     unsigned int portaddress_;  
00076     unsigned int hubaddress_;  
00077     unsigned int rocid_;  
00078     unsigned int fednumber_;  
00079     unsigned int fedchannel_;  
00080     unsigned int fedrocnumber_;  
00081 
00082     
00083   };
00084   std::ostream& operator<<(std::ostream& s, const PixelHdwAddress& pixelroc);
00085   
00086 }
00087 #endif