Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:58:13

0001 #ifndef PixelPortcardMap_h
0002 #define PixelPortcardMap_h
0003 /**
0004 * \file CalibFormats/SiPixelObjects/interface/PixelPortcardMap.h
0005 * \brief This class provides the mapping between portcards and the modules controlled by the card
0006 *
0007 *   A longer explanation will be placed here later
0008 *
0009 */
0010 
0011 #include <string>
0012 #include <vector>
0013 #include <map>
0014 #include <set>
0015 #include "CalibFormats/SiPixelObjects/interface/PixelConfigBase.h"
0016 #include "CalibFormats/SiPixelObjects/interface/PixelModuleName.h"
0017 #include "CalibFormats/SiPixelObjects/interface/PixelTBMChannel.h"
0018 #include "CalibFormats/SiPixelObjects/interface/PixelChannel.h"
0019 #include "CalibFormats/SiPixelObjects/interface/PixelDetectorConfig.h"
0020 namespace pos {
0021   /*!  \ingroup ConfigurationObjects "Configuration Objects"
0022 *    
0023 *  @{
0024 *
0025 *  \class PixelPortCardConfig PixelPortCardConfig.h
0026 *  \brief This is the documentation about PixelNameTranslation...
0027 *
0028 *  This class provides the mapping between portcards and the modules controlled by the card
0029 *   
0030 */
0031   class PixelPortcardMap : public PixelConfigBase {
0032   public:
0033     PixelPortcardMap(std::string filename);
0034 
0035     PixelPortcardMap(std::vector<std::vector<std::string> > &tableMat);
0036 
0037     ~PixelPortcardMap() override;
0038 
0039     // Get the port card and AOH associated with this module.  If the module has one(two) channels, this vector contains one(two) element(s).
0040     const std::set<std::pair<std::string, int> > PortCardAndAOHs(const PixelModuleName &aModule) const;
0041     //                            portcardname, aoh #
0042 
0043     const std::set<std::string> portcards(const PixelModuleName &aModule) const;
0044 
0045     int numChannels(const PixelModuleName &aModule) { return PortCardAndAOHs(aModule).size(); }
0046 
0047     const std::pair<std::string, int> PortCardAndAOH(const PixelModuleName &aModule,
0048                                                      const std::string &TBMChannel) const;
0049     const std::pair<std::string, int> PortCardAndAOH(const PixelModuleName &aModule,
0050                                                      const PixelTBMChannel &TBMChannel) const;
0051     const std::pair<std::string, int> PortCardAndAOH(const PixelChannel &aChannel) const;
0052 
0053     // set of all modules attached to a port card
0054     std::set<PixelModuleName> modules(std::string portCardName) const;
0055 
0056     // all port cards in the map
0057     std::set<std::string> portcards(const PixelDetectorConfig *detconfig = nullptr);
0058 
0059     // Added by Dario for Debbie (the PixelPortcardMap::portcards is way to slow for the interactive tool)
0060     bool getName(std::string moduleName, std::string &portcardName);
0061 
0062     void writeASCII(std::string dir) const override;
0063     void writeXML(pos::PixelConfigKey key, int version, std::string path) const override { ; }
0064     void writeXMLHeader(pos::PixelConfigKey key,
0065                         int version,
0066                         std::string path,
0067                         std::ofstream *out,
0068                         std::ofstream *out1 = nullptr,
0069                         std::ofstream *out2 = nullptr) const override;
0070     void writeXML(std::ofstream *out, std::ofstream *out1 = nullptr, std::ofstream *out2 = nullptr) const override;
0071     void writeXMLTrailer(std::ofstream *out,
0072                          std::ofstream *out1 = nullptr,
0073                          std::ofstream *out2 = nullptr) const override;
0074 
0075   private:
0076     //                               portcardname, AOH #
0077     std::map<PixelChannel, std::pair<std::string, int> > map_;
0078   };
0079 }  // namespace pos
0080 /* @} */
0081 #endif