CMS 3D CMS Logo

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