CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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  public:
43  PixelNameTranslation(std::vector<std::vector<std::string> >& tableMat);
45 
46  ~PixelNameTranslation() override {}
47 
48  // Probably these functions should never be used, and instead we should call similar functions in PixelDetectorConfig.
49  std::list<const PixelROCName*> getROCs() const;
50  std::list<const PixelModuleName*> getModules() const;
51  std::set<PixelChannel> getChannels() const; // returns all channels
52  std::set<PixelChannel> getChannels(const PixelDetectorConfig& aDetectorConfig)
53  const; // only returns channels on modules found in the detector config
54 
55  const PixelHdwAddress* getHdwAddress(const PixelROCName& aROC) const;
56 
57  //Should really use a different type of hdw address for a channel
58  const PixelHdwAddress& getHdwAddress(const PixelChannel& aChannel) const;
59  const PixelHdwAddress& firstHdwAddress(const PixelModuleName& aModule) const;
60 
61  const bool checkFor(const PixelROCName& aROC) const;
62 
63  // Added for Debbie (used there only) to allow integrity checks (Dario)
64  bool checkROCExistence(const PixelROCName& aROC) const;
65 
66  const PixelChannel& getChannelForROC(const PixelROCName& aROC) const;
67  std::set<PixelChannel> getChannelsOnModule(const PixelModuleName& aModule) const;
68 
69  friend std::ostream& operator<<(std::ostream& s, const PixelNameTranslation& table);
70 
71  const std::vector<PixelROCName>& getROCsFromFEDChannel(unsigned int fednumber, unsigned int fedchannel) const;
72 
73  PixelROCName ROCNameFromFEDChannelROC(unsigned int fednumber, unsigned int channel, unsigned int roc) const;
74 
75  bool ROCNameFromFEDChannelROCExists(unsigned int fednumber, unsigned int channel, unsigned int roc) const;
76 
77  PixelChannel ChannelFromFEDChannel(unsigned int fednumber, unsigned int fedchannel) const;
78 
79  bool FEDChannelExist(unsigned int fednumber, unsigned int fedchannel) const;
80 
81  const std::vector<PixelROCName>& getROCsFromChannel(const PixelChannel& aChannel) const;
82  std::vector<PixelROCName> getROCsFromModule(const PixelModuleName& aModule) const;
83 
84  void writeASCII(std::string dir = "") const override;
85  void writeXML(pos::PixelConfigKey key, int version, std::string path) const override;
87  int version,
89  std::ofstream* out,
90  std::ofstream* out1 = nullptr,
91  std::ofstream* out2 = nullptr) const override;
92  void writeXML(std::ofstream* out, std::ofstream* out1 = nullptr, std::ofstream* out2 = nullptr) const override;
93  void writeXMLTrailer(std::ofstream* out,
94  std::ofstream* out1 = nullptr,
95  std::ofstream* out2 = nullptr) const override;
96 
97  bool ROCexists(PixelROCName theROC); // Added by Dario
98  const PixelChannel& getChannelFromHdwAddress(const PixelHdwAddress& aHdwAddress) const;
99 
100  std::map<unsigned int, std::set<unsigned int> > getFEDsAndChannels() const;
101 
102  private:
103  std::map<PixelROCName, PixelHdwAddress> translationtable_;
104 
105  std::map<PixelHdwAddress, PixelROCName, PixelHdwAddress> fedlookup_;
106 
107  // This is a bit ugly, since the PixelHdwAddress contains the ROC number, which isn't really relevant to a PixelChannel.
108  std::map<PixelChannel, PixelHdwAddress> channelTranslationTable_;
109  std::map<PixelHdwAddress, PixelChannel> hdwTranslationTable_;
110 
111  std::map<unsigned int, std::map<unsigned int, std::vector<PixelROCName> > > rocsFromFEDidAndChannel_;
112  // FED id FED channel
113 
114  std::vector<PixelROCName> buildROCsFromFEDChannel(unsigned int fednumber, unsigned int fedchannel) const;
115  };
116 } // namespace pos
117 /* @} */
118 #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 &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
std::map< PixelROCName, PixelHdwAddress > translationtable_
Store mfec, mfecchannel etc.
This class implements...
bool checkROCExistence(const PixelROCName &aROC) const
void writeXML(pos::PixelConfigKey key, int version, std::string path) const override
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..
std::map< PixelHdwAddress, PixelChannel > hdwTranslationTable_
This file contains the base class for &quot;pixel configuration data&quot; management.
bool FEDChannelExist(unsigned int fednumber, unsigned int fedchannel) const
PixelROCName ROCNameFromFEDChannelROC(unsigned int fednumber, unsigned int channel, unsigned int roc) const
bool ROCNameFromFEDChannelROCExists(unsigned int fednumber, unsigned int channel, unsigned int roc) const
void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
friend std::ostream & operator<<(std::ostream &s, const PixelNameTranslation &table)
bool ROCexists(PixelROCName theROC)
tuple key
prepare the HTCondor submission files and eventually submit them
void writeXMLTrailer(std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
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..
void writeASCII(std::string dir="") const override
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
tuple filename
Definition: lut2db_cfg.py:20
const std::vector< PixelROCName > & getROCsFromChannel(const PixelChannel &aChannel) const
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.