CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
pos::PixelNameTranslation Class Reference

This is the documentation about PixelNameTranslation... More...

#include <PixelNameTranslation.h>

Inheritance diagram for pos::PixelNameTranslation:
pos::PixelConfigBase

Public Member Functions

PixelChannel ChannelFromFEDChannel (unsigned int fednumber, unsigned int fedchannel) const
 
const bool checkFor (const PixelROCName &aROC) const
 
bool checkROCExistence (const PixelROCName &aROC) const
 
bool FEDChannelExist (unsigned int fednumber, unsigned int fedchannel) const
 
const PixelHdwAddressfirstHdwAddress (const PixelModuleName &aModule) const
 
const PixelChannelgetChannelForROC (const PixelROCName &aROC) const
 
const PixelChannelgetChannelFromHdwAddress (const PixelHdwAddress &aHdwAddress) const
 
std::set< PixelChannelgetChannels () const
 
std::set< PixelChannelgetChannels (const PixelDetectorConfig &aDetectorConfig) const
 
std::set< PixelChannelgetChannelsOnModule (const PixelModuleName &aModule) const
 
std::map< unsigned int, std::set< unsigned int > > getFEDsAndChannels () const
 
const PixelHdwAddressgetHdwAddress (const PixelROCName &aROC) const
 
const PixelHdwAddressgetHdwAddress (const PixelChannel &aChannel) const
 
std::list< const PixelModuleName * > getModules () const
 
std::list< const PixelROCName * > getROCs () const
 
const std::vector< PixelROCName > & getROCsFromChannel (const PixelChannel &aChannel) const
 
const std::vector< PixelROCName > & getROCsFromFEDChannel (unsigned int fednumber, unsigned int fedchannel) const
 
std::vector< PixelROCNamegetROCsFromModule (const PixelModuleName &aModule) const
 
 PixelNameTranslation (std::vector< std::vector< std::string > > &tableMat)
 
 PixelNameTranslation (std::string filename)
 
bool ROCexists (PixelROCName theROC)
 
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 writeASCII (std::string dir="") const override
 
void writeXML (pos::PixelConfigKey key, int version, std::string path) const override
 
void writeXML (std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
void writeXMLTrailer (std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
 ~PixelNameTranslation () override
 
- Public Member Functions inherited from pos::PixelConfigBase
std::string creator ()
 
std::string date ()
 
std::string description ()
 
std::string getAuthor () const
 
std::string getComment () const
 
 PixelConfigBase (std::string description, std::string creator, std::string date)
 
void setAuthor (std::string author)
 
void setComment (std::string comment)
 
virtual void writeXML (std::ofstream *out) const
 
virtual void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const
 
virtual void writeXMLTrailer (std::ofstream *out) const
 
virtual ~PixelConfigBase ()
 

Private Member Functions

std::vector< PixelROCNamebuildROCsFromFEDChannel (unsigned int fednumber, unsigned int fedchannel) const
 

Private Attributes

std::map< PixelChannel, PixelHdwAddresschannelTranslationTable_
 
std::map< PixelHdwAddress, PixelROCName, PixelHdwAddressfedlookup_
 
std::map< PixelHdwAddress, PixelChannelhdwTranslationTable_
 
std::map< unsigned int, std::map< unsigned int, std::vector< PixelROCName > > > rocsFromFEDidAndChannel_
 
std::map< PixelROCName, PixelHdwAddresstranslationtable_
 

Friends

std::ostream & operator<< (std::ostream &s, const PixelNameTranslation &table)
 

Detailed Description

This is the documentation about PixelNameTranslation...

" "


This class provides a translation from the naming documents standard to specify the ROC to the corresponding set of mfec, mfecchanner, hubaddress portadd and rocid

Definition at line 41 of file PixelNameTranslation.h.

Constructor & Destructor Documentation

◆ PixelNameTranslation() [1/2]

PixelNameTranslation::PixelNameTranslation ( std::vector< std::vector< std::string > > &  tableMat)

Definition at line 22 of file PixelNameTranslation.cc.

References cms::cuda::assert(), DummyCfis::c, channelTranslationTable_, counter, gather_cfg::cout, pos::PixelHdwAddress::fecnumber(), pos::PixelHdwAddress::fedchannel(), fedlookup_, pos::PixelHdwAddress::fednumber(), getFEDsAndChannels(), hdwTranslationTable_, pos::PixelHdwAddress::hubaddress(), createfilelist::int, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, pos::PixelHdwAddress::mfec(), pos::PixelHdwAddress::mfecchannel(), create_idmaps::n, pos::PixelROCName::rocname(), ROCNameFromFEDChannelROCExists(), rocsFromFEDidAndChannel_, AlCaHLTBitMon_QueryRunRegistry::string, createJobs::tmp, and translationtable_.

23  : PixelConfigBase(" ", " ", " ") {
24  std::string mthn = "[PixelNameTranslation::PixelNameTranslation()]\t\t ";
25  std::map<std::string, int> colM;
26  std::vector<std::string> colNames;
27 
28  /*
29  EXTENSION_TABLE_NAME: PIXEL_NAME_TRANS (VIEW: CONF_KEY_NAME_TRANS_V)
30 
31  CONFIG_KEY NOT NULL VARCHAR2(80)
32  KEY_TYPE NOT NULL VARCHAR2(80)
33  KEY_ALIAS NOT NULL VARCHAR2(80)
34  VERSION VARCHAR2(40)
35  KIND_OF_COND NOT NULL VARCHAR2(40)
36  ROC_NAME NOT NULL VARCHAR2(200)
37  PXLFEC_NAME NOT NULL NUMBER(38)
38  MFEC_POSN NOT NULL NUMBER(38)
39  MFEC_CHAN NOT NULL NUMBER(38)
40  HUB_ADDRS NUMBER(38)
41  PORT_NUM NOT NULL NUMBER(38)
42  ROC_I2C_ADDR NOT NULL NUMBER(38)
43  PXLFED_NAME NOT NULL NUMBER(38)
44  FED_CHAN NOT NULL NUMBER(38)
45  FED_ROC_NUM NOT NULL NUMBER(38)
46  TBM_MODE VARCHAR2(200)
47 */
48 
49  colNames.push_back("CONFIG_KEY"); //0
50  colNames.push_back("KEY_TYPE"); //1
51  colNames.push_back("KEY_ALIAS"); //2
52  colNames.push_back("VERSION"); //3
53  colNames.push_back("KIND_OF_COND"); //4
54  colNames.push_back("ROC_NAME"); //5
55  colNames.push_back("PXLFEC_NAME"); //6
56  colNames.push_back("MFEC_POSN"); //7
57  colNames.push_back("MFEC_CHAN"); //8
58  colNames.push_back("HUB_ADDRS"); //9
59  colNames.push_back("PORT_NUM"); //10
60  colNames.push_back("ROC_I2C_ADDR"); //11
61  colNames.push_back("PXLFED_NAME"); //12
62  colNames.push_back("FED_CHAN"); //13
63  colNames.push_back("FED_ROC_NUM"); //14
64  colNames.push_back("TBM_MODE"); //15
65 
66  for (unsigned int c = 0; c < tableMat[0].size(); c++) {
67  for (unsigned int n = 0; n < colNames.size(); n++) {
68  if (tableMat[0][c] == colNames[n]) {
69  colM[colNames[n]] = c;
70  break;
71  }
72  }
73  } //end for
74  /*
75  for(unsigned int n=0; n<colNames.size(); n++){
76  if(colM.find(colNames[n]) == colM.end()){
77  std::cerr << __LINE__ << "]\t" << mthn << "Couldn't find in the database the column with name " << colNames[n] << std::endl;
78  assert(0);
79  }
80  }
81  */
82 
83  for (unsigned int r = 1; r < tableMat.size(); r++) { //Goes to every row of the Matrix
84  std::string rocname = tableMat[r][colM["ROC_NAME"]];
85  std::string TBMChannel = tableMat[r][colM["TBM_MODE"]]; // assert(0); // need to add this to the input table
86  if (TBMChannel.empty()) {
87  TBMChannel = "A";
88  }
89  /* // modified by MR on 13-07-2008 11:32:50
90  Umesh changed the content of the column and
91  stripped out the FPix_Pxl_FEC_ part of the "number"
92  tableMat[r][colM["PXLFEC_NAME"]].erase(0 , 13);//PIXFEC
93  unsigned int fecnumber = (unsigned int)atoi(tableMat[r][colM["PXLFEC_NAME"]].c_str());
94  */
95  unsigned int fecnumber = (unsigned int)atoi(tableMat[r][colM["PXLFEC_NAME"]].c_str());
96  unsigned int mfec = (unsigned int)atoi(tableMat[r][colM["MFEC_POSN"]].c_str());
97  unsigned int mfecchannel = (unsigned int)atoi(tableMat[r][colM["MFEC_CHAN"]].c_str());
98  unsigned int hubaddress = (unsigned int)atoi(tableMat[r][colM["HUB_ADDRS"]].c_str());
99  unsigned int portaddress = (unsigned int)atoi(tableMat[r][colM["PORT_NUM"]].c_str());
100  unsigned int rocid = (unsigned int)atoi(tableMat[r][colM["ROC_I2C_ADDR"]].c_str());
101  // modified by MR on 13-07-2008 11:47:32
102  /* Umesh changed the content of the column and
103  stripped out the PxlFED_ part of the "number"
104 
105  tableMat[r][colM["PXLFED_NAME"]].erase(0,7);//FED
106  */
107  unsigned int fednumber = (unsigned int)atoi(tableMat[r][colM["PXLFED_NAME"]].c_str());
108  unsigned int fedchannel = (unsigned int)atoi(tableMat[r][colM["FED_CHAN"]].c_str());
109  unsigned int fedrocnumber = (unsigned int)(atoi(tableMat[r][colM["FED_ROC_NUM"]].c_str()));
110 
111  PixelROCName aROC(rocname);
112  if (aROC.rocname() != rocname) {
113  std::cout << __LINE__ << "]\t" << mthn << "Rocname : " << rocname << std::endl;
114  std::cout << __LINE__ << "]\t" << mthn << "Parsed to: " << aROC.rocname() << std::endl;
115  assert(0);
116  }
117 
118  if (ROCNameFromFEDChannelROCExists(fednumber, fedchannel, fedrocnumber)) {
119  std::cout << __LINE__ << "]\t" << mthn << "ROC with fednumber=" << fednumber << " fedchannel=" << fedchannel
120  << " roc number=" << fedrocnumber << " already exists" << std::endl;
121  std::cout << __LINE__ << "]\t" << mthn << "Fix this inconsistency in the name translation" << std::endl;
122  assert(0);
123  }
124 
125  PixelHdwAddress hdwAdd(
126  fecnumber, mfec, mfecchannel, hubaddress, portaddress, rocid, fednumber, fedchannel, fedrocnumber);
127  // std::cout << "[PixelNameTranslation::PixelNameTranslation()] aROC: " << aROC << std::endl;
128  translationtable_[aROC] = hdwAdd;
129  fedlookup_[hdwAdd] = aROC;
130 
131  PixelModuleName aModule(rocname);
132  PixelChannel aChannel(aModule, TBMChannel);
133 
134  hdwTranslationTable_[hdwAdd] = aChannel;
135 
136  // Look for this channel in channelTransaltionTable. If it is found, check that the hardware address agrees. If not, add it to the table. Also, if another channel on that module is found, check that the FEC part agrees, and the FED part doesn't.
137  bool foundChannel = false;
138 
139  std::map<PixelChannel, PixelHdwAddress>::const_iterator channelTranslationTable_itr =
140  channelTranslationTable_.find(aChannel);
141 
142  if (channelTranslationTable_itr != channelTranslationTable_.end()) {
143  if (!(channelTranslationTable_itr->second |= hdwAdd)) {
144  cout << "Found two ROCs on the same channe, but not same hdw" << endl;
145  cout << "Hdw1:" << endl << channelTranslationTable_itr->second << endl;
146  cout << "Hdw2:" << endl << hdwAdd << endl;
147  }
148  assert(channelTranslationTable_itr->second |= hdwAdd);
149  foundChannel = true;
150  } else if (channelTranslationTable_itr->first.module() == aModule) {
151  assert(channelTranslationTable_itr->second.fecnumber() == hdwAdd.fecnumber());
152  assert(channelTranslationTable_itr->second.mfec() == hdwAdd.mfec());
153  assert(channelTranslationTable_itr->second.mfecchannel() == hdwAdd.mfecchannel());
154  //assert( channelTranslationTable_itr->second.portaddress() == hdwAdd.portaddress() );
155  assert(channelTranslationTable_itr->second.hubaddress() == hdwAdd.hubaddress());
156  assert(channelTranslationTable_itr->second.fednumber() != hdwAdd.fednumber() ||
157  channelTranslationTable_itr->second.fedchannel() != hdwAdd.fedchannel());
158  }
159 
160  if (foundChannel == false) {
161  channelTranslationTable_[aChannel] = hdwAdd;
162  }
163 
164  } //end for r
165 
166  const std::map<unsigned int, std::set<unsigned int> > fedsAndChannels = getFEDsAndChannels();
167 
168  std::vector<PixelROCName> tmp(24);
169 
170  std::map<unsigned int, std::map<unsigned int, int> > counter;
171  // FED id FED channel
172 
173  std::map<unsigned int, std::map<unsigned int, int> > maxindex;
174 
175  std::map<PixelROCName, PixelHdwAddress>::const_iterator it = translationtable_.begin();
176 
177  for (; it != translationtable_.end(); ++it) {
178  int index = it->second.fedrocnumber();
179 
180  unsigned int fednumber = it->second.fednumber();
181  unsigned int fedchannel = it->second.fedchannel();
182 
183  std::vector<PixelROCName>& tmp = rocsFromFEDidAndChannel_[fednumber][fedchannel];
184 
185  if (tmp.empty()) {
186  tmp.resize(24);
187  counter[fednumber][fedchannel] = 0;
188  maxindex[fednumber][fedchannel] = 0;
189  }
190 
191  if (index > maxindex[fednumber][fedchannel])
192  maxindex[fednumber][fedchannel] = index;
193  tmp[index] = it->first;
194  counter[fednumber][fedchannel]++;
195  }
196 
197  it = translationtable_.begin();
198 
199  for (; it != translationtable_.end(); ++it) {
200  unsigned int fednumber = it->second.fednumber();
201  unsigned int fedchannel = it->second.fedchannel();
202 
203  std::vector<PixelROCName>& tmp = rocsFromFEDidAndChannel_[fednumber][fedchannel];
204 
205  assert(counter[fednumber][fedchannel] == maxindex[fednumber][fedchannel] + 1);
206 
207  tmp.resize(counter[fednumber][fedchannel]);
208  }
209 
210 } //end contructor
std::map< PixelROCName, PixelHdwAddress > translationtable_
assert(be >=bs)
std::map< PixelHdwAddress, PixelChannel > hdwTranslationTable_
bool ROCNameFromFEDChannelROCExists(unsigned int fednumber, unsigned int channel, unsigned int roc) const
Store mfec, mfecchannel etc.
std::map< unsigned int, std::set< unsigned int > > getFEDsAndChannels() const
std::map< PixelHdwAddress, PixelROCName, PixelHdwAddress > fedlookup_
This class implements..
This class implements..
Definition: PixelROCName.h:23
static std::atomic< unsigned int > counter
std::map< unsigned int, std::map< unsigned int, std::vector< PixelROCName > > > rocsFromFEDidAndChannel_
tmp
align.sh
Definition: createJobs.py:716
PixelConfigBase(std::string description, std::string creator, std::string date)
std::map< PixelChannel, PixelHdwAddress > channelTranslationTable_

◆ PixelNameTranslation() [2/2]

PixelNameTranslation::PixelNameTranslation ( std::string  filename)

Definition at line 213 of file PixelNameTranslation.cc.

References cms::cuda::assert(), channelTranslationTable_, counter, gather_cfg::cout, pos::PixelHdwAddress::fecnumber(), pos::PixelHdwAddress::fedchannel(), fedlookup_, pos::PixelHdwAddress::fednumber(), corrVsCorr::filename, getFEDsAndChannels(), hdwTranslationTable_, pos::PixelHdwAddress::hubaddress(), recoMuon::in, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, pos::PixelHdwAddress::mfec(), pos::PixelHdwAddress::mfecchannel(), ROCNameFromFEDChannelROCExists(), rocsFromFEDidAndChannel_, AlCaHLTBitMon_QueryRunRegistry::string, createJobs::tmp, and translationtable_.

213  : PixelConfigBase(" ", " ", " ") {
214  static std::string mthn = "[PixelNameTranslation::PixelNameTranslation()]\t\t ";
215 
216  std::ifstream in(filename.c_str());
217 
218  if (!in.good()) {
219  std::cout << __LINE__ << "]\t" << mthn << "Could not open: " << filename << std::endl;
220  throw std::runtime_error("Failed to open file " + filename);
221  } else {
222  std::cout << __LINE__ << "]\t" << mthn << "Reading from: " << filename << std::endl;
223  }
224 
226 
227  getline(in, dummy); // skip the column headings
228 
229  do {
230  std::string rocname;
231  std::string TBMChannel;
232  unsigned int fecnumber;
233  unsigned int mfec;
234  unsigned int mfecchannel;
235  unsigned int hubaddress;
236  unsigned int portaddress;
237  unsigned int rocid;
238  unsigned int fednumber;
239  unsigned int fedchannel;
240  unsigned int fedrocnumber;
241 
242  in >> rocname;
243  in >> TBMChannel;
244  if (TBMChannel != "A" &&
245  TBMChannel !=
246  "B") // no TBM channel was specified, so default to A and set fecnumber to the value of this string
247  {
248  fecnumber = atoi(TBMChannel.c_str());
249  TBMChannel = "A";
250  } else // TBM channel was specified, now read fecnumber
251  {
252  in >> fecnumber;
253  }
254  in >> mfec >> mfecchannel >> hubaddress >> portaddress >> rocid >> fednumber >> fedchannel >> fedrocnumber;
255 
256  if (!in.eof()) {
257  PixelROCName aROC(rocname);
258 
259  //debug
260  //if (aROC.rocname()!=rocname){
261  //std::cout << __LINE__ << "]\t" << mthn << "Rocname : " << rocname << std::endl;
262  //std::cout << __LINE__ << "]\t" << mthn << "Parsed to: " << aROC.rocname() << std::endl;
263  //assert(0);
264  //}
265 
266  if (ROCNameFromFEDChannelROCExists(fednumber, fedchannel, fedrocnumber)) {
267  std::cout << __LINE__ << "]\t" << mthn << "ROC with fednumber=" << fednumber << " fedchannel=" << fedchannel
268  << " roc number=" << fedrocnumber << " already exists" << std::endl;
269  std::cout << __LINE__ << "]\t" << mthn << "Fix this inconsistency in the name translation" << std::endl;
270  assert(0);
271  }
272 
273  PixelHdwAddress hdwAdd(
274  fecnumber, mfec, mfecchannel, hubaddress, portaddress, rocid, fednumber, fedchannel, fedrocnumber);
275  //std::cout << aROC << std::endl;
276  // modified by MR on 18-01-2008 11:18:53
277  // std::cout << hdwAdd << std::endl ;
278  //cout << "[PixelNameTranslation::PixelNameTranslation()]\t\t-----------------------------" << endl ;
279  // A fecnumber
280  // B mfec
281  // C mfecchannel
282  // D hubaddress
283  // E portaddress
284  // F rocid
285  // G fednumber
286  // H fedchannel
287  // I fedrocnumber
288  //cout << "[PixelNameTranslation::PixelNameTranslation()]\t\t"
289  // << " A " << fecnumber
290  // << " B " << mfec
291  // << " C " << mfecchannel
292  // << " D " << hubaddress
293  // << " E " << portaddress
294  // << " F " << rocid
295  // << " G " << fednumber
296  // << " H " << fedchannel
297  // << " I " << fedrocnumber << endl ;
298 
299  translationtable_[aROC] = hdwAdd;
300  fedlookup_[hdwAdd] = aROC;
301 
302  PixelModuleName aModule(rocname);
303  PixelChannel aChannel(aModule, TBMChannel);
304 
305  hdwTranslationTable_[hdwAdd] = aChannel;
306 
307  // Look for this channel in channelTransaltionTable. If it is found,
308  // check that the hardware address agrees. If not, add it to the table.
309  // Also, if another channel on that module is found, check that the FEC
310  // part agrees, and the FED part doesn't.
311  bool foundChannel = false;
312 
313  std::map<PixelChannel, PixelHdwAddress>::const_iterator channelTranslationTable_itr =
314  channelTranslationTable_.find(aChannel);
315 
316  if (channelTranslationTable_itr != channelTranslationTable_.end()) {
317  if (!(channelTranslationTable_itr->second |= hdwAdd)) {
318  cout << __LINE__ << "]\t" << mthn << "Found two ROCs on the same channe, but not same hdw" << endl;
319  cout << __LINE__ << "]\t" << mthn << "Hdw1: " << endl << channelTranslationTable_itr->second << endl;
320  cout << __LINE__ << "]\t" << mthn << "Hdw2: " << endl << hdwAdd << endl;
321  }
322  assert(channelTranslationTable_itr->second |= hdwAdd);
323  foundChannel = true;
324  } else if (channelTranslationTable_itr->first.module() == aModule) {
325  assert(channelTranslationTable_itr->second.fecnumber() == hdwAdd.fecnumber());
326  assert(channelTranslationTable_itr->second.mfec() == hdwAdd.mfec());
327  assert(channelTranslationTable_itr->second.mfecchannel() == hdwAdd.mfecchannel());
328  //assert( channelTranslationTable_itr->second.portaddress() == hdwAdd.portaddress() );
329  assert(channelTranslationTable_itr->second.hubaddress() == hdwAdd.hubaddress());
330  assert(channelTranslationTable_itr->second.fednumber() != hdwAdd.fednumber() ||
331  channelTranslationTable_itr->second.fedchannel() != hdwAdd.fedchannel());
332  }
333 
334  if (foundChannel == false) {
335  channelTranslationTable_[aChannel] = hdwAdd;
336  }
337  }
338  } while (!in.eof());
339  in.close();
340 
341  const std::map<unsigned int, std::set<unsigned int> > fedsAndChannels = getFEDsAndChannels();
342 
343  std::vector<PixelROCName> tmp(24);
344 
345  std::map<unsigned int, std::map<unsigned int, int> > counter;
346  // FED id FED channel
347 
348  std::map<unsigned int, std::map<unsigned int, int> > maxindex;
349 
350  std::map<PixelROCName, PixelHdwAddress>::const_iterator it = translationtable_.begin();
351 
352  for (; it != translationtable_.end(); ++it) {
353  int index = it->second.fedrocnumber();
354 
355  unsigned int fednumber = it->second.fednumber();
356  unsigned int fedchannel = it->second.fedchannel();
357 
358  std::vector<PixelROCName>& tmp = rocsFromFEDidAndChannel_[fednumber][fedchannel];
359 
360  if (tmp.empty()) {
361  tmp.resize(24);
362  counter[fednumber][fedchannel] = 0;
363  maxindex[fednumber][fedchannel] = 0;
364  }
365 
366  if (index > maxindex[fednumber][fedchannel])
367  maxindex[fednumber][fedchannel] = index;
368  tmp[index] = it->first;
369  counter[fednumber][fedchannel]++;
370  }
371 
372  it = translationtable_.begin();
373 
374  for (; it != translationtable_.end(); ++it) {
375  unsigned int fednumber = it->second.fednumber();
376  unsigned int fedchannel = it->second.fedchannel();
377 
378  std::vector<PixelROCName>& tmp = rocsFromFEDidAndChannel_[fednumber][fedchannel];
379 
380  assert(counter[fednumber][fedchannel] == maxindex[fednumber][fedchannel] + 1);
381 
382  tmp.resize(counter[fednumber][fedchannel]);
383  }
384 }
std::map< PixelROCName, PixelHdwAddress > translationtable_
assert(be >=bs)
std::map< PixelHdwAddress, PixelChannel > hdwTranslationTable_
bool ROCNameFromFEDChannelROCExists(unsigned int fednumber, unsigned int channel, unsigned int roc) const
Store mfec, mfecchannel etc.
std::map< unsigned int, std::set< unsigned int > > getFEDsAndChannels() const
std::map< PixelHdwAddress, PixelROCName, PixelHdwAddress > fedlookup_
This class implements..
This class implements..
Definition: PixelROCName.h:23
static std::atomic< unsigned int > counter
std::map< unsigned int, std::map< unsigned int, std::vector< PixelROCName > > > rocsFromFEDidAndChannel_
tmp
align.sh
Definition: createJobs.py:716
PixelConfigBase(std::string description, std::string creator, std::string date)
std::map< PixelChannel, PixelHdwAddress > channelTranslationTable_

◆ ~PixelNameTranslation()

pos::PixelNameTranslation::~PixelNameTranslation ( )
inlineoverride

Definition at line 46 of file PixelNameTranslation.h.

46 {}

Member Function Documentation

◆ buildROCsFromFEDChannel()

std::vector< PixelROCName > PixelNameTranslation::buildROCsFromFEDChannel ( unsigned int  fednumber,
unsigned int  fedchannel 
) const
private

Definition at line 534 of file PixelNameTranslation.cc.

References cms::cuda::assert(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, createJobs::tmp, and translationtable_.

535  {
536  std::vector<PixelROCName> tmp(24);
537 
538  int counter = 0;
539 
540  int maxindex = 0;
541 
542  std::map<PixelROCName, PixelHdwAddress>::const_iterator it = translationtable_.begin();
543 
544  for (; it != translationtable_.end(); ++it) {
545  if (it->second.fednumber() == fednumber && it->second.fedchannel() == fedchannel) {
546  int index = it->second.fedrocnumber();
547  if (index > maxindex)
548  maxindex = index;
549  //std::cout << "Found one:"<<index<<" "<<it->first<<std::endl;
550  tmp[index] = it->first;
551  counter++;
552  }
553  }
554 
555  assert(counter == maxindex + 1);
556 
557  tmp.resize(counter);
558 
559  return tmp;
560 }
std::map< PixelROCName, PixelHdwAddress > translationtable_
assert(be >=bs)
tmp
align.sh
Definition: createJobs.py:716

◆ ChannelFromFEDChannel()

PixelChannel PixelNameTranslation::ChannelFromFEDChannel ( unsigned int  fednumber,
unsigned int  fedchannel 
) const

Definition at line 592 of file PixelNameTranslation.cc.

References cms::cuda::assert(), channelTranslationTable_, gather_cfg::cout, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, and AlCaHLTBitMon_QueryRunRegistry::string.

592  {
593  std::string mthn = "[PixelNameTranslation::ChannelFromFEDChannel()]\t\t ";
594  std::map<PixelChannel, PixelHdwAddress>::const_iterator toReturn;
595  bool foundOne = false;
596  for (std::map<PixelChannel, PixelHdwAddress>::const_iterator it = channelTranslationTable_.begin();
597  it != channelTranslationTable_.end();
598  ++it) {
599  if (it->second.fednumber() == fednumber && it->second.fedchannel() == fedchannel) {
600  if (foundOne) {
601  std::cout << __LINE__ << "]\t" << mthn << "ERROR: multiple channels on FED#" << fednumber
602  << ", chan=" << fedchannel << std::endl;
603  assert(0);
604  } else {
605  toReturn = it;
606  foundOne = true;
607  }
608  }
609  }
610 
611  if (!foundOne) {
612  std::cout << __LINE__ << "]\t" << mthn << "ERROR: no channel found for FED#" << fednumber << ", chan=" << fedchannel
613  << std::endl;
614  assert(0);
615  }
616 
617  return toReturn->first;
618 }
assert(be >=bs)
std::map< PixelChannel, PixelHdwAddress > channelTranslationTable_

◆ checkFor()

const bool PixelNameTranslation::checkFor ( const PixelROCName aROC) const

Definition at line 469 of file PixelNameTranslation.cc.

References translationtable_.

469  {
470  if (translationtable_.find(aROC) == translationtable_.end()) {
471  return false;
472  } else {
473  return true;
474  }
475 }
std::map< PixelROCName, PixelHdwAddress > translationtable_

◆ checkROCExistence()

bool PixelNameTranslation::checkROCExistence ( const PixelROCName aROC) const

Definition at line 462 of file PixelNameTranslation.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, and translationtable_.

462  {
463  std::string mthn = "[PixelNameTranslation::checkROCExistence()]\t\t ";
464  if (translationtable_.find(aROC) == translationtable_.end())
465  return false;
466  return true;
467 }
std::map< PixelROCName, PixelHdwAddress > translationtable_

◆ FEDChannelExist()

bool PixelNameTranslation::FEDChannelExist ( unsigned int  fednumber,
unsigned int  fedchannel 
) const

Definition at line 620 of file PixelNameTranslation.cc.

References cms::cuda::assert(), channelTranslationTable_, gather_cfg::cout, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by pos::PixelConfigurationVerifier::checkChannelEnable().

620  {
621  std::string mthn = "[PixelNameTranslation::FEDChannelExist()]\t\t ";
622  std::map<PixelChannel, PixelHdwAddress>::const_iterator toReturn;
623  bool foundOne = false;
624  for (std::map<PixelChannel, PixelHdwAddress>::const_iterator it = channelTranslationTable_.begin();
625  it != channelTranslationTable_.end();
626  ++it) {
627  if (it->second.fednumber() == fednumber && it->second.fedchannel() == fedchannel) {
628  if (foundOne) {
629  std::cout << __LINE__ << "]\t" << mthn << "ERROR: multiple channels on FED#" << fednumber
630  << ", chan=" << fedchannel << std::endl;
631  assert(0);
632  } else {
633  toReturn = it;
634  foundOne = true;
635  }
636  }
637  }
638  return foundOne;
639 }
assert(be >=bs)
std::map< PixelChannel, PixelHdwAddress > channelTranslationTable_

◆ firstHdwAddress()

const PixelHdwAddress & PixelNameTranslation::firstHdwAddress ( const PixelModuleName aModule) const

Definition at line 484 of file PixelNameTranslation.cc.

References cms::cuda::assert(), gather_cfg::cout, getChannelsOnModule(), getHdwAddress(), and AlCaHLTBitMon_QueryRunRegistry::string.

484  {
485  std::string mthn = "[PixelNameTranslation::firstHdwAddress()]\t\t ";
486  std::set<PixelChannel> channelsOnModule = getChannelsOnModule(aModule);
487  if (channelsOnModule.empty()) {
488  cout << __LINE__ << "]\t" << mthn << "module=" << aModule << " has zero channels!" << endl;
489  cout << __LINE__ << "]\t" << mthn << "Will terminate" << endl;
490  ::abort();
491  }
492  std::set<PixelChannel>::const_iterator firstChannel = channelsOnModule.begin();
493  assert(firstChannel != channelsOnModule.end());
494  return getHdwAddress(*firstChannel);
495 }
std::set< PixelChannel > getChannelsOnModule(const PixelModuleName &aModule) const
assert(be >=bs)
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const

◆ getChannelForROC()

const PixelChannel & PixelNameTranslation::getChannelForROC ( const PixelROCName aROC) const

Definition at line 497 of file PixelNameTranslation.cc.

References cms::cuda::assert(), getChannelFromHdwAddress(), and translationtable_.

Referenced by pos::PixelCalibConfiguration::buildObjectsDependingOnTheNameTranslation(), and pos::PixelCalibConfiguration::nextFECState().

497  {
498  std::map<PixelROCName, PixelHdwAddress>::const_iterator foundEntry = translationtable_.find(aROC);
499  assert(foundEntry != translationtable_.end());
500  return getChannelFromHdwAddress(foundEntry->second);
501 }
std::map< PixelROCName, PixelHdwAddress > translationtable_
assert(be >=bs)
const PixelChannel & getChannelFromHdwAddress(const PixelHdwAddress &aHdwAddress) const

◆ getChannelFromHdwAddress()

const PixelChannel & PixelNameTranslation::getChannelFromHdwAddress ( const PixelHdwAddress aHdwAddress) const

Definition at line 641 of file PixelNameTranslation.cc.

References cms::cuda::assert(), gather_cfg::cout, hdwTranslationTable_, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getChannelForROC(), writeASCII(), and writeXML().

641  {
642  // modified by MR on 30-01-2008 10:38:22
643  std::string mthn = "[PixelNameTranslation::getChannelFromHdwAddress()]\t\t ";
644 
645  std::map<PixelHdwAddress, PixelChannel>::const_iterator it = hdwTranslationTable_.find(aHdwAddress);
646 
647  if (it == hdwTranslationTable_.end()) {
648  std::cout << __LINE__ << "]\t" << mthn << "ERROR: no channel found for hardware address " << aHdwAddress
649  << std::endl;
650  assert(0);
651  }
652 
653  return it->second;
654 
655  /*
656  for ( std::map<PixelChannel, PixelHdwAddress >::const_iterator channelTranslationTable_itr = channelTranslationTable_.begin();
657  channelTranslationTable_itr != channelTranslationTable_.end(); channelTranslationTable_itr++ )
658  {
659  if ( aHdwAddress |= channelTranslationTable_itr->second )
660  {
661  return channelTranslationTable_itr->first;
662  }
663  }
664 // modified by MR on 30-01-2008 13:56:34
665 // if you get here then there was NO match on the previous loop!!
666  std::cout << __LINE__ << "]\t" << mthn
667  << "ERROR: no channel found for hardware address " << aHdwAddress << std::endl;
668  assert(0);
669  */
670 }
assert(be >=bs)
std::map< PixelHdwAddress, PixelChannel > hdwTranslationTable_

◆ getChannels() [1/2]

std::set< PixelChannel > PixelNameTranslation::getChannels ( ) const

Definition at line 426 of file PixelNameTranslation.cc.

References channelTranslationTable_.

Referenced by pos::PixelConfigurationVerifier::checkChannelEnable().

426  {
427  std::set<PixelChannel> channelSet;
428  for (std::map<PixelChannel, PixelHdwAddress>::const_iterator channelTranslationTable_itr =
429  channelTranslationTable_.begin();
430  channelTranslationTable_itr != channelTranslationTable_.end();
431  ++channelTranslationTable_itr) {
432  channelSet.insert(channelTranslationTable_itr->first);
433  }
434  return channelSet;
435 }
std::map< PixelChannel, PixelHdwAddress > channelTranslationTable_

◆ getChannels() [2/2]

std::set< PixelChannel > PixelNameTranslation::getChannels ( const PixelDetectorConfig aDetectorConfig) const

Definition at line 437 of file PixelNameTranslation.cc.

References channelTranslationTable_, and pos::PixelDetectorConfig::containsModule().

437  {
438  std::set<PixelChannel> channelSet;
439  for (std::map<PixelChannel, PixelHdwAddress>::const_iterator channelTranslationTable_itr =
440  channelTranslationTable_.begin();
441  channelTranslationTable_itr != channelTranslationTable_.end();
442  ++channelTranslationTable_itr) {
443  if (aDetectorConfig.containsModule(channelTranslationTable_itr->first.module()))
444  channelSet.insert(channelTranslationTable_itr->first);
445  }
446  return channelSet;
447 }
bool containsModule(const PixelModuleName &moduleToFind) const
std::map< PixelChannel, PixelHdwAddress > channelTranslationTable_

◆ getChannelsOnModule()

std::set< PixelChannel > PixelNameTranslation::getChannelsOnModule ( const PixelModuleName aModule) const

Definition at line 503 of file PixelNameTranslation.cc.

References cms::cuda::assert(), and channelTranslationTable_.

Referenced by firstHdwAddress(), pos::PixelCalibConfiguration::getFECCrates(), pos::PixelCalibConfiguration::getFEDCrates(), pos::PixelDetectorConfig::getFEDs(), pos::PixelDetectorConfig::getFEDsAndChannels(), and getROCsFromModule().

503  {
504  std::set<PixelChannel> returnThis;
505  for (std::map<PixelChannel, PixelHdwAddress>::const_iterator channelTranslationTable_itr =
506  channelTranslationTable_.begin();
507  channelTranslationTable_itr != channelTranslationTable_.end();
508  ++channelTranslationTable_itr) {
509  if (channelTranslationTable_itr->first.module() == aModule)
510  returnThis.insert(channelTranslationTable_itr->first);
511  }
512  assert(returnThis.size() <= 2);
513  return returnThis;
514 }
assert(be >=bs)
std::map< PixelChannel, PixelHdwAddress > channelTranslationTable_

◆ getFEDsAndChannels()

std::map< unsigned int, std::set< unsigned int > > PixelNameTranslation::getFEDsAndChannels ( ) const

Definition at line 882 of file PixelNameTranslation.cc.

References channelTranslationTable_, and createJobs::tmp.

Referenced by PixelNameTranslation().

882  {
883  std::map<unsigned int, std::set<unsigned int> > tmp;
884 
885  std::map<PixelChannel, PixelHdwAddress>::const_iterator channelTranslationTable_itr =
886  channelTranslationTable_.begin();
887 
888  for (; channelTranslationTable_itr != channelTranslationTable_.end(); ++channelTranslationTable_itr) {
889  unsigned int fednumber = channelTranslationTable_itr->second.fednumber();
890  unsigned int fedchannel = channelTranslationTable_itr->second.fedchannel();
891 
892  tmp[fednumber].insert(fedchannel);
893  }
894 
895  return tmp;
896 }
tmp
align.sh
Definition: createJobs.py:716
std::map< PixelChannel, PixelHdwAddress > channelTranslationTable_

◆ getHdwAddress() [1/2]

const PixelHdwAddress * PixelNameTranslation::getHdwAddress ( const PixelROCName aROC) const

Definition at line 449 of file PixelNameTranslation.cc.

References cms::cuda::assert(), gather_cfg::cout, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, AlCaHLTBitMon_QueryRunRegistry::string, and translationtable_.

Referenced by pos::PixelConfigurationVerifier::checkChannelEnable(), pos::PixelCalibConfiguration::fedCardsAndChannels(), firstHdwAddress(), pos::PixelTrimCommon::generateConfiguration(), pos::PixelTBMSettings::generateConfiguration(), pos::PixelTrimAllPixels::generateConfiguration(), pos::PixelDACSettings::generateConfiguration(), pos::PixelCalibConfiguration::getFECCrates(), pos::PixelCalibConfiguration::getFEDCrates(), pos::PixelDetectorConfig::getFEDs(), pos::PixelDetectorConfig::getFEDsAndChannels(), pos::PixelCalibConfiguration::getFEDsAndChannels(), getROCsFromChannel(), pos::PixelCalibConfiguration::nextFECState(), pos::PixelDACSettings::setVcthrDisable(), and pos::PixelDACSettings::setVcthrEnable().

449  {
450  static std::string mthn = "[PixelNameTranslation::getHdwAddress()]\t\t ";
451  std::map<PixelROCName, PixelHdwAddress>::const_iterator it = translationtable_.find(aROC);
452 
453  if (it == translationtable_.end()) {
454  std::cout << __LINE__ << "]\t" << mthn << "Could not look up ROC: " << aROC << std::endl;
455  assert(0);
456  }
457 
458  return &(it->second);
459 }
std::map< PixelROCName, PixelHdwAddress > translationtable_
assert(be >=bs)

◆ getHdwAddress() [2/2]

const PixelHdwAddress & PixelNameTranslation::getHdwAddress ( const PixelChannel aChannel) const

Definition at line 477 of file PixelNameTranslation.cc.

References cms::cuda::assert(), and channelTranslationTable_.

477  {
478  std::map<PixelChannel, PixelHdwAddress>::const_iterator channelHdwAddress_itr =
479  channelTranslationTable_.find(aChannel);
480  assert(channelHdwAddress_itr != channelTranslationTable_.end());
481  return channelHdwAddress_itr->second;
482 }
assert(be >=bs)
std::map< PixelChannel, PixelHdwAddress > channelTranslationTable_

◆ getModules()

std::list< const PixelModuleName * > PixelNameTranslation::getModules ( ) const

Definition at line 404 of file PixelNameTranslation.cc.

References channelTranslationTable_.

404  {
405  std::list<const PixelModuleName*> listOfModules;
406  for (std::map<PixelChannel, PixelHdwAddress>::const_iterator channelTranslationTable_itr =
407  channelTranslationTable_.begin();
408  channelTranslationTable_itr != channelTranslationTable_.end();
409  ++channelTranslationTable_itr) {
410  bool foundOne = false;
411  for (std::list<const PixelModuleName*>::const_iterator listOfModules_itr = listOfModules.begin();
412  listOfModules_itr != listOfModules.end();
413  ++listOfModules_itr) {
414  if (*(*listOfModules_itr) == channelTranslationTable_itr->first.module()) {
415  foundOne = true;
416  break;
417  }
418  }
419  if (!foundOne)
420  listOfModules.push_back(&(channelTranslationTable_itr->first.module()));
421  }
422 
423  return listOfModules;
424 }
std::map< PixelChannel, PixelHdwAddress > channelTranslationTable_

◆ getROCs()

std::list< const PixelROCName * > PixelNameTranslation::getROCs ( ) const

Definition at line 393 of file PixelNameTranslation.cc.

References translationtable_.

Referenced by pos::PixelCalibConfiguration::buildROCAndModuleLists().

393  {
394  std::list<const PixelROCName*> listOfROCs;
395  for (std::map<PixelROCName, PixelHdwAddress>::const_iterator translationTableEntry = translationtable_.begin();
396  translationTableEntry != translationtable_.end();
397  ++translationTableEntry) {
398  listOfROCs.push_back(&(translationTableEntry->first));
399  }
400 
401  return listOfROCs;
402 }
std::map< PixelROCName, PixelHdwAddress > translationtable_

◆ getROCsFromChannel()

const std::vector< PixelROCName > & PixelNameTranslation::getROCsFromChannel ( const PixelChannel aChannel) const

Definition at line 850 of file PixelNameTranslation.cc.

References pos::PixelHdwAddress::fedchannel(), pos::PixelHdwAddress::fednumber(), getHdwAddress(), and getROCsFromFEDChannel().

Referenced by pos::PixelCalibConfiguration::buildObjectsDependingOnTheNameTranslation(), pos::PixelConfigurationVerifier::checkChannelEnable(), and getROCsFromModule().

850  {
851  const PixelHdwAddress& channelHdwAddress = getHdwAddress(aChannel);
852  return getROCsFromFEDChannel(channelHdwAddress.fednumber(), channelHdwAddress.fedchannel());
853 }
unsigned int fedchannel() const
const std::vector< PixelROCName > & getROCsFromFEDChannel(unsigned int fednumber, unsigned int fedchannel) const
Store mfec, mfecchannel etc.
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const
unsigned int fednumber() const

◆ getROCsFromFEDChannel()

const std::vector< PixelROCName > & PixelNameTranslation::getROCsFromFEDChannel ( unsigned int  fednumber,
unsigned int  fedchannel 
) const

Definition at line 516 of file PixelNameTranslation.cc.

References cms::cuda::assert(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, and rocsFromFEDidAndChannel_.

Referenced by pos::PixelConfigurationVerifier::checkChannelEnable(), and getROCsFromChannel().

517  {
518  std::map<unsigned int, std::map<unsigned int, std::vector<PixelROCName> > >::const_iterator it =
519  rocsFromFEDidAndChannel_.find(fednumber);
520 
522 
523  std::map<unsigned int, std::vector<PixelROCName> >::const_iterator it2 = it->second.find(fedchannel);
524 
525  assert(it2 != it->second.end());
526 
527  return it2->second;
528 }
assert(be >=bs)
std::map< unsigned int, std::map< unsigned int, std::vector< PixelROCName > > > rocsFromFEDidAndChannel_

◆ getROCsFromModule()

std::vector< PixelROCName > PixelNameTranslation::getROCsFromModule ( const PixelModuleName aModule) const

Definition at line 855 of file PixelNameTranslation.cc.

References getChannelsOnModule(), and getROCsFromChannel().

Referenced by pos::PixelCalibConfiguration::buildROCAndModuleLists().

855  {
856  std::vector<PixelROCName> returnThis;
857 
858  std::set<PixelChannel> channelsOnThisModule = getChannelsOnModule(aModule);
859  for (std::set<PixelChannel>::const_iterator channelsOnThisModule_itr = channelsOnThisModule.begin();
860  channelsOnThisModule_itr != channelsOnThisModule.end();
861  ++channelsOnThisModule_itr) {
862  std::vector<PixelROCName> ROCsOnThisChannel = getROCsFromChannel(*channelsOnThisModule_itr);
863  for (std::vector<PixelROCName>::const_iterator ROCsOnThisChannel_itr = ROCsOnThisChannel.begin();
864  ROCsOnThisChannel_itr != ROCsOnThisChannel.end();
865  ++ROCsOnThisChannel_itr) {
866  returnThis.push_back(*ROCsOnThisChannel_itr);
867  }
868  }
869 
870  return returnThis;
871 }
std::set< PixelChannel > getChannelsOnModule(const PixelModuleName &aModule) const
const std::vector< PixelROCName > & getROCsFromChannel(const PixelChannel &aChannel) const

◆ ROCexists()

bool PixelNameTranslation::ROCexists ( PixelROCName  theROC)

Definition at line 875 of file PixelNameTranslation.cc.

References translationtable_.

875  {
876  if (translationtable_.find(theROC) == translationtable_.end()) {
877  return false;
878  }
879  return true;
880 }
std::map< PixelROCName, PixelHdwAddress > translationtable_

◆ ROCNameFromFEDChannelROC()

PixelROCName PixelNameTranslation::ROCNameFromFEDChannelROC ( unsigned int  fednumber,
unsigned int  channel,
unsigned int  roc 
) const

Definition at line 570 of file PixelNameTranslation.cc.

References cms::cuda::assert(), gather_cfg::cout, fedlookup_, PixelMapPlotter::roc, AlCaHLTBitMon_QueryRunRegistry::string, and createJobs::tmp.

572  {
573  std::string mthn = "[PixelNameTranslation::ROCNameFromFEDChannelROC()]\t\t ";
574  PixelHdwAddress tmp(0, 0, 0, 0, 0, 0, fednumber, channel, roc);
575 
576  std::map<PixelHdwAddress, PixelROCName, PixelHdwAddress>::const_iterator it1 = fedlookup_.find(tmp);
577 
578  if (it1 != fedlookup_.end()) {
579  return it1->second;
580  }
581 
582  std::cout << __LINE__ << "]\t" << mthn << "could not find ROCName "
583  << " for FED#" << fednumber << " chan=" << channel << " roc#=" << roc << std::endl;
584 
585  assert(0);
586 
587  PixelROCName tmp1;
588 
589  return tmp1;
590 }
assert(be >=bs)
Store mfec, mfecchannel etc.
std::map< PixelHdwAddress, PixelROCName, PixelHdwAddress > fedlookup_
This class implements..
Definition: PixelROCName.h:23
tmp
align.sh
Definition: createJobs.py:716

◆ ROCNameFromFEDChannelROCExists()

bool PixelNameTranslation::ROCNameFromFEDChannelROCExists ( unsigned int  fednumber,
unsigned int  channel,
unsigned int  roc 
) const

Definition at line 562 of file PixelNameTranslation.cc.

References fedlookup_, PixelMapPlotter::roc, and createJobs::tmp.

Referenced by PixelNameTranslation().

564  {
565  PixelHdwAddress tmp(0, 0, 0, 0, 0, 0, fednumber, channel, roc);
566 
567  return (fedlookup_.find(tmp) != fedlookup_.end());
568 }
Store mfec, mfecchannel etc.
std::map< PixelHdwAddress, PixelROCName, PixelHdwAddress > fedlookup_
tmp
align.sh
Definition: createJobs.py:716

◆ writeASCII()

void PixelNameTranslation::writeASCII ( std::string  dir = "") const
overridevirtual

Implements pos::PixelConfigBase.

Definition at line 672 of file PixelNameTranslation.cc.

References DeadROC_duringRun::dir, corrVsCorr::filename, getChannelFromHdwAddress(), MillePedeFileConverter_cfg::out, AlCaHLTBitMon_QueryRunRegistry::string, pos::PixelChannel::TBMChannelString(), and translationtable_.

672  {
673  std::string mthn = "[PixelNameTranslation::writeASCII()]\t\t\t ";
674  if (!dir.empty())
675  dir += "/";
676  std::string filename = dir + "translation.dat";
677 
678  std::ofstream out(filename.c_str());
679 
680  //std::cout << "[PixelNameTranslation::writeASCII()]\t\tfilename: "
681  // << filename
682  // << " status: "
683  // << out
684  // << " "
685  // << out.is_open()
686  // <<endl ;
687 
688  out << "# name TBMchannel FEC mfec mfecchannel hubaddress portadd rocid FED "
689  "channel roc#"
690  << endl;
691 
692  std::map<PixelROCName, PixelHdwAddress>::const_iterator iroc = translationtable_.begin();
693 
694  for (; iroc != translationtable_.end(); ++iroc) {
695  // Find the PixelChannel for this ROC, in order to get the TBM channel.
696  std::string TBMChannel = getChannelFromHdwAddress(iroc->second).TBMChannelString();
697 
698  out << iroc->first.rocname() << " " << TBMChannel << " " << iroc->second.fecnumber() << " "
699  << iroc->second.mfec() << " " << iroc->second.mfecchannel() << " " << iroc->second.hubaddress()
700  << " " << iroc->second.portaddress() << " " << iroc->second.rocid() << " "
701  << iroc->second.fednumber() << " " << iroc->second.fedchannel() << " "
702  << iroc->second.fedrocnumber() << endl;
703  }
704 
705  out.close();
706 }
std::map< PixelROCName, PixelHdwAddress > translationtable_
std::string TBMChannelString() const
Definition: PixelChannel.h:31
const PixelChannel & getChannelFromHdwAddress(const PixelHdwAddress &aHdwAddress) const

◆ writeXML() [1/2]

void PixelNameTranslation::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 789 of file PixelNameTranslation.cc.

References cms::cuda::assert(), gather_cfg::cout, contentValuesFiles::fullPath, getChannelFromHdwAddress(), pos::PixelTimeFormatter::getTime(), MillePedeFileConverter_cfg::out, EnsembleCalibrationLA_cfg::path, AlCaHLTBitMon_QueryRunRegistry::string, pos::PixelChannel::TBMChannelString(), translationtable_, and relval_steps::version.

789  {
790  std::string mthn = "[PixelNameTranslation::writeXML]\t\t\t ";
791  std::stringstream fullPath;
792 
793  fullPath << path << "/Pixel_NameTranslation.xml";
794  cout << __LINE__ << "]\t" << mthn << "Writing to: " << fullPath.str() << endl;
795 
796  std::ofstream out(fullPath.str().c_str());
797 
798  out << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << endl;
799  out << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << endl;
800  out << "" << endl;
801  out << " <HEADER>" << endl;
802  out << " <HINTS mode='only-det-root' />" << endl;
803  out << " <TYPE>" << endl;
804  out << " <EXTENSION_TABLE_NAME>PIXEL_NAME_TRANSLATION</EXTENSION_TABLE_NAME>" << endl;
805  out << " <NAME>Pixel Name Translation</NAME>" << endl;
806  out << " </TYPE>" << endl;
807  out << " <RUN>" << endl;
808  out << " <RUN_TYPE>Pixel Name Translation</RUN_TYPE>" << endl;
809  out << " <RUN_NUMBER>1</RUN_NUMBER>" << endl;
810  out << " <RUN_BEGIN_TIMESTAMP>" << pos::PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << endl;
811  out << " <COMMENT_DESCRIPTION>Test of Name Translation xml</COMMENT_DESCRIPTION>" << endl;
812  out << " <LOCATION>CERN TAC</LOCATION>" << endl;
813  out << " <CREATED_BY_USER>Dario Menasce</CREATED_BY_USER>" << endl;
814  out << " </RUN>" << endl;
815  out << " </HEADER>" << endl;
816  out << "" << endl;
817  out << " <DATA_SET>" << endl;
818  out << " <VERSION>" << version << "</VERSION>" << endl;
819  out << " <PART>" << endl;
820  out << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << endl;
821  out << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << endl;
822  out << " </PART>" << endl;
823  out << "" << endl;
824 
825  std::map<PixelROCName, PixelHdwAddress>::const_iterator iroc = translationtable_.begin();
826 
827  for (; iroc != translationtable_.end(); ++iroc) {
828  // Find the PixelChannel for this ROC, in order to get the TBM channel.
829  std::string TBMChannel = getChannelFromHdwAddress(iroc->second).TBMChannelString();
830 
831  out << " <DATA>" << endl;
832  out << " <PXLFEC_NAME>" << iroc->second.fecnumber() << "</PXLFEC_NAME>" << endl;
833  out << " <MFEC_POSN>" << iroc->second.mfec() << "</MFEC_POSN>" << endl;
834  out << " <MFEC_CHAN>" << iroc->second.mfecchannel() << "</MFEC_CHAN>" << endl;
835  out << " <HUB_ADDRS>" << iroc->second.hubaddress() << "</HUB_ADDRS>" << endl;
836  out << " <PORT_NUM>" << iroc->second.portaddress() << "</PORT_NUM>" << endl;
837  out << " <ROC_I2C_ADDR>" << iroc->second.rocid() << "</ROC_I2C_ADDR>" << endl;
838  out << " <PXLFED_NAME>" << iroc->second.fednumber() << "</PXLFED_NAME>" << endl;
839  out << " <FED_CHAN>" << iroc->second.fedchannel() << "</FED_CHAN>" << endl;
840  out << " <FED_RO_NUM>" << iroc->second.fedrocnumber() << "</FED_ROC_NUM>" << endl;
841  out << " </DATA>" << endl;
842  out << "" << endl;
843  }
844  out << " </DATA_SET> " << endl;
845  out << "</ROOT> " << endl;
846  out.close();
847  assert(0);
848 }
std::map< PixelROCName, PixelHdwAddress > translationtable_
assert(be >=bs)
std::string TBMChannelString() const
Definition: PixelChannel.h:31
static std::string getTime(void)
const PixelChannel & getChannelFromHdwAddress(const PixelHdwAddress &aHdwAddress) const

◆ writeXML() [2/2]

void PixelNameTranslation::writeXML ( std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 748 of file PixelNameTranslation.cc.

References getChannelFromHdwAddress(), AlCaHLTBitMon_QueryRunRegistry::string, pos::PixelChannel::TBMChannelString(), and translationtable_.

750  {
751  std::string mthn = "[PixelNameTranslation::writeXML()]\t\t\t ";
752 
753  std::map<PixelROCName, PixelHdwAddress>::const_iterator iroc = translationtable_.begin();
754 
755  for (; iroc != translationtable_.end(); ++iroc) {
756  // Find the PixelChannel for this ROC, in order to get the TBM channel.
757  std::string TBMChannel = getChannelFromHdwAddress(iroc->second).TBMChannelString();
758 
759  *outstream << " <DATA>" << endl;
760  *outstream << " <ROC_NAME>" << iroc->first.rocname() << "</ROC_NAME>" << endl;
761  *outstream << " <TBM_MODE>" << TBMChannel << "</TBM_MODE>" << endl;
762  *outstream << " <PXLFEC_NAME>" << iroc->second.fecnumber() << "</PXLFEC_NAME>" << endl;
763  *outstream << " <MFEC_POSN>" << iroc->second.mfec() << "</MFEC_POSN>" << endl;
764  *outstream << " <MFEC_CHAN>" << iroc->second.mfecchannel() << "</MFEC_CHAN>" << endl;
765  *outstream << " <HUB_ADDRS>" << iroc->second.hubaddress() << "</HUB_ADDRS>" << endl;
766  *outstream << " <PORT_NUM>" << iroc->second.portaddress() << "</PORT_NUM>" << endl;
767  *outstream << " <ROC_I2C_ADDR>" << iroc->second.rocid() << "</ROC_I2C_ADDR>" << endl;
768  *outstream << " <PXLFED_NAME>" << iroc->second.fednumber() << "</PXLFED_NAME>" << endl;
769  *outstream << " <FED_CHAN>" << iroc->second.fedchannel() << "</FED_CHAN>" << endl;
770  *outstream << " <FED_ROC_NUM>" << iroc->second.fedrocnumber() << "</FED_ROC_NUM>" << endl;
771  *outstream << " </DATA>" << endl;
772  *outstream << "" << endl;
773  }
774 }
std::map< PixelROCName, PixelHdwAddress > translationtable_
std::string TBMChannelString() const
Definition: PixelChannel.h:31
const PixelChannel & getChannelFromHdwAddress(const PixelHdwAddress &aHdwAddress) const

◆ writeXMLHeader()

void PixelNameTranslation::writeXMLHeader ( pos::PixelConfigKey  key,
int  version,
std::string  path,
std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 709 of file PixelNameTranslation.cc.

References gather_cfg::cout, contentValuesFiles::fullPath, pos::PixelConfigBase::getAuthor(), pos::PixelConfigBase::getComment(), pos::PixelTimeFormatter::getmSecTime(), pos::PixelTimeFormatter::getTime(), EnsembleCalibrationLA_cfg::path, AlCaHLTBitMon_QueryRunRegistry::string, and relval_steps::version.

714  {
715  std::string mthn = "[PixelNameTranslation:::writeXMLHeader()]\t\t\t ";
716  std::stringstream fullPath;
717  fullPath << path << "/Pixel_NameTranslation_" << PixelTimeFormatter::getmSecTime() << ".xml";
718  cout << __LINE__ << "]\t" << mthn << "Writing to: " << fullPath.str() << endl;
719 
720  outstream->open(fullPath.str().c_str());
721  *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << endl;
722  *outstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << endl;
723  *outstream << " <HEADER>" << endl;
724  *outstream << " <TYPE>" << endl;
725  *outstream << " <EXTENSION_TABLE_NAME>PIXEL_NAME_TRANSLATION</EXTENSION_TABLE_NAME>" << endl;
726  *outstream << " <NAME>Pixel Name Translation</NAME>" << endl;
727  *outstream << " </TYPE>" << endl;
728  *outstream << " <RUN>" << endl;
729  *outstream << " <RUN_TYPE>Pixel Name Translation</RUN_TYPE>" << endl;
730  *outstream << " <RUN_NUMBER>1</RUN_NUMBER>" << endl;
731  *outstream << " <RUN_BEGIN_TIMESTAMP>" << pos::PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << endl;
732  *outstream << " <LOCATION>CERN P5</LOCATION>" << endl;
733  *outstream << " </RUN>" << endl;
734  *outstream << " </HEADER>" << endl;
735  *outstream << " " << endl;
736  *outstream << " <DATA_SET>" << endl;
737  *outstream << " <PART>" << endl;
738  *outstream << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << endl;
739  *outstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << endl;
740  *outstream << " </PART>" << endl;
741  *outstream << " <VERSION>" << version << "</VERSION>" << endl;
742  *outstream << " <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>" << endl;
743  *outstream << " <CREATED_BY_USER>" << getAuthor() << "</CREATED_BY_USER>" << endl;
744  *outstream << " " << endl;
745 }
std::string getComment() const
static std::string getmSecTime(void)
static std::string getTime(void)
std::string getAuthor() const

◆ writeXMLTrailer()

void PixelNameTranslation::writeXMLTrailer ( std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 777 of file PixelNameTranslation.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

779  {
780  std::string mthn = "[PixelNameTranslation::writeXMLTrailer()]\t\t\t ";
781 
782  *outstream << " </DATA_SET>" << endl;
783  *outstream << "</ROOT> " << endl;
784 
785  outstream->close();
786 }

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  s,
const PixelNameTranslation table 
)
friend

Definition at line 386 of file PixelNameTranslation.cc.

386  {
387  //for (unsigned int i=0;i<table.translationtable_.size();i++){
388  // s << table.translationtable_[i]<<std::endl;
389  // }
390  return s;
391 }

Member Data Documentation

◆ channelTranslationTable_

std::map<PixelChannel, PixelHdwAddress> pos::PixelNameTranslation::channelTranslationTable_
private

◆ fedlookup_

std::map<PixelHdwAddress, PixelROCName, PixelHdwAddress> pos::PixelNameTranslation::fedlookup_
private

◆ hdwTranslationTable_

std::map<PixelHdwAddress, PixelChannel> pos::PixelNameTranslation::hdwTranslationTable_
private

Definition at line 109 of file PixelNameTranslation.h.

Referenced by getChannelFromHdwAddress(), and PixelNameTranslation().

◆ rocsFromFEDidAndChannel_

std::map<unsigned int, std::map<unsigned int, std::vector<PixelROCName> > > pos::PixelNameTranslation::rocsFromFEDidAndChannel_
private

Definition at line 111 of file PixelNameTranslation.h.

Referenced by getROCsFromFEDChannel(), and PixelNameTranslation().

◆ translationtable_

std::map<PixelROCName, PixelHdwAddress> pos::PixelNameTranslation::translationtable_
private