CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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);
46  PixelNameTranslation(std::string filename);
47 
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;
91  void writeXML( pos::PixelConfigKey key, int version, std::string path) const ;
92  virtual void writeXMLHeader( pos::PixelConfigKey key,
93  int version,
94  std::string path,
95  std::ofstream *out,
96  std::ofstream *out1 = NULL,
97  std::ofstream *out2 = NULL
98  ) const ;
99  virtual void writeXML( std::ofstream *out,
100  std::ofstream *out1 = NULL ,
101  std::ofstream *out2 = NULL ) const ;
102  virtual void writeXMLTrailer( std::ofstream *out,
103  std::ofstream *out1 = NULL,
104  std::ofstream *out2 = NULL
105  ) const ;
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
list table
Definition: asciidump.py:386
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const
std::list< const PixelModuleName * > getModules() const
virtual void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
This file contains the base class for &quot;pixel configuration data&quot; management.
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.
#define NULL
Definition: scimark2.h:8
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..
int path() const
Definition: HLTadd.h:3
void writeXML(pos::PixelConfigKey key, int version, std::string path) const
This file contains the base class for &quot;pixel configuration data&quot; management.
virtual void writeXMLTrailer(std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
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...
void writeASCII(std::string dir="") const
Store mfec, mfecchannel etc.
const bool checkFor(const PixelROCName &aROC) const
std::map< unsigned int, std::set< unsigned int > > getFEDsAndChannels() const
This class implements..
tuple out
Definition: dbtoconf.py:99
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:20
list key
Definition: combine.py:13
tuple filename
Definition: lut2db_cfg.py:20
const std::vector< PixelROCName > & getROCsFromChannel(const PixelChannel &aChannel) const
string s
Definition: asciidump.py:422
dbl *** dir
Definition: mlp_gen.cc:35
std::map< unsigned int, std::map< unsigned int, std::vector< PixelROCName > > > rocsFromFEDidAndChannel_
const PixelChannel & getChannelForROC(const PixelROCName &aROC) const
std::map< PixelChannel, PixelHdwAddress > channelTranslationTable_
This class stores the name and related hardware mappings for a ROC.