CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/CondFormats/SiStripObjects/interface/FedChannelConnection.h

Go to the documentation of this file.
00001 #ifndef CondFormats_SiStripObjects_FedChannelConnection_H
00002 #define CondFormats_SiStripObjects_FedChannelConnection_H
00003 
00004 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
00005 #include <boost/cstdint.hpp>
00006 #include <ostream>
00007 #include <sstream>
00008 
00009 class FedChannelConnection;
00010 
00012 std::ostream& operator<< ( std::ostream&, const FedChannelConnection& );
00013 
00015 bool operator< ( const FedChannelConnection&, const FedChannelConnection& );
00016 
00024 class FedChannelConnection {
00025   
00026  public:
00027 
00028   // ---------- Constructor ----------
00029 
00032   FedChannelConnection( const uint16_t& fec_crate, 
00033                         const uint16_t& fec_slot, 
00034                         const uint16_t& fec_ring, 
00035                         const uint16_t& ccu_addr, 
00036                         const uint16_t& ccu_chan, 
00037                         const uint16_t& apv0 = 0,
00038                         const uint16_t& apv1 = 0,
00039                         const uint32_t& dcu_id = 0,
00040                         const uint32_t& det_id = 0,
00041                         const uint16_t& pairs  = 0,
00042                         const uint16_t& fed_id = 0,
00043                         const uint16_t& fed_ch = 0,
00044                         const uint16_t& length = 0,
00045                         const bool& dcu = false,
00046                         const bool& pll = false,
00047                         const bool& mux = false,
00048                         const bool& lld = false );
00049   
00051   FedChannelConnection();
00052   
00054   ~FedChannelConnection() {;}
00055 
00056   // ---------- Utility methods ----------
00057   
00059   bool isConnected() const;
00060   
00062   void consistencyCheck() const {;} //@@ TO BE IMPLEMENTED...
00063   
00065   void print( std::stringstream& ) const;
00066   
00068   void terse( std::stringstream& ) const;
00069   
00070   // -------------------- Module and detector information --------------------
00071 
00073   const uint32_t& dcuId() const;
00074 
00076   const uint32_t& detId() const;
00077 
00079   uint16_t nDetStrips() const;
00080 
00082   const uint16_t& nApvPairs() const;
00083 
00085   uint16_t nApvs() const;
00086   
00087   // -------------------- FED connection information --------------------
00088 
00091   uint16_t apvPairNumber() const;
00092 
00094   uint16_t lldChannel() const;
00095 
00097   const uint16_t& fedCrate() const;
00098   
00100   const uint16_t& fedSlot() const;
00101   
00103   const uint16_t& fedId() const;
00104   
00106   const uint16_t& fedCh() const;
00107 
00109   void fedCrate( uint16_t& fed_crate );
00110 
00112   void fedSlot( uint16_t& fed_slot );
00113 
00115   void fedId( uint16_t& fed_id );
00116 
00118   void fedCh( uint16_t& fed_ch );
00119 
00120   // -------------------- Control structure information --------------------
00121 
00123   const uint16_t& fecCrate() const;
00124 
00126   const uint16_t& fecSlot() const;
00127 
00129   const uint16_t& fecRing() const;
00130 
00132   const uint16_t& ccuAddr() const;
00133 
00135   const uint16_t& ccuChan() const;
00136 
00137   // -------------------- Front-end ASICs --------------------
00138 
00142   const uint16_t& i2cAddr( const uint16_t& apv0_or_1 ) const; 
00143   
00145   const bool& dcu() const;
00146 
00148   const bool& mux() const;
00149 
00151   const bool& pll() const;
00152 
00154   const bool& lld() const;
00155 
00157   const uint16_t& fiberLength() const;
00158   
00159  private:
00160   
00161   // ---------- Private member data ----------
00162   
00163   // Control
00164   uint16_t fecCrate_;
00165   uint16_t fecSlot_;
00166   uint16_t fecRing_;
00167   uint16_t ccuAddr_;
00168   uint16_t ccuChan_;
00169 
00170   // I2C addresses
00171   uint16_t apv0_; 
00172   uint16_t apv1_; 
00173 
00174   // Module / Detector
00175   uint32_t dcuId_;
00176   uint32_t detId_;
00177   uint16_t nApvPairs_;
00178 
00179   // FED
00180   uint16_t fedCrate_;
00181   uint16_t fedSlot_;
00182   uint16_t fedId_;
00183   uint16_t fedCh_;
00184   uint16_t length_;
00185 
00186   // Found devices
00187   bool dcu0x00_; 
00188   bool mux0x43_; 
00189   bool pll0x44_; 
00190   bool lld0x60_; 
00191 
00192 };
00193 
00194 // ---------- inline methods ----------
00195 
00196 inline bool FedChannelConnection::isConnected() const { 
00197   return ( fedId_ != sistrip::invalid_ && 
00198            fedCh_ != sistrip::invalid_ );
00199 }
00200 
00201 inline const uint16_t& FedChannelConnection::fecCrate() const { return fecCrate_; } 
00202 inline const uint16_t& FedChannelConnection::fecSlot() const { return fecSlot_; } 
00203 inline const uint16_t& FedChannelConnection::fecRing() const { return fecRing_; }
00204 inline const uint16_t& FedChannelConnection::ccuAddr() const { return ccuAddr_; }
00205 inline const uint16_t& FedChannelConnection::ccuChan() const { return ccuChan_; }
00206 
00207 inline const bool& FedChannelConnection::dcu() const { return dcu0x00_; }
00208 inline const bool& FedChannelConnection::mux() const { return mux0x43_; }
00209 inline const bool& FedChannelConnection::pll() const { return pll0x44_; }
00210 inline const bool& FedChannelConnection::lld() const { return lld0x60_; }
00211 
00212 inline const uint32_t& FedChannelConnection::dcuId() const { return dcuId_; }
00213 inline const uint32_t& FedChannelConnection::detId() const { return detId_; }
00214 inline uint16_t FedChannelConnection::nDetStrips() const { return 256*nApvPairs_; }
00215 inline const uint16_t& FedChannelConnection::nApvPairs() const { return nApvPairs_; }
00216 inline uint16_t FedChannelConnection::nApvs() const { return 2*nApvPairs(); }
00217 
00218 inline const uint16_t& FedChannelConnection::fedCrate() const { return fedCrate_; }
00219 inline const uint16_t& FedChannelConnection::fedSlot() const { return fedSlot_; }
00220 inline const uint16_t& FedChannelConnection::fedId() const { return fedId_; }
00221 inline const uint16_t& FedChannelConnection::fedCh() const { return fedCh_; }
00222 
00223 inline const uint16_t& FedChannelConnection::fiberLength() const { return length_; }
00224 
00225 inline void FedChannelConnection::fedId( uint16_t& fed_id ) { fedId_ = fed_id; }
00226 inline void FedChannelConnection::fedCh( uint16_t& fed_ch ) { fedCh_ = fed_ch; }
00227 inline void FedChannelConnection::fedCrate( uint16_t& fed_crate ) { fedCrate_ = fed_crate; }
00228 inline void FedChannelConnection::fedSlot( uint16_t& fed_slot ) { fedSlot_ = fed_slot; }
00229 
00230 #endif // CondFormats_SiStripObjects_FedChannelConnection_H
00231