CMS 3D CMS Logo

PixelNameTranslation.h

Go to the documentation of this file.
00001 #ifndef PixelNameTranslation_h
00002 #define PixelNameTranslation_h
00003 
00012 #include <map>
00013 #include <string>
00014 #include <vector>
00015 #include <list>
00016 #include <set>
00017 #include <iostream>
00018 
00019 #include "CalibFormats/SiPixelObjects/interface/PixelConfigBase.h"
00020 #include "CalibFormats/SiPixelObjects/interface/PixelNameTranslation.h"
00021 #include "CalibFormats/SiPixelObjects/interface/PixelROCName.h"
00022 #include "CalibFormats/SiPixelObjects/interface/PixelModuleName.h"
00023 #include "CalibFormats/SiPixelObjects/interface/PixelChannel.h"
00024 #include "CalibFormats/SiPixelObjects/interface/PixelHdwAddress.h"
00025 
00026 namespace pos{
00027 
00028   class PixelDetectorConfig;
00029 
00041   class PixelNameTranslation: public PixelConfigBase {
00042 
00043   public:
00044  
00045     PixelNameTranslation(std::vector< std::vector<std::string> > &tableMat);
00046     PixelNameTranslation(std::string filename);
00047 
00048     virtual ~PixelNameTranslation(){}
00049 
00050     // Probably these functions should never be used, and instead we should call similar functions in PixelDetectorConfig.
00051     std::list<const PixelROCName*> getROCs() const;
00052     std::list<const PixelModuleName*> getModules() const;
00053     std::set<PixelChannel> getChannels() const; // returns all channels
00054     std::set<PixelChannel> getChannels(const PixelDetectorConfig& aDetectorConfig) const; // only returns channels on modules found in the detector config
00055 
00056     const PixelHdwAddress* getHdwAddress(const PixelROCName& aROC) const;
00057 
00058     //Should really use a different type of hdw address for a channel
00059     const PixelHdwAddress& getHdwAddress(const PixelChannel& aChannel) const;
00060     const PixelHdwAddress& firstHdwAddress(const PixelModuleName& aModule) const;
00061     
00062     const PixelChannel& getChannelForROC(const PixelROCName& aROC) const;
00063     std::set< PixelChannel > getChannelsOnModule(const PixelModuleName& aModule) const;
00064     
00065     friend std::ostream& operator<<(std::ostream& s, const PixelNameTranslation& table);
00066 
00067     std::vector<PixelROCName> getROCsFromFEDChannel(unsigned int fednumber, 
00068                                                     unsigned int fedchannel) const;
00069 
00070     PixelROCName ROCNameFromFEDChannelROC(unsigned int fednumber, 
00071                                           unsigned int channel,
00072                                           unsigned int roc) const;
00073                                           
00074     bool ROCNameFromFEDChannelROCExists(unsigned int fednumber, 
00075                                         unsigned int channel,
00076                                         unsigned int roc) const;
00077                                           
00078     PixelChannel ChannelFromFEDChannel(unsigned int fednumber, unsigned int fedchannel) const;
00079 
00080     bool FEDChannelExist(unsigned int fednumber, unsigned int fedchannel) const;
00081                                           
00082     std::vector<PixelROCName> getROCsFromChannel(const PixelChannel& aChannel) const;
00083     std::vector<PixelROCName> getROCsFromModule(const PixelModuleName& aModule) const;
00084 
00085     void writeASCII(std::string dir="") const;
00086     void         writeXML(      pos::PixelConfigKey key, int version, std::string path)                     const   ;
00087     virtual void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const  {;}
00088     virtual void writeXML(                                                              std::ofstream *out) const  {;}
00089     virtual void writeXMLTrailer(                                                       std::ofstream *out) const  {;}
00090     
00091     bool ROCexists(PixelROCName theROC) ; // Added by Dario
00092     const PixelChannel& getChannelFromHdwAddress(const PixelHdwAddress& aHdwAddress) const;
00093 
00094 
00095     std::map <unsigned int, std::set<unsigned int> > getFEDsAndChannels() const;
00096 
00097   private:
00098   
00099         
00100     std::map<PixelROCName,PixelHdwAddress> translationtable_;  
00101 
00102     std::map<PixelHdwAddress, PixelROCName, PixelHdwAddress> fedlookup_;  
00103 
00104     // This is a bit ugly, since the PixelHdwAddress contains the ROC number, which isn't really relevant to a PixelChannel.
00105     std::map<PixelChannel, PixelHdwAddress > channelTranslationTable_;
00106 
00107   };
00108 }
00109 /* @} */
00110 #endif

Generated on Tue Jun 9 17:25:24 2009 for CMSSW by  doxygen 1.5.4