Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 
0002 #ifndef CalibFormats_SiStripObjects_SiStripFecCabling_H
0003 #define CalibFormats_SiStripObjects_SiStripFecCabling_H
0004 
0005 #include "CalibFormats/SiStripObjects/interface/NumberOfDevices.h"
0006 #include "CalibFormats/SiStripObjects/interface/SiStripFecCrate.h"
0007 #include "CondFormats/SiStripObjects/interface/FedChannelConnection.h"
0008 #include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h"
0009 #include <ostream>
0010 #include <sstream>
0011 #include <vector>
0012 #include <cstdint>
0013 
0014 class SiStripFecCabling;
0015 
0016 /** Debug info for SiStripFecCabling class. */
0017 std::ostream &operator<<(std::ostream &, const SiStripFecCabling &);
0018 
0019 /*
0020    @class SiStripFecCabling
0021    @author R.Bainbridge
0022    @brief FEC cabling object for the strip tracker.
0023 */
0024 class SiStripFecCabling {
0025 public:
0026   // ---------- Constructors, destructors ----------
0027 
0028   /** */
0029   SiStripFecCabling(const SiStripFedCabling &);
0030   /** */
0031   SiStripFecCabling() { ; }
0032   /** */
0033   ~SiStripFecCabling() { ; }  //@@ needs implementation!!
0034 
0035   // ---------- Methods to retrieve connection info ----------
0036 
0037   /** */
0038   inline const std::vector<SiStripFecCrate> &crates() const;
0039   inline std::vector<SiStripFecCrate> &crates();
0040   /** */
0041   inline const std::vector<SiStripFec> &fecs() const;  //@@ TEMPORARY: to maintain backward compatibility!
0042   /** */
0043   void connections(std::vector<FedChannelConnection> &) const;
0044   /** */
0045   const SiStripModule &module(const FedChannelConnection &conn) const;
0046   SiStripModule *module(const FedChannelConnection &conn);
0047   /** */
0048   const SiStripModule &module(const uint32_t &dcu_id) const;
0049   /** */
0050   NumberOfDevices countDevices() const;
0051   /** */
0052   void print(std::stringstream &) const;
0053   /** */
0054   void terse(std::stringstream &) const;
0055 
0056   // ---------- Methods used to build FEC cabling ----------
0057 
0058   /** */
0059   void buildFecCabling(const SiStripFedCabling &);
0060   /** */
0061   void addDevices(const FedChannelConnection &conn);
0062   /** */
0063   inline void dcuId(const FedChannelConnection &conn);
0064   /** */
0065   inline void detId(const FedChannelConnection &conn);
0066   /** */
0067   inline void nApvPairs(const FedChannelConnection &conn);
0068 
0069 private:
0070   /** */
0071   std::vector<SiStripFecCrate> crates_;
0072 };
0073 
0074 // ---------- Inline methods ----------
0075 
0076 const std::vector<SiStripFecCrate> &SiStripFecCabling::crates() const { return crates_; }
0077 std::vector<SiStripFecCrate> &SiStripFecCabling::crates() { return crates_; }
0078 
0079 // TEMPORARY method to maintain backward compatibility!
0080 const std::vector<SiStripFec> &SiStripFecCabling::fecs() const {
0081   const static std::vector<SiStripFec> my_fecs;
0082   if (!crates_.empty()) {
0083     return crates_[0].fecs();
0084   } else {
0085     return my_fecs;
0086   }
0087 }
0088 
0089 void SiStripFecCabling::dcuId(const FedChannelConnection &conn) {
0090   auto m = module(conn);
0091   if (m) {
0092     m->dcuId(conn.dcuId());
0093   }
0094 }
0095 
0096 void SiStripFecCabling::detId(const FedChannelConnection &conn) {
0097   auto m = module(conn);
0098   if (m) {
0099     m->detId(conn.detId());
0100   }
0101 }
0102 
0103 void SiStripFecCabling::nApvPairs(const FedChannelConnection &conn) {
0104   auto m = module(conn);
0105   if (m) {
0106     m->nApvPairs(conn.nApvPairs());
0107   }
0108 }
0109 
0110 #endif  // CalibTracker_SiStripObjects_SiStripFecCabling_H
0111 
0112 /*
0113 
0114 inline void fedCh( const FedChannelConnection& conn ); //@@ needs to be
0115 implemented
0116 
0117 void SiStripFecCabling::fedCh( const FedChannelConnection& conn ) {
0118   module(conn).detId(conn.fedId());
0119   module(conn).detId(conn.fedCh());
0120 }
0121 
0122 */