CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
pos::PixelFECConfig Class Reference

This class specifies which FEC boards are used and how they are addressed. More...

#include <PixelFECConfig.h>

Inheritance diagram for pos::PixelFECConfig:
pos::PixelConfigBase

Public Member Functions

unsigned int crateFromFECNumber (unsigned int fecnumber) const
 
unsigned int FECSlotFromFECNumber (unsigned int fecnumber)
 
unsigned int getCrate (unsigned int i) const
 
unsigned int getFECNumber (unsigned int i) const
 
unsigned int getFECSlot (unsigned int i)
 
unsigned int getNFECBoards () const
 
unsigned int getVMEBaseAddress (unsigned int i) const
 
 PixelFECConfig (std::string filename)
 
 PixelFECConfig (std::vector< std::vector< std::string > > &tableMat)
 
unsigned int VMEBaseAddressFromFECNumber (unsigned int fecnumber) 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
 
- 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

unsigned int FECSlotFromVMEBaseAddress (unsigned int VMEBaseAddress)
 

Private Attributes

std::vector< PixelFECParametersfecconfig_
 

Detailed Description

This class specifies which FEC boards are used and how they are addressed.

" "

Definition at line 24 of file PixelFECConfig.h.

Constructor & Destructor Documentation

PixelFECConfig::PixelFECConfig ( std::string  filename)

Definition at line 90 of file PixelFECConfig.cc.

References gather_cfg::cout, TauDecayModes::dec, fecconfig_, recoMuon::in, pos::PixelFECParameters::setFECParameters(), AlCaHLTBitMon_QueryRunRegistry::string, and createJobs::tmp.

90  : PixelConfigBase(" ", " ", " ") {
91  std::string mthn = "[[PixelFECConfig::PixelFECConfig()]\t\t\t ";
92 
93  std::ifstream in(filename.c_str());
94 
95  if (!in.good()) {
96  std::cout << __LINE__ << "]\t" << mthn << "Could not open: " << filename << std::endl;
97  throw std::runtime_error("Failed to open file " + filename);
98  } else {
99  std::cout << __LINE__ << "]\t" << mthn << " Opened: " << filename << std::endl;
100  }
101 
102  std::string dummy;
103 
104  in >> dummy;
105  in >> dummy;
106  in >> dummy;
107  in >> dummy;
108  in >> dummy;
109  in >> dummy;
110 
111  do {
112  unsigned int fecnumber;
113  unsigned int crate;
114  unsigned int vme_base_address;
115 
116  in >> fecnumber >> crate >> std::hex >> vme_base_address >> std::dec;
117 
118  if (!in.eof()) {
119  //std::cout << __LINE__ << "]\t" << mthn << fecnumber <<" "<< crate << " "
120  // << std::hex << vme_base_address<<std::dec<<std::endl;
121 
123 
124  tmp.setFECParameters(fecnumber, crate, vme_base_address);
125 
126  fecconfig_.push_back(tmp);
127  }
128 
129  } while (!in.eof());
130  in.close();
131 }
This class implements..
std::vector< PixelFECParameters > fecconfig_
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:144
tmp
align.sh
Definition: createJobs.py:716
void setFECParameters(unsigned int fecnumber, unsigned int crate, unsigned int vmebaseaddress)
PixelConfigBase(std::string description, std::string creator, std::string date)
PixelFECConfig::PixelFECConfig ( std::vector< std::vector< std::string > > &  tableMat)

EXTENSION_TABLE_NAME: (VIEW: )

CONFIG_KEY NOT NULL VARCHAR2(80) KEY_TYPE NOT NULL VARCHAR2(80) KEY_ALIAS NOT NULL VARCHAR2(80) VERSION VARCHAR2(40) KIND_OF_COND NOT NULL VARCHAR2(40) PIXFEC_NAME NOT NULL VARCHAR2(200) CRATE_NUMBER NOT NULL NUMBER(38) SLOT_NUMBER NUMBER(38) VME_ADDR NOT NULL VARCHAR2(200)

Definition at line 18 of file PixelFECConfig.cc.

References c, fecconfig_, dqmiodumpmetadata::n, alignCSCRings::r, and createJobs::tmp.

18  : PixelConfigBase(" ", " ", " ") {
19  std::map<std::string, int> colM;
20  std::vector<std::string> colNames;
36  colNames.push_back("CONFIG_KEY");
37  colNames.push_back("KEY_TYPE");
38  colNames.push_back("KEY_ALIAS");
39  colNames.push_back("VERSION");
40  colNames.push_back("KIND_OF_COND");
41  colNames.push_back("PIXFEC_NAME");
42  colNames.push_back("CRATE_NUMBER");
43  colNames.push_back("SLOT_NUMBER");
44  colNames.push_back("VME_ADDR");
45 
46  for (unsigned int c = 0; c < tableMat[0].size(); c++) {
47  for (unsigned int n = 0; n < colNames.size(); n++) {
48  if (tableMat[0][c] == colNames[n]) {
49  colM[colNames[n]] = c;
50  break;
51  }
52  }
53  } //end for
54  /*
55  for(unsigned int n=0; n<colNames.size(); n++)
56  {
57  if(colM.find(colNames[n]) == colM.end()){
58  std::cerr << "[PixelFECConfig::PixelFECConfig()]\tCouldn't find in the database the column with name " << colNames[n] << std::endl;
59  assert(0);
60  }
61  }
62  */
63 
64  fecconfig_.clear();
65  for (unsigned int r = 1; r < tableMat.size(); r++) //Goes to every row of the Matrix
66  {
67  unsigned int fecnumber;
68  unsigned int crate;
69  unsigned int vme_base_address;
70 
71  // 01234567890123
72  // BPix_Pxl_FEC_1
73  // string fullFECName = tableMat[r][colM["PIXEL_FEC"]] ;
74  // fullFECName.replace(0,13,"") ;
75  fecnumber = atoi(tableMat[r][colM["PIXFEC_NAME"]].c_str());
76  crate = atoi(tableMat[r][colM["CRATE_NUMBER"]].c_str());
77  string hexVMEAddr = tableMat[r][colM["VME_ADDR"]];
78  sscanf(hexVMEAddr.c_str(), "%x", &vme_base_address);
80 
81  tmp.setFECParameters(fecnumber, crate, vme_base_address);
82 
83  fecconfig_.push_back(tmp);
84  }
85 
86 } // end contructor
const edm::EventSetup & c
This class implements..
std::vector< PixelFECParameters > fecconfig_
tmp
align.sh
Definition: createJobs.py:716
PixelConfigBase(std::string description, std::string creator, std::string date)

Member Function Documentation

unsigned int PixelFECConfig::crateFromFECNumber ( unsigned int  fecnumber) const

Definition at line 159 of file PixelFECConfig.cc.

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

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

159  {
160  std::string mthn = "[PixelFECConfig::crateFromFECNumber()]\t\t\t ";
161  for (unsigned int i = 0; i < fecconfig_.size(); i++) {
162  if (fecconfig_[i].getFECNumber() == fecnumber)
163  return fecconfig_[i].getCrate();
164  }
165 
166  std::cout << __LINE__ << "]\t" << mthn << "Could not find FEC number: " << fecnumber << std::endl;
167 
168  assert(0);
169 
170  return 0;
171 }
unsigned int getFECNumber(unsigned int i) const
unsigned int getCrate(unsigned int i) const
assert(be >=bs)
std::vector< PixelFECParameters > fecconfig_
tuple cout
Definition: gather_cfg.py:144
unsigned int pos::PixelFECConfig::FECSlotFromFECNumber ( unsigned int  fecnumber)
inline

Definition at line 40 of file PixelFECConfig.h.

References FECSlotFromVMEBaseAddress(), and VMEBaseAddressFromFECNumber().

40  {
42  }
unsigned int FECSlotFromVMEBaseAddress(unsigned int VMEBaseAddress)
unsigned int VMEBaseAddressFromFECNumber(unsigned int fecnumber) const
unsigned int pos::PixelFECConfig::FECSlotFromVMEBaseAddress ( unsigned int  VMEBaseAddress)
inlineprivate

Definition at line 61 of file PixelFECConfig.h.

References cms::cuda::assert().

Referenced by FECSlotFromFECNumber(), and getFECSlot().

61  {
62  assert(VMEBaseAddress % 0x8000000 == 0);
63  return VMEBaseAddress / 0x8000000;
64  }
assert(be >=bs)
unsigned int PixelFECConfig::getCrate ( unsigned int  i) const

Definition at line 149 of file PixelFECConfig.cc.

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

Referenced by crateFromFECNumber().

149  {
150  assert(i < fecconfig_.size());
151  return fecconfig_[i].getCrate();
152 }
assert(be >=bs)
std::vector< PixelFECParameters > fecconfig_
unsigned int PixelFECConfig::getFECNumber ( unsigned int  i) const

Definition at line 144 of file PixelFECConfig.cc.

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

Referenced by crateFromFECNumber(), and VMEBaseAddressFromFECNumber().

144  {
145  assert(i < fecconfig_.size());
146  return fecconfig_[i].getFECNumber();
147 }
assert(be >=bs)
std::vector< PixelFECParameters > fecconfig_
unsigned int pos::PixelFECConfig::getFECSlot ( unsigned int  i)
inline

Definition at line 39 of file PixelFECConfig.h.

References FECSlotFromVMEBaseAddress(), and getVMEBaseAddress().

unsigned int getVMEBaseAddress(unsigned int i) const
unsigned int FECSlotFromVMEBaseAddress(unsigned int VMEBaseAddress)
unsigned int PixelFECConfig::getNFECBoards ( ) const

Definition at line 142 of file PixelFECConfig.cc.

References fecconfig_.

142 { return fecconfig_.size(); }
std::vector< PixelFECParameters > fecconfig_
unsigned int PixelFECConfig::getVMEBaseAddress ( unsigned int  i) const

Definition at line 154 of file PixelFECConfig.cc.

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

Referenced by getFECSlot(), and VMEBaseAddressFromFECNumber().

154  {
155  assert(i < fecconfig_.size());
156  return fecconfig_[i].getVMEBaseAddress();
157 }
assert(be >=bs)
std::vector< PixelFECParameters > fecconfig_
unsigned int PixelFECConfig::VMEBaseAddressFromFECNumber ( unsigned int  fecnumber) const

Definition at line 173 of file PixelFECConfig.cc.

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

Referenced by FECSlotFromFECNumber().

173  {
174  std::string mthn = "[PixelFECConfig::VMEBaseAddressFromFECNumber()]\t\t ";
175  for (unsigned int i = 0; i < fecconfig_.size(); i++) {
176  if (fecconfig_[i].getFECNumber() == fecnumber)
177  return fecconfig_[i].getVMEBaseAddress();
178  }
179 
180  std::cout << __LINE__ << "]\t" << mthn << "Could not find FEC number: " << fecnumber << std::endl;
181 
182  assert(0);
183 
184  return 0;
185 }
unsigned int getFECNumber(unsigned int i) const
unsigned int getVMEBaseAddress(unsigned int i) const
assert(be >=bs)
std::vector< PixelFECParameters > fecconfig_
tuple cout
Definition: gather_cfg.py:144
void PixelFECConfig::writeASCII ( std::string  dir = "") const
overridevirtual

Implements pos::PixelConfigBase.

Definition at line 188 of file PixelFECConfig.cc.

References TauDecayModes::dec, fecconfig_, lut2db_cfg::filename, mps_fire::i, submitPVResolutionJobs::out, and AlCaHLTBitMon_QueryRunRegistry::string.

188  {
189  if (!dir.empty())
190  dir += "/";
191  std::string filename = dir + "fecconfig.dat";
192  std::ofstream out(filename.c_str());
193 
194  std::vector<PixelFECParameters>::const_iterator i = fecconfig_.begin();
195 
196  out << "#FEC number crate vme base address" << endl;
197  for (; i != fecconfig_.end(); ++i) {
198  out << i->getFECNumber() << " " << i->getCrate() << " "
199  << "0x" << hex << i->getVMEBaseAddress() << dec << endl;
200  }
201 }
std::vector< PixelFECParameters > fecconfig_
tuple filename
Definition: lut2db_cfg.py:20
void pos::PixelFECConfig::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const
inlineoverridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 45 of file PixelFECConfig.h.

45 { ; }
void PixelFECConfig::writeXML ( std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 243 of file PixelFECConfig.cc.

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

243  {
244  std::string mthn = "[PixelFECConfig::writeXML()]\t\t\t ";
245 
246  std::vector<PixelFECParameters>::const_iterator i = fecconfig_.begin();
247 
248  for (; i != fecconfig_.end(); ++i) {
249  *outstream << "" << endl;
250  *outstream << " <DATA>" << endl;
251  *outstream << " <PIXFEC_NAME>" << i->getFECNumber() << "</PIXFEC_NAME>" << endl;
252  *outstream << " <CRATE_NUMBER>" << i->getCrate() << "</CRATE_NUMBER>" << endl;
253  *outstream << " <VME_ADDR>0x" << hex << i->getVMEBaseAddress() << dec << "</VME_ADDR>" << endl;
254  *outstream << " </DATA>" << endl;
255  }
256 }
std::vector< PixelFECParameters > fecconfig_
void PixelFECConfig::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 204 of file PixelFECConfig.cc.

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

209  {
210  std::string mthn = "[PixelFECConfig::writeXMLHeader()]\t\t\t ";
211  std::stringstream fullPath;
212  fullPath << path << "/Pixel_PixelFecParameters_" << PixelTimeFormatter::getmSecTime() << ".xml";
213  cout << __LINE__ << "]\t" << mthn << "Writing to: " << fullPath.str() << endl;
214 
215  outstream->open(fullPath.str().c_str());
216 
217  *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << endl;
218  *outstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << endl;
219  *outstream << " <HEADER>" << endl;
220  *outstream << " <TYPE>" << endl;
221  *outstream << " <EXTENSION_TABLE_NAME>PIXEL_FEC_PARAMETERS</EXTENSION_TABLE_NAME>" << endl;
222  *outstream << " <NAME>Pixel FEC Parameters</NAME>" << endl;
223  *outstream << " </TYPE>" << endl;
224  *outstream << " <RUN>" << endl;
225  *outstream << " <RUN_TYPE>Pixel FEC Parameters</RUN_TYPE>" << endl;
226  *outstream << " <RUN_NUMBER>1</RUN_NUMBER>" << endl;
227  *outstream << " <RUN_BEGIN_TIMESTAMP>" << pos::PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << endl;
228  *outstream << " <LOCATION>CERN P5</LOCATION>" << endl;
229  *outstream << " </RUN>" << endl;
230  *outstream << " </HEADER>" << endl;
231  *outstream << "" << endl;
232  *outstream << " <DATA_SET>" << endl;
233  *outstream << " <PART>" << endl;
234  *outstream << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << endl;
235  *outstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << endl;
236  *outstream << " </PART>" << endl;
237  *outstream << " <VERSION>" << version << "</VERSION>" << endl;
238  *outstream << " <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>" << endl;
239  *outstream << " <CREATED_BY_USER>" << getAuthor() << "</CREATED_BY_USER>" << endl;
240 }
static std::string getmSecTime(void)
static std::string getTime(void)
std::string getComment() const
std::string getAuthor() const
tuple cout
Definition: gather_cfg.py:144
void PixelFECConfig::writeXMLTrailer ( std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 259 of file PixelFECConfig.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

261  {
262  std::string mthn = "[PixelFECConfig::writeXMLTrailer()]\t\t\t ";
263 
264  *outstream << "" << endl;
265  *outstream << " </DATA_SET>" << endl;
266  *outstream << "</ROOT> " << endl;
267 
268  outstream->close();
269 }

Member Data Documentation

std::vector<PixelFECParameters> pos::PixelFECConfig::fecconfig_
private