Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:14:50

0001 #ifndef CalibTracker_SiStripESProducers_SiStripFedCablingESProducer_H
0002 #define CalibTracker_SiStripESProducers_SiStripFedCablingESProducer_H
0003 
0004 #include "FWCore/Framework/interface/ESProducer.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 #include <memory>
0007 #include <cstdint>
0008 
0009 class SiStripFedCabling;
0010 class SiStripFedCablingRcd;
0011 
0012 /** 
0013     @class SiStripFedCablingESProducer
0014     @author R.Bainbridge
0015     @brief Abstract base class for producer of SiStripFedCabling record.
0016 */
0017 class SiStripFedCablingESProducer : public edm::ESProducer {
0018 public:
0019   SiStripFedCablingESProducer(const edm::ParameterSet&);
0020   ~SiStripFedCablingESProducer() override;
0021 
0022   /** Calls pure virtual make() method, to force concrete implementation. */
0023   virtual std::unique_ptr<SiStripFedCabling> produce(const SiStripFedCablingRcd&);
0024 
0025   SiStripFedCablingESProducer(const SiStripFedCablingESProducer&) = delete;
0026   const SiStripFedCablingESProducer& operator=(const SiStripFedCablingESProducer&) = delete;
0027 
0028 private:
0029   virtual SiStripFedCabling* make(const SiStripFedCablingRcd&) = 0;
0030 
0031 public:
0032   // Utility methods that generate "fake" control structure numbering
0033   static uint16_t fecCrate(const uint16_t& nth_module);  // 4 crates within system
0034   static uint16_t fecSlot(const uint16_t& nth_module);   // 11 FECs per crate
0035   static uint16_t fecRing(const uint16_t& nth_module);   // 8 control rings per FEC
0036   static uint16_t ccuAddr(const uint16_t& nth_module);   // 8 CCU modules per control ring
0037   static uint16_t ccuChan(const uint16_t& nth_module);   // 8 modules per CCU
0038 };
0039 
0040 // ---------- inline methods ----------
0041 
0042 inline uint16_t SiStripFedCablingESProducer::fecCrate(const uint16_t& module) {
0043   return (module / (8 * 8 * 8 * 11)) % 4 + 1;
0044 }
0045 inline uint16_t SiStripFedCablingESProducer::fecSlot(const uint16_t& module) { return (module / (8 * 8 * 8)) % 11 + 2; }
0046 inline uint16_t SiStripFedCablingESProducer::fecRing(const uint16_t& module) { return (module / (8 * 8)) % 8 + 1; }
0047 inline uint16_t SiStripFedCablingESProducer::ccuAddr(const uint16_t& module) { return (module / 8) % 8 + 1; }
0048 inline uint16_t SiStripFedCablingESProducer::ccuChan(const uint16_t& module) { return (module / 1) % 8 + 16; }
0049 
0050 #endif  // CalibTracker_SiStripESProducers_SiStripFedCablingESProducer_H