CMS 3D CMS Logo

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

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

#include <PixelTKFECConfig.h>

Inheritance diagram for pos::PixelTKFECConfig:
pos::PixelConfigBase

Public Member Functions

unsigned int addressFromTKFECID (std::string TKFECID) const
 
unsigned int crateFromTKFECID (std::string TKFECID) const
 
unsigned int getAddress (unsigned int i) const
 
unsigned int getCrate (unsigned int i) const
 
unsigned int getNTKFECBoards () const
 
std::string getTKFECID (unsigned int i) const
 
std::string getType (unsigned int i) const
 
 PixelTKFECConfig (std::string filename)
 
 PixelTKFECConfig (std::vector< std::vector< std::string > > &tableMat)
 
std::string typeFromTKFECID (std::string TKFECID) 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
 
 ~PixelTKFECConfig () 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< PixelTKFECParametersTKFECconfig_
 

Detailed Description

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

" "


A longer explanation will be placed here later

Definition at line 27 of file PixelTKFECConfig.h.

Constructor & Destructor Documentation

◆ PixelTKFECConfig() [1/2]

PixelTKFECConfig::PixelTKFECConfig ( std::string  filename)

Definition at line 87 of file PixelTKFECConfig.cc.

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

87  : PixelConfigBase(" ", " ", " ") {
88  std::string mthn = "]\t[PixelTKFECConfig::PixelTKFECConfig()]\t\t\t ";
89  std::ifstream in(filename.c_str());
90 
91  if (!in.good()) {
92  std::cout << __LINE__ << mthn << "Could not open: " << filename << std::endl;
93  throw std::runtime_error("Failed to open file " + filename);
94  } else {
95  std::cout << __LINE__ << mthn << "Opened: " << filename << std::endl;
96  }
97 
99 
100  getline(in, dummy); // skip the column headings
101 
102  do {
103  std::string TKFECID;
104  unsigned int crate;
106  unsigned int address;
107 
108  in >> TKFECID >> std::dec >> crate >> type;
109  if (type == "VME" || type == "PCI") {
110  in >> std::hex >> address >> std::dec;
111  } else // type not specified, default to "VME"
112  {
113  address = strtoul(type.c_str(), nullptr, 16); // convert string to integer using base 16
114  type = "VME";
115  }
116 
117  if (!in.eof()) {
118  //std::cout << TKFECID <<" "<< crate << " "
119  // << std::hex << vme_base_address<<std::dec<<std::endl;
120 
122 
123  tmp.setTKFECParameters(TKFECID, crate, type, address);
124 
125  TKFECconfig_.push_back(tmp);
126  }
127 
128  } while (!in.eof());
129  in.close();
130 }
This class implements..
tmp
align.sh
Definition: createJobs.py:716
PixelConfigBase(std::string description, std::string creator, std::string date)
std::vector< PixelTKFECParameters > TKFECconfig_

◆ PixelTKFECConfig() [2/2]

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


EXTENSION_TABLE_NAME: TRACKER_FEC_PARAMETERS (VIEW: CONF_KEY_TRACKER_FEC_CONFIG_V)

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) TRKFEC_NAME NOT NULL VARCHAR2(200) CRATE_LABEL VARCHAR2(200) CRATE_NUMBER NOT NULL NUMBER(38) TYPE VARCHAR2(200) SLOT_NUMBER NUMBER(38) VME_ADDR NOT NULL VARCHAR2(200) I2CSPEED NUMBER(38)

Definition at line 18 of file PixelTKFECConfig.cc.

References DummyCfis::c, FCDTask_cfi::crate, dqmiodumpmetadata::n, AlCaHLTBitMon_QueryRunRegistry::string, TKFECconfig_, and createJobs::tmp.

18  : PixelConfigBase(" ", " ", " ") {
19  std::map<std::string, int> colM;
20  std::vector<std::string> colNames;
40  colNames.push_back("CONFIG_KEY");
41  colNames.push_back("KEY_TYPE");
42  colNames.push_back("KEY_ALIAS");
43  colNames.push_back("VERSION");
44  colNames.push_back("KIND_OF_COND");
45  colNames.push_back("TRKFEC_NAME");
46  colNames.push_back("CRATE_LABEL");
47  colNames.push_back("CRATE_NUMBER");
48  colNames.push_back("TYPE");
49  colNames.push_back("SLOT_NUMBER");
50  colNames.push_back("VME_ADDR");
51  colNames.push_back("I2CSPEED");
52 
53  for (unsigned int c = 0; c < tableMat[0].size(); c++) {
54  for (unsigned int n = 0; n < colNames.size(); n++) {
55  if (tableMat[0][c] == colNames[n]) {
56  colM[colNames[n]] = c;
57  break;
58  }
59  }
60  } //end for
61  /*
62  for(unsigned int n=0; n<colNames.size(); n++)
63  {
64  if(colM.find(colNames[n]) == colM.end())
65  {
66  std::cerr << "[PixelTKFECConfig::PixelTKFECConfig()]\tCouldn't find in the database the column with name " << colNames[n] << std::endl;
67  assert(0);
68  }
69  }
70  */
71 
72  for (unsigned int r = 1; r < tableMat.size(); r++) //Goes to every row of the Matrix
73  {
74  std::string TKFECID = tableMat[r][colM["TRKFEC_NAME"]];
75  unsigned int crate = atoi(tableMat[r][colM["CRATE_NUMBER"]].c_str());
76  std::string type = "VME";
77  unsigned int address = strtoul(tableMat[r][colM["VME_ADDR"]].c_str(), nullptr, 16);
79  tmp.setTKFECParameters(TKFECID, crate, type, address);
80  TKFECconfig_.push_back(tmp);
81  // cout << "[PixelTKFECConfig::PixelTKFECConfig()]\tID: " << TKFECID << " crate: " << crate << " address: " << address << endl;
82  }
83 } // end contructor
This class implements..
tmp
align.sh
Definition: createJobs.py:716
PixelConfigBase(std::string description, std::string creator, std::string date)
std::vector< PixelTKFECParameters > TKFECconfig_

◆ ~PixelTKFECConfig()

PixelTKFECConfig::~PixelTKFECConfig ( )
override

Definition at line 132 of file PixelTKFECConfig.cc.

132 {}

Member Function Documentation

◆ addressFromTKFECID()

unsigned int PixelTKFECConfig::addressFromTKFECID ( std::string  TKFECID) const

Definition at line 215 of file PixelTKFECConfig.cc.

References cms::cuda::assert(), gather_cfg::cout, getAddress(), getTKFECID(), mps_fire::i, and TKFECconfig_.

215  {
216  for (unsigned int i = 0; i < TKFECconfig_.size(); i++) {
217  if (TKFECconfig_[i].getTKFECID() == TKFECID)
218  return TKFECconfig_[i].getAddress();
219  }
220 
221  std::cout << "Could not find TKFEC ID:" << TKFECID << std::endl;
222 
223  assert(0);
224 
225  return 0;
226 }
assert(be >=bs)
unsigned int getAddress(unsigned int i) const
std::string getTKFECID(unsigned int i) const
std::vector< PixelTKFECParameters > TKFECconfig_

◆ crateFromTKFECID()

unsigned int PixelTKFECConfig::crateFromTKFECID ( std::string  TKFECID) const

Definition at line 189 of file PixelTKFECConfig.cc.

References cms::cuda::assert(), gather_cfg::cout, getCrate(), getTKFECID(), mps_fire::i, and TKFECconfig_.

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

189  {
190  for (unsigned int i = 0; i < TKFECconfig_.size(); i++) {
191  if (TKFECconfig_[i].getTKFECID() == TKFECID)
192  return TKFECconfig_[i].getCrate();
193  }
194 
195  std::cout << "Could not find TKFEC ID:" << TKFECID << std::endl;
196 
197  assert(0);
198 
199  return 0;
200 }
unsigned int getCrate(unsigned int i) const
assert(be >=bs)
std::string getTKFECID(unsigned int i) const
std::vector< PixelTKFECParameters > TKFECconfig_

◆ getAddress()

unsigned int PixelTKFECConfig::getAddress ( unsigned int  i) const

Definition at line 184 of file PixelTKFECConfig.cc.

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

Referenced by addressFromTKFECID().

184  {
185  assert(i < TKFECconfig_.size());
186  return TKFECconfig_[i].getAddress();
187 }
assert(be >=bs)
std::vector< PixelTKFECParameters > TKFECconfig_

◆ getCrate()

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

Definition at line 174 of file PixelTKFECConfig.cc.

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

Referenced by crateFromTKFECID().

174  {
175  assert(i < TKFECconfig_.size());
176  return TKFECconfig_[i].getCrate();
177 }
assert(be >=bs)
std::vector< PixelTKFECParameters > TKFECconfig_

◆ getNTKFECBoards()

unsigned int PixelTKFECConfig::getNTKFECBoards ( ) const

Definition at line 167 of file PixelTKFECConfig.cc.

References TKFECconfig_.

167 { return TKFECconfig_.size(); }
std::vector< PixelTKFECParameters > TKFECconfig_

◆ getTKFECID()

std::string PixelTKFECConfig::getTKFECID ( unsigned int  i) const

Definition at line 169 of file PixelTKFECConfig.cc.

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

Referenced by addressFromTKFECID(), crateFromTKFECID(), and typeFromTKFECID().

169  {
170  assert(i < TKFECconfig_.size());
171  return TKFECconfig_[i].getTKFECID();
172 }
assert(be >=bs)
std::vector< PixelTKFECParameters > TKFECconfig_

◆ getType()

std::string PixelTKFECConfig::getType ( unsigned int  i) const

Definition at line 179 of file PixelTKFECConfig.cc.

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

Referenced by typeFromTKFECID(), and writeASCII().

179  {
180  assert(i < TKFECconfig_.size());
181  return TKFECconfig_[i].getType();
182 }
assert(be >=bs)
std::vector< PixelTKFECParameters > TKFECconfig_

◆ typeFromTKFECID()

std::string PixelTKFECConfig::typeFromTKFECID ( std::string  TKFECID) const

Definition at line 202 of file PixelTKFECConfig.cc.

References cms::cuda::assert(), gather_cfg::cout, getTKFECID(), getType(), mps_fire::i, and TKFECconfig_.

202  {
203  for (unsigned int i = 0; i < TKFECconfig_.size(); i++) {
204  if (TKFECconfig_[i].getTKFECID() == TKFECID)
205  return TKFECconfig_[i].getType();
206  }
207 
208  std::cout << "Could not find TKFEC ID:" << TKFECID << std::endl;
209 
210  assert(0);
211 
212  return nullptr;
213 }
std::string getType(unsigned int i) const
assert(be >=bs)
std::string getTKFECID(unsigned int i) const
std::vector< PixelTKFECParameters > TKFECconfig_

◆ writeASCII()

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

Implements pos::PixelConfigBase.

Definition at line 134 of file PixelTKFECConfig.cc.

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

134  {
135  if (!dir.empty())
136  dir += "/";
137  string filename = dir + "tkfecconfig.dat";
138 
139  ofstream out(filename.c_str());
140  if (!out.good()) {
141  cout << "Could not open file:" << filename << endl;
142  assert(0);
143  }
144 
145  out << "#TKFEC ID crate VME/PCI slot/address" << endl;
146  for (unsigned int i = 0; i < TKFECconfig_.size(); i++) {
147  out << TKFECconfig_[i].getTKFECID() << " " << TKFECconfig_[i].getCrate() << " ";
148  if (TKFECconfig_[i].getType() == "PCI") {
149  out << "PCI ";
150  } else {
151  out << " ";
152  }
153  out << "0x" << hex << TKFECconfig_[i].getAddress() << dec << endl;
154  }
155  out.close();
156 }
std::string getType(unsigned int i) const
assert(be >=bs)
std::vector< PixelTKFECParameters > TKFECconfig_

◆ writeXML() [1/2]

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

Reimplemented from pos::PixelConfigBase.

Definition at line 48 of file PixelTKFECConfig.h.

48 { ; }

◆ writeXML() [2/2]

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

Reimplemented from pos::PixelConfigBase.

Definition at line 272 of file PixelTKFECConfig.cc.

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

272  {
273  std::string mthn = "[PixelTKFECConfig::writeXML()]\t\t\t ";
274 
275  for (unsigned int i = 0; i < TKFECconfig_.size(); i++) {
276  *outstream << " <DATA>" << std::endl;
277  *outstream << " <TRKFEC_NAME>" << TKFECconfig_[i].getTKFECID() << "</TRKFEC_NAME>" << std::endl;
278  *outstream << " <CRATE_NUMBER>" << TKFECconfig_[i].getCrate() << "</CRATE_NUMBER>" << std::endl;
279  *outstream << " <VME_ADDR>"
280  << "0x" << hex << TKFECconfig_[i].getAddress() << dec << "</VME_ADDR>" << std::endl;
281  *outstream << " </DATA>" << std::endl;
282  }
283 }
std::vector< PixelTKFECParameters > TKFECconfig_

◆ writeXMLHeader()

void PixelTKFECConfig::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 229 of file PixelTKFECConfig.cc.

References gather_cfg::cout, 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.

234  {
235  std::string mthn = "[PixelTKFECConfig::writeXMLHeader()]\t\t\t ";
236  std::stringstream maskFullPath;
237 
238  maskFullPath << path << "/Pixel_TrackerFecParameters_" << PixelTimeFormatter::getmSecTime() << ".xml";
239  std::cout << mthn << "Writing to: " << maskFullPath.str() << std::endl;
240 
241  outstream->open(maskFullPath.str().c_str());
242 
243  *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl;
244  *outstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl;
245  *outstream << "" << std::endl;
246  *outstream << " <HEADER>" << std::endl;
247  *outstream << " <TYPE>" << std::endl;
248  *outstream << " <EXTENSION_TABLE_NAME>TRACKER_FEC_PARAMETERS</EXTENSION_TABLE_NAME>" << std::endl;
249  *outstream << " <NAME>Tracker FEC Parameters</NAME>" << std::endl;
250  *outstream << " </TYPE>" << std::endl;
251  *outstream << " <RUN>" << std::endl;
252  *outstream << " <RUN_TYPE>Tracker FEC Parameters</RUN_TYPE>" << std::endl;
253  *outstream << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl;
254  *outstream << " <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl;
255  *outstream << " <LOCATION>CERN P5</LOCATION>" << std::endl;
256  *outstream << " </RUN>" << std::endl;
257  *outstream << " </HEADER>" << std::endl;
258  *outstream << "" << std::endl;
259  *outstream << " <DATA_SET>" << std::endl;
260  *outstream << "" << std::endl;
261  *outstream << " <VERSION>" << version << "</VERSION>" << std::endl;
262  *outstream << " <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>" << std::endl;
263  *outstream << " <CREATED_BY_USER>" << getAuthor() << "</CREATED_BY_USER>" << std::endl;
264  *outstream << "" << std::endl;
265  *outstream << " <PART>" << std::endl;
266  *outstream << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl;
267  *outstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl;
268  *outstream << " </PART>" << std::endl;
269 }
std::string getComment() const
static std::string getmSecTime(void)
static std::string getTime(void)
std::string getAuthor() const

◆ writeXMLTrailer()

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

Reimplemented from pos::PixelConfigBase.

Definition at line 286 of file PixelTKFECConfig.cc.

References gather_cfg::cout, and AlCaHLTBitMon_QueryRunRegistry::string.

288  {
289  std::string mthn = "[PixelTKFECConfig::writeXMLTrailer()]\t\t\t ";
290 
291  *outstream << " </DATA_SET>" << std::endl;
292  *outstream << "</ROOT>" << std::endl;
293 
294  outstream->close();
295  std::cout << mthn << "Data written " << std::endl;
296 }

Member Data Documentation

◆ TKFECconfig_

std::vector<PixelTKFECParameters> pos::PixelTKFECConfig::TKFECconfig_
private