CMS 3D CMS Logo

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

This is the documentation about PixelFEDConfig... More...

#include <PixelFEDConfig.h>

Inheritance diagram for pos::PixelFEDConfig:
pos::PixelConfigBase

Public Member Functions

unsigned int crateFromFEDNumber (unsigned int fednumber) const
 
unsigned int FEDNumberFromCrateAndVMEBaseAddress (unsigned int crate, unsigned int vmebaseaddress) const
 
unsigned int getCrate (unsigned int i) const
 
unsigned int getFEDNumber (unsigned int i) const
 
unsigned int getNFEDBoards () const
 
unsigned int getVMEBaseAddress (unsigned int i) const
 
 PixelFEDConfig (std::string filename)
 
 PixelFEDConfig (std::vector< std::vector< std::string > > &tableMat)
 
unsigned int VMEBaseAddressFromFEDNumber (unsigned int fednumber) 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
 
 ~PixelFEDConfig () 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 Attributes

std::vector< PixelFEDParametersfedconfig_
 

Detailed Description

This is the documentation about PixelFEDConfig...

" "


This class specifies which FED boards are used and how they are addressed

Definition at line 27 of file PixelFEDConfig.h.

Constructor & Destructor Documentation

◆ PixelFEDConfig() [1/2]

PixelFEDConfig::PixelFEDConfig ( std::string  filename)

Definition at line 126 of file PixelFEDConfig.cc.

References gather_cfg::cout, FCDTask_cfi::crate, TauDecayModes::dec, fedconfig_, corrVsCorr::filename, recoMuon::in, AlCaHLTBitMon_QueryRunRegistry::string, and createJobs::tmp.

126  : PixelConfigBase(" ", " ", " ") {
127  std::string mthn = "[PixelFEDConfig::PixelFEDConfig()]\t\t\t ";
128  std::ifstream in(filename.c_str());
129 
130  if (!in.good()) {
131  std::cout << __LINE__ << "]\t" << mthn << "Could not open: " << filename.c_str() << std::endl;
132  throw std::runtime_error("Failed to open file " + filename);
133  } else {
134  std::cout << __LINE__ << "]\t" << mthn << "Opened: " << filename.c_str() << std::endl;
135  }
136 
138 
139  in >> dummy;
140  in >> dummy;
141  in >> dummy;
142  in >> dummy;
143  in >> dummy;
144  in >> dummy;
145 
146  do {
147  unsigned int fednumber;
148  unsigned int crate;
149  unsigned int vme_base_address;
150 
151  in >> fednumber >> crate >> std::hex >> vme_base_address >> std::dec;
152 
153  if (!in.eof()) {
154  // std::cout << __LINE__ << "]\t" << mthn << std::dec << fednumber <<" "<< crate << " 0x"
155  // << std::hex << vme_base_address<<std::dec<<std::endl;
157 
158  tmp.setFEDParameters(fednumber, crate, vme_base_address);
159 
160  fedconfig_.push_back(tmp);
161  }
162 
163  } while (!in.eof());
164  in.close();
165 }
This class implements..
std::vector< PixelFEDParameters > fedconfig_
tmp
align.sh
Definition: createJobs.py:716
PixelConfigBase(std::string description, std::string creator, std::string date)

◆ PixelFEDConfig() [2/2]

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

Definition at line 18 of file PixelFEDConfig.cc.

References HltBtagPostValidation_cff::c, fedconfig_, RemoveAddSevLevel::flag, getFEDNumber(), cuy::ins, createfilelist::int, dqmiodumpmetadata::n, AlCaHLTBitMon_QueryRunRegistry::string, and createJobs::tmp.

18  : PixelConfigBase(" ", " ", " ") {
19  std::string mthn = "[PixelFEDConfig::PixelFEDConfig()]\t\t\t ";
20 
21  std::vector<std::string> ins = tableMat[0];
22  std::map<std::string, int> colM;
23  std::vector<std::string> colNames;
24  /*
25  EXTENSION_TABLE_NAME: FED_CRATE_CONFIG (VIEW: CONF_KEY_FED_CRATE_CONFIGV)
26 
27  CONFIG_KEY NOT NULL VARCHAR2(80)
28  KEY_TYPE NOT NULL VARCHAR2(80)
29  KEY_ALIAS NOT NULL VARCHAR2(80)
30  VERSION VARCHAR2(40)
31  KIND_OF_COND NOT NULL VARCHAR2(40)
32  PIXEL_FED NOT NULL NUMBER(38)
33  CRATE_NUMBER NOT NULL NUMBER(38)
34  VME_ADDR NOT NULL VARCHAR2(200)
35 */
36 
37  colNames.push_back("CONFIG_KEY");
38  colNames.push_back("KEY_TYPE");
39  colNames.push_back("KEY_ALIAS");
40  colNames.push_back("VERSION");
41  colNames.push_back("KIND_OF_COND");
42  colNames.push_back("PIXEL_FED");
43  colNames.push_back("CRATE_NUMBER");
44  colNames.push_back("VME_ADDR");
45  /*
46  colNames.push_back("PIXEL_FED" ); //0
47  colNames.push_back("CRATE_NUMBER" ); //1
48  colNames.push_back("VME_ADDRS_HEX"); //2
49 */
50  for (unsigned int c = 0; c < tableMat[0].size(); c++) {
51  for (unsigned int n = 0; n < colNames.size(); n++) {
52  if (tableMat[0][c] == colNames[n]) {
53  colM[colNames[n]] = c;
54  break;
55  }
56  }
57  } //end for
58  /*
59  for(unsigned int n=0; n<colNames.size(); n++)
60  {
61  if(colM.find(colNames[n]) == colM.end())
62  {
63  std::cerr << __LINE__ << "]\t" << mthn << "Couldn't find in the database the column with name " << colNames[n] << std::endl;
64  assert(0);
65  }
66  }
67  */
68 
69  std::string fedname = "";
70  unsigned int fednum = 0;
71  fedconfig_.clear();
72  bool flag = false;
73  for (unsigned int r = 1; r < tableMat.size(); r++) { //Goes to every row of the Matrix
74 
75  fedname = tableMat
76  [r]
77  [colM["PIXEL_FED"]]; //This is not going to work if you change in the database "PxlFed_#" in the FED column.Im removing "PlxFed_" and store the number
78  //becuase the PixelFecConfig class ask for the fec number not the name.
79  // 01234567
80  // PxlFED_XX
81  // fedname.erase(0,7);
82  fednum = (unsigned int)atoi(fedname.c_str());
83 
84  if (fedconfig_.empty()) {
86  unsigned int vme_base_address = 0;
87  vme_base_address = strtoul(tableMat[r][colM["VME_ADDR"]].c_str(), nullptr, 16);
88  // string hexVMEAddr = tableMat[r][colM["VME_ADDRS_HEX"]] ;
89  // sscanf(hexVMEAddr.c_str(), "%x", &vme_base_address) ;
90  tmp.setFEDParameters(fednum, (unsigned int)atoi(tableMat[r][colM["CRATE_NUMBER"]].c_str()), vme_base_address);
91  fedconfig_.push_back(tmp);
92  } else {
93  for (unsigned int y = 0; y < fedconfig_.size(); y++) {
94  if (fedconfig_[y].getFEDNumber() ==
95  fednum) // This is to check if there are Pixel Feds already in the vector because
96  { // in the view of the database that I'm reading there are many repeated entries (AS FAR AS THESE PARAMS ARE CONCERNED).
97  flag = true; // This ensure that there are no objects in the fedconfig vector with repeated values.
98  break;
99  } else
100  flag = false;
101  }
102 
103  if (flag == false) {
105  tmp.setFEDParameters(fednum,
106  (unsigned int)atoi(tableMat[r][colM["CRATE_NUMBER"]].c_str()),
107  (unsigned int)strtoul(tableMat[r][colM["VME_ADDR"]].c_str(), nullptr, 16));
108  fedconfig_.push_back(tmp);
109  }
110  } //end else
111  } //end for r
112  /*
113  std::cout << __LINE__ << "]\t" << mthn << std::endl;
114 
115  for( unsigned int x = 0 ; x < fedconfig_.size() ; x++)
116  {
117  std::cout<< __LINE__ << "]\t" << mthn << fedconfig_[x] << std::endl;
118  }
119 
120  std::cout<< __LINE__ << "]\t" << mthn << fedconfig_.size() << std::endl;
121 */
122 } //end Constructor
ins
Definition: cuy.py:313
unsigned int getFEDNumber(unsigned int i) const
This class implements..
std::vector< PixelFEDParameters > fedconfig_
tmp
align.sh
Definition: createJobs.py:716
PixelConfigBase(std::string description, std::string creator, std::string date)

◆ ~PixelFEDConfig()

PixelFEDConfig::~PixelFEDConfig ( )
override

Definition at line 176 of file PixelFEDConfig.cc.

176 {}

Member Function Documentation

◆ crateFromFEDNumber()

unsigned int PixelFEDConfig::crateFromFEDNumber ( unsigned int  fednumber) const

Definition at line 215 of file PixelFEDConfig.cc.

References cms::cuda::assert(), gather_cfg::cout, fedconfig_, getCrate(), getFEDNumber(), mps_fire::i, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by pos::PixelCalibConfiguration::fedCardsAndChannels(), and pos::PixelCalibConfiguration::getFEDCrates().

215  {
216  std::string mthn = "[PixelFEDConfig::crateFromFEDNumber()]\t\t\t ";
217  for (unsigned int i = 0; i < fedconfig_.size(); i++) {
218  if (fedconfig_[i].getFEDNumber() == fednumber)
219  return fedconfig_[i].getCrate();
220  }
221 
222  std::cout << __LINE__ << "]\t" << mthn << "Could not find FED number: " << fednumber << std::endl;
223 
224  assert(0);
225 
226  return 0;
227 }
assert(be >=bs)
unsigned int getCrate(unsigned int i) const
unsigned int getFEDNumber(unsigned int i) const
std::vector< PixelFEDParameters > fedconfig_

◆ FEDNumberFromCrateAndVMEBaseAddress()

unsigned int PixelFEDConfig::FEDNumberFromCrateAndVMEBaseAddress ( unsigned int  crate,
unsigned int  vmebaseaddress 
) const

Definition at line 243 of file PixelFEDConfig.cc.

References cms::cuda::assert(), gather_cfg::cout, FCDTask_cfi::crate, fedconfig_, getCrate(), getFEDNumber(), mps_fire::i, and AlCaHLTBitMon_QueryRunRegistry::string.

244  {
245  std::string mthn = "[PixelFEDConfig::FEDNumberFromCrateAndVMEBaseAddress()]\t ";
246  for (unsigned int i = 0; i < fedconfig_.size(); i++) {
247  if (fedconfig_[i].getCrate() == crate && fedconfig_[i].getVMEBaseAddress() == vmebaseaddress)
248  return fedconfig_[i].getFEDNumber();
249  }
250 
251  std::cout << __LINE__ << "]\t" << mthn << "Could not find FED crate and address: " << crate << ", " << vmebaseaddress
252  << std::endl;
253 
254  assert(0);
255 
256  return 0;
257 }
assert(be >=bs)
unsigned int getCrate(unsigned int i) const
unsigned int getFEDNumber(unsigned int i) const
std::vector< PixelFEDParameters > fedconfig_

◆ getCrate()

unsigned int PixelFEDConfig::getCrate ( unsigned int  i) const

Definition at line 205 of file PixelFEDConfig.cc.

References cms::cuda::assert(), fedconfig_, and mps_fire::i.

Referenced by crateFromFEDNumber(), and FEDNumberFromCrateAndVMEBaseAddress().

205  {
206  assert(i < fedconfig_.size());
207  return fedconfig_[i].getCrate();
208 }
assert(be >=bs)
std::vector< PixelFEDParameters > fedconfig_

◆ getFEDNumber()

unsigned int PixelFEDConfig::getFEDNumber ( unsigned int  i) const

Definition at line 200 of file PixelFEDConfig.cc.

References cms::cuda::assert(), fedconfig_, and mps_fire::i.

Referenced by crateFromFEDNumber(), FEDNumberFromCrateAndVMEBaseAddress(), PixelFEDConfig(), and VMEBaseAddressFromFEDNumber().

200  {
201  assert(i < fedconfig_.size());
202  return fedconfig_[i].getFEDNumber();
203 }
assert(be >=bs)
std::vector< PixelFEDParameters > fedconfig_

◆ getNFEDBoards()

unsigned int PixelFEDConfig::getNFEDBoards ( ) const

Definition at line 198 of file PixelFEDConfig.cc.

References fedconfig_.

198 { return fedconfig_.size(); }
std::vector< PixelFEDParameters > fedconfig_

◆ getVMEBaseAddress()

unsigned int PixelFEDConfig::getVMEBaseAddress ( unsigned int  i) const

Definition at line 210 of file PixelFEDConfig.cc.

References cms::cuda::assert(), fedconfig_, and mps_fire::i.

Referenced by VMEBaseAddressFromFEDNumber().

210  {
211  assert(i < fedconfig_.size());
212  return fedconfig_[i].getVMEBaseAddress();
213 }
assert(be >=bs)
std::vector< PixelFEDParameters > fedconfig_

◆ VMEBaseAddressFromFEDNumber()

unsigned int PixelFEDConfig::VMEBaseAddressFromFEDNumber ( unsigned int  fednumber) const

Definition at line 229 of file PixelFEDConfig.cc.

References cms::cuda::assert(), gather_cfg::cout, fedconfig_, getFEDNumber(), getVMEBaseAddress(), mps_fire::i, and AlCaHLTBitMon_QueryRunRegistry::string.

229  {
230  std::string mthn = "[PixelFEDConfig::VMEBaseAddressFromFEDNumber()]\t\t ";
231  for (unsigned int i = 0; i < fedconfig_.size(); i++) {
232  if (fedconfig_[i].getFEDNumber() == fednumber)
233  return fedconfig_[i].getVMEBaseAddress();
234  }
235 
236  std::cout << __LINE__ << "]\t" << mthn << "Could not find FED number: " << fednumber << std::endl;
237 
238  assert(0);
239 
240  return 0;
241 }
assert(be >=bs)
unsigned int getVMEBaseAddress(unsigned int i) const
unsigned int getFEDNumber(unsigned int i) const
std::vector< PixelFEDParameters > fedconfig_

◆ writeASCII()

void PixelFEDConfig::writeASCII ( std::string  dir) const
overridevirtual

Implements pos::PixelConfigBase.

Definition at line 178 of file PixelFEDConfig.cc.

References cms::cuda::assert(), gather_cfg::cout, TauDecayModes::dec, DeadROC_duringRun::dir, fedconfig_, corrVsCorr::filename, mps_fire::i, MillePedeFileConverter_cfg::out, and AlCaHLTBitMon_QueryRunRegistry::string.

178  {
179  std::string mthn = "[PixelFEDConfig::writeASCII()]\t\t\t\t ";
180  if (!dir.empty())
181  dir += "/";
182  string filename = dir + "fedconfig.dat";
183 
184  ofstream out(filename.c_str());
185  if (!out.good()) {
186  cout << __LINE__ << "]\t" << mthn << "Could not open file: " << filename << endl;
187  assert(0);
188  }
189 
190  out << " #FED number crate vme base address" << endl;
191  for (unsigned int i = 0; i < fedconfig_.size(); i++) {
192  out << fedconfig_[i].getFEDNumber() << " " << fedconfig_[i].getCrate() << " "
193  << "0x" << hex << fedconfig_[i].getVMEBaseAddress() << dec << endl;
194  }
195  out.close();
196 }
assert(be >=bs)
std::vector< PixelFEDParameters > fedconfig_

◆ writeXML() [1/2]

void pos::PixelFEDConfig::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const
inlineoverridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 48 of file PixelFEDConfig.h.

48 { ; }

◆ writeXML() [2/2]

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

Reimplemented from pos::PixelConfigBase.

Definition at line 298 of file PixelFEDConfig.cc.

References TauDecayModes::dec, fedconfig_, mps_fire::i, and AlCaHLTBitMon_QueryRunRegistry::string.

298  {
299  std::string mthn = "[PixelFEDConfig::writeXML()]\t\t\t ";
300 
301  for (unsigned int i = 0; i < fedconfig_.size(); i++) {
302  *outstream << " <DATA>" << endl;
303  *outstream << " <PIXEL_FED>" << fedconfig_[i].getFEDNumber() << "</PIXEL_FED>" << endl;
304  *outstream << " <CRATE_NUMBER>" << fedconfig_[i].getCrate() << "</CRATE_NUMBER>" << endl;
305  *outstream << " <VME_ADDR>"
306  << "0x" << hex << fedconfig_[i].getVMEBaseAddress() << dec << "</VME_ADDR>" << endl;
307  *outstream << " </DATA>" << endl;
308  *outstream << "" << endl;
309  }
310 }
std::vector< PixelFEDParameters > fedconfig_

◆ writeXMLHeader()

void PixelFEDConfig::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 260 of file PixelFEDConfig.cc.

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

265  {
266  std::string mthn = "[PixelFEDConfig::::writeXMLHeader()]\t\t\t ";
267  std::stringstream fullPath;
268  fullPath << path << "/Pixel_FedCrateConfig_" << PixelTimeFormatter::getmSecTime() << ".xml";
269  cout << __LINE__ << "]\t" << mthn << "Writing to: " << fullPath.str() << endl;
270 
271  outstream->open(fullPath.str().c_str());
272  *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << endl;
273  *outstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << endl;
274  *outstream << " <HEADER>" << endl;
275  *outstream << " <TYPE>" << endl;
276  *outstream << " <EXTENSION_TABLE_NAME>FED_CRATE_CONFIG</EXTENSION_TABLE_NAME>" << endl;
277  *outstream << " <NAME>Pixel FED Crate Configuration</NAME>" << endl;
278  *outstream << " </TYPE>" << endl;
279  *outstream << " <RUN>" << endl;
280  *outstream << " <RUN_NAME>Pixel FED Crate Configuration</RUN_NAME>" << endl;
281  *outstream << " <RUN_BEGIN_TIMESTAMP>" << pos::PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << endl;
282  *outstream << " <LOCATION>CERN P5</LOCATION>" << endl;
283  *outstream << " </RUN>" << endl;
284  *outstream << " </HEADER>" << endl;
285  *outstream << " " << endl;
286  *outstream << " <DATA_SET>" << endl;
287  *outstream << " <PART>" << endl;
288  *outstream << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << endl;
289  *outstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << endl;
290  *outstream << " </PART>" << endl;
291  *outstream << " <VERSION>" << version << "</VERSION>" << endl;
292  *outstream << " <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>" << endl;
293  *outstream << " <CREATED_BY_USER>" << getAuthor() << "</CREATED_BY_USER>" << endl;
294  *outstream << " " << endl;
295 }
std::string getComment() const
static std::string getmSecTime(void)
static std::string getTime(void)
std::string getAuthor() const

◆ writeXMLTrailer()

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

Reimplemented from pos::PixelConfigBase.

Definition at line 313 of file PixelFEDConfig.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

315  {
316  std::string mthn = "[PixelFEDConfig::writeXMLTrailer()]\t\t\t ";
317 
318  *outstream << " </DATA_SET>" << endl;
319  *outstream << "</ROOT> " << endl;
320 
321  outstream->close();
322 }

Member Data Documentation

◆ fedconfig_

std::vector<PixelFEDParameters> pos::PixelFEDConfig::fedconfig_
private