CMS 3D CMS Logo

PixelNameTranslation.h
Go to the documentation of this file.
1 #ifndef PixelNameTranslation_h
2 #define PixelNameTranslation_h
3 
12 #include <map>
13 #include <string>
14 #include <vector>
15 #include <list>
16 #include <set>
17 #include <iostream>
18 
25 
26 namespace pos{
27 
28  class PixelDetectorConfig;
29 
42 
43  public:
44 
45  PixelNameTranslation(std::vector< std::vector<std::string> > &tableMat);
47 
48  ~PixelNameTranslation() override{}
49 
50  // Probably these functions should never be used, and instead we should call similar functions in PixelDetectorConfig.
51  std::list<const PixelROCName*> getROCs() const;
52  std::list<const PixelModuleName*> getModules() const;
53  std::set<PixelChannel> getChannels() const; // returns all channels
54  std::set<PixelChannel> getChannels(const PixelDetectorConfig& aDetectorConfig) const; // only returns channels on modules found in the detector config
55 
56  const PixelHdwAddress* getHdwAddress(const PixelROCName& aROC) const;
57 
58  //Should really use a different type of hdw address for a channel
59  const PixelHdwAddress& getHdwAddress(const PixelChannel& aChannel) const;
60  const PixelHdwAddress& firstHdwAddress(const PixelModuleName& aModule) const;
61 
62  const bool checkFor(const PixelROCName& aROC) const ;
63 
64  // Added for Debbie (used there only) to allow integrity checks (Dario)
65  bool checkROCExistence(const PixelROCName& aROC) const ;
66 
67  const PixelChannel& getChannelForROC(const PixelROCName& aROC) const;
68  std::set< PixelChannel > getChannelsOnModule(const PixelModuleName& aModule) const;
69 
70  friend std::ostream& operator<<(std::ostream& s, const PixelNameTranslation& table);
71 
72  const std::vector<PixelROCName>& getROCsFromFEDChannel(unsigned int fednumber,
73  unsigned int fedchannel) const;
74 
75  PixelROCName ROCNameFromFEDChannelROC(unsigned int fednumber,
76  unsigned int channel,
77  unsigned int roc) const;
78 
79  bool ROCNameFromFEDChannelROCExists(unsigned int fednumber,
80  unsigned int channel,
81  unsigned int roc) const;
82 
83  PixelChannel ChannelFromFEDChannel(unsigned int fednumber, unsigned int fedchannel) const;
84 
85  bool FEDChannelExist(unsigned int fednumber, unsigned int fedchannel) const;
86 
87  const std::vector<PixelROCName>& getROCsFromChannel(const PixelChannel& aChannel) const;
88  std::vector<PixelROCName> getROCsFromModule(const PixelModuleName& aModule) const;
89 
90  void writeASCII(std::string dir="") const override;
91  void writeXML( pos::PixelConfigKey key, int version, std::string path) const override ;
93  int version,
94  std::string path,
95  std::ofstream *out,
96  std::ofstream *out1 = nullptr,
97  std::ofstream *out2 = nullptr
98  ) const override ;
99  void writeXML( std::ofstream *out,
100  std::ofstream *out1 = nullptr ,
101  std::ofstream *out2 = nullptr ) const override ;
102  void writeXMLTrailer( std::ofstream *out,
103  std::ofstream *out1 = nullptr,
104  std::ofstream *out2 = nullptr
105  ) const override ;
106 
107  bool ROCexists(PixelROCName theROC) ; // Added by Dario
108  const PixelChannel& getChannelFromHdwAddress(const PixelHdwAddress& aHdwAddress) const;
109 
110 
111  std::map <unsigned int, std::set<unsigned int> > getFEDsAndChannels() const;
112 
113  private:
114 
115 
116  std::map<PixelROCName,PixelHdwAddress> translationtable_;
117 
118  std::map<PixelHdwAddress, PixelROCName, PixelHdwAddress> fedlookup_;
119 
120  // This is a bit ugly, since the PixelHdwAddress contains the ROC number, which isn't really relevant to a PixelChannel.
121  std::map<PixelChannel, PixelHdwAddress > channelTranslationTable_;
122  std::map<PixelHdwAddress, PixelChannel > hdwTranslationTable_;
123 
124  std::map<unsigned int, std::map<unsigned int, std::vector<PixelROCName> > > rocsFromFEDidAndChannel_;
125  // FED id FED channel
126 
127  std::vector<PixelROCName> buildROCsFromFEDChannel(unsigned int fednumber,
128  unsigned int fedchannel) const;
129 
130 
131  };
132 }
133 /* @} */
134 #endif
std::vector< PixelROCName > getROCsFromModule(const PixelModuleName &aModule) const
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const
std::list< const PixelModuleName * > getModules() const
This file contains the base class for "pixel configuration data" management.
void writeASCII(std::string dir="") const override
PixelChannel ChannelFromFEDChannel(unsigned int fednumber, unsigned int fedchannel) const
PixelNameTranslation(std::vector< std::vector< std::string > > &tableMat)
const PixelChannel & getChannelFromHdwAddress(const PixelHdwAddress &aHdwAddress) const
Store mfec, mfecchannel etc.
void writeXMLTrailer(std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
This class implements...
bool checkROCExistence(const PixelROCName &aROC) const
std::map< PixelROCName, PixelHdwAddress > translationtable_
std::set< PixelChannel > getChannels() const
This class provides a translation from the naming documents standard to specify the ROC to the corres...
This class implements..
This file contains the base class for "pixel configuration data" management.
bool FEDChannelExist(unsigned int fednumber, unsigned int fedchannel) const
std::map< PixelHdwAddress, PixelChannel > hdwTranslationTable_
PixelROCName ROCNameFromFEDChannelROC(unsigned int fednumber, unsigned int channel, unsigned int roc) const
bool ROCNameFromFEDChannelROCExists(unsigned int fednumber, unsigned int channel, unsigned int roc) const
friend std::ostream & operator<<(std::ostream &s, const PixelNameTranslation &table)
bool ROCexists(PixelROCName theROC)
const PixelHdwAddress & firstHdwAddress(const PixelModuleName &aModule) const
This is the documentation about PixelDetectorConfig...
Store mfec, mfecchannel etc.
const bool checkFor(const PixelROCName &aROC) const
std::map< unsigned int, std::set< unsigned int > > getFEDsAndChannels() const
This class implements..
std::vector< PixelROCName > buildROCsFromFEDChannel(unsigned int fednumber, unsigned int fedchannel) const
std::list< const PixelROCName * > getROCs() const
std::set< PixelChannel > getChannelsOnModule(const PixelModuleName &aModule) const
This is the documentation about PixelNameTranslation...
std::map< PixelHdwAddress, PixelROCName, PixelHdwAddress > fedlookup_
const std::vector< PixelROCName > & getROCsFromFEDChannel(unsigned int fednumber, unsigned int fedchannel) const
This class implements..
This class implements..
Definition: PixelROCName.h:23
const std::vector< PixelROCName > & getROCsFromChannel(const PixelChannel &aChannel) const
dbl *** dir
Definition: mlp_gen.cc:35
void writeXML(pos::PixelConfigKey key, int version, std::string path) const override
std::map< unsigned int, std::map< unsigned int, std::vector< PixelROCName > > > rocsFromFEDidAndChannel_
void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
const PixelChannel & getChannelForROC(const PixelROCName &aROC) const
std::map< PixelChannel, PixelHdwAddress > channelTranslationTable_
This class stores the name and related hardware mappings for a ROC.