PixelPortcardMap

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
#ifndef PixelPortcardMap_h
#define PixelPortcardMap_h
/**
* \file CalibFormats/SiPixelObjects/interface/PixelPortcardMap.h
* \brief This class provides the mapping between portcards and the modules controlled by the card
*
*   A longer explanation will be placed here later
*
*/

#include <string>
#include <vector>
#include <map>
#include <set>
#include "CalibFormats/SiPixelObjects/interface/PixelConfigBase.h"
#include "CalibFormats/SiPixelObjects/interface/PixelModuleName.h"
#include "CalibFormats/SiPixelObjects/interface/PixelTBMChannel.h"
#include "CalibFormats/SiPixelObjects/interface/PixelChannel.h"
#include "CalibFormats/SiPixelObjects/interface/PixelDetectorConfig.h"
namespace pos {
  /*!  \ingroup ConfigurationObjects "Configuration Objects"
*    
*  @{
*
*  \class PixelPortCardConfig PixelPortCardConfig.h
*  \brief This is the documentation about PixelNameTranslation...
*
*  This class provides the mapping between portcards and the modules controlled by the card
*   
*/
  class PixelPortcardMap : public PixelConfigBase {
  public:
    PixelPortcardMap(std::string filename);

    PixelPortcardMap(std::vector<std::vector<std::string> > &tableMat);

    ~PixelPortcardMap() override;

    // Get the port card and AOH associated with this module.  If the module has one(two) channels, this vector contains one(two) element(s).
    const std::set<std::pair<std::string, int> > PortCardAndAOHs(const PixelModuleName &aModule) const;
    //                            portcardname, aoh #

    const std::set<std::string> portcards(const PixelModuleName &aModule) const;

    int numChannels(const PixelModuleName &aModule) { return PortCardAndAOHs(aModule).size(); }

    const std::pair<std::string, int> PortCardAndAOH(const PixelModuleName &aModule,
                                                     const std::string &TBMChannel) const;
    const std::pair<std::string, int> PortCardAndAOH(const PixelModuleName &aModule,
                                                     const PixelTBMChannel &TBMChannel) const;
    const std::pair<std::string, int> PortCardAndAOH(const PixelChannel &aChannel) const;

    // set of all modules attached to a port card
    std::set<PixelModuleName> modules(std::string portCardName) const;

    // all port cards in the map
    std::set<std::string> portcards(const PixelDetectorConfig *detconfig = nullptr);

    // Added by Dario for Debbie (the PixelPortcardMap::portcards is way to slow for the interactive tool)
    bool getName(std::string moduleName, std::string &portcardName);

    void writeASCII(std::string dir) const override;
    void writeXML(pos::PixelConfigKey key, int version, std::string path) const override { ; }
    void writeXMLHeader(pos::PixelConfigKey key,
                        int version,
                        std::string path,
                        std::ofstream *out,
                        std::ofstream *out1 = nullptr,
                        std::ofstream *out2 = nullptr) const override;
    void writeXML(std::ofstream *out, std::ofstream *out1 = nullptr, std::ofstream *out2 = nullptr) const override;
    void writeXMLTrailer(std::ofstream *out,
                         std::ofstream *out1 = nullptr,
                         std::ofstream *out2 = nullptr) const override;

  private:
    //                               portcardname, AOH #
    std::map<PixelChannel, std::pair<std::string, int> > map_;
  };
}  // namespace pos
/* @} */
#endif