Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:08:37

0001 #ifndef DQM_SiStripCommissioningSummary_ViewTranslator_H
0002 #define DQM_SiStripCommissioningSummary_ViewTranslator_H
0003 
0004 #include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h"
0005 #include <vector>
0006 #include <string>
0007 #include <map>
0008 #include <cstdint>
0009 
0010 /**
0011    \class ViewTranslator
0012    \author P.Kalavase, R.Bainbridge
0013    
0014    Utility class that maps Fed and Det keys with the Fec Keys, saves
0015    them in a root file and also extracts fec keys if given a fed/det
0016    key
0017 */
0018 class ViewTranslator {
0019 public:
0020   /** Mapping type between different keys. */
0021   typedef std::map<uint32_t, uint32_t> Mapping;
0022 
0023   // -------------------- Build maps --------------------
0024 
0025   /** Build maps from FED cabling object */
0026   static void buildMaps(const SiStripFedCabling&, Mapping& det_to_fec, Mapping& fed_to_fec);
0027 
0028   /** Build "reduced" map based on "masked" FED key */
0029   uint32_t fedToFec(const uint32_t& fed_key_mask, const Mapping& input, Mapping& output);
0030 
0031   /** Build "reduced" map based on "masked" DET key */
0032   uint32_t detToFec(const uint32_t& det_key_mask, const Mapping& input, Mapping& output);
0033 
0034   // -------------------- Root IO --------------------
0035 
0036   //arguments are the root file name, the uint32_t det key to be unpacked, and the map to be filled with
0037   //the matching complete fed and fec keys
0038   void detToFec(std::string root_filename, uint32_t& det_key_mask, Mapping& det_to_fec) { ; }
0039 
0040   //arguments are the root file name, the uint32_t fed key to be unpacked, and the map to be filled with
0041   //the matching complete fed and fec keys
0042   void fedToFec(std::string root_filename, uint32_t& fed_key_mask, Mapping& fed_to_fec) { ; }
0043 
0044   //arguments are the root file name, the det to fec translation map and the fed to fec translational
0045   //maps (from makemaps)
0046   void writeMapsToFile(std::string root_filename, Mapping& det_to_fec, Mapping& fed_to_fec);
0047 
0048 private:
0049   /** Root filename. */
0050   std::string rootfile_;
0051 
0052   // Some constants
0053   static const uint16_t fedIdMask_ = 0xFFF;
0054   static const uint16_t fedFeMask_ = 0xF;
0055   static const uint16_t fedChMask_ = 0xFF;
0056 };
0057 
0058 #endif  // DQM_SiStripCommissioningSummary_ViewTranslator_H