CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/CalibFormats/SiPixelObjects/interface/PixelPortcardMap.h

Go to the documentation of this file.
00001 #ifndef PixelPortcardMap_h
00002 #define PixelPortcardMap_h
00003 
00011 #include <string>
00012 #include <vector>
00013 #include <map>
00014 #include <set>
00015 #include "CalibFormats/SiPixelObjects/interface/PixelConfigBase.h"
00016 #include "CalibFormats/SiPixelObjects/interface/PixelModuleName.h"
00017 #include "CalibFormats/SiPixelObjects/interface/PixelTBMChannel.h"
00018 #include "CalibFormats/SiPixelObjects/interface/PixelChannel.h"
00019 #include "CalibFormats/SiPixelObjects/interface/PixelDetectorConfig.h"
00020 namespace pos{
00031   class PixelPortcardMap: public PixelConfigBase
00032   {
00033   public:
00034 
00035     PixelPortcardMap(std::string filename);
00036 
00037     PixelPortcardMap(std::vector< std::vector < std::string> > &tableMat);
00038 
00039     virtual ~PixelPortcardMap();
00040 
00041     // Get the port card and AOH associated with this module.  If the module has one(two) channels, this vector contains one(two) element(s).
00042     const std::set< std::pair< std::string, int > > PortCardAndAOHs(const PixelModuleName& aModule) const;
00043     //                            portcardname, aoh #
00044 
00045     const std::set< std::string > portcards(const PixelModuleName& aModule) const;
00046 
00047     int numChannels(const PixelModuleName& aModule) {return PortCardAndAOHs(aModule).size();}
00048 
00049     const std::pair< std::string, int > PortCardAndAOH(const PixelModuleName& aModule, const std::string& TBMChannel) const;
00050     const std::pair< std::string, int > PortCardAndAOH(const PixelModuleName& aModule, const PixelTBMChannel& TBMChannel) const;
00051     const std::pair< std::string, int > PortCardAndAOH(const PixelChannel& aChannel) const;
00052     
00053     // set of all modules attached to a port card
00054     std::set< PixelModuleName > modules(std::string portCardName) const;
00055 
00056     // all port cards in the map
00057     std::set< std::string > portcards(const PixelDetectorConfig* detconfig=0);
00058 
00059     // Added by Dario for Debbie (the PixelPortcardMap::portcards is way to slow for the interactive tool)
00060     bool getName(std::string moduleName, std::string &portcardName) ;
00061 
00062     virtual void writeASCII(std::string dir) const;
00063     void         writeXML(        pos::PixelConfigKey key, int version, std::string path) const {;}
00064     virtual void writeXMLHeader(  pos::PixelConfigKey key, 
00065                                   int version, 
00066                                   std::string path, 
00067                                   std::ofstream *out,
00068                                   std::ofstream *out1 = NULL,
00069                                   std::ofstream *out2 = NULL
00070                                   ) const ;
00071     virtual void writeXML(        std::ofstream *out,                                                       
00072                                   std::ofstream *out1 = NULL ,
00073                                   std::ofstream *out2 = NULL ) const ;
00074     virtual void writeXMLTrailer( std::ofstream *out, 
00075                                   std::ofstream *out1 = NULL,
00076                                   std::ofstream *out2 = NULL
00077                                   ) const ;
00078     
00079   private:
00080     //                               portcardname, AOH #
00081     std::map< PixelChannel, std::pair<std::string, int> > map_;
00082     
00083   };
00084 }
00085 /* @} */
00086 #endif