CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 
virtual void writeASCII (std::string dir) const
 
virtual void writeXML (pos::PixelConfigKey key, int version, std::string path) const
 
virtual void writeXML (std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
 
virtual void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
 
virtual void writeXMLTrailer (std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
 
virtual ~PixelTKFECConfig ()
 
- 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::PixelTKFECConfig ( std::string  filename)

Definition at line 93 of file PixelTKFECConfig.cc.

References gather_cfg::cout, TauDecayModes::dec, recoMuon::in, pos::PixelTKFECParameters::setTKFECParameters(), AlCaHLTBitMon_QueryRunRegistry::string, TKFECconfig_, and tmp.

93  :
94  PixelConfigBase(" "," "," "){
95 
96  std::string mthn ="]\t[PixelTKFECConfig::PixelTKFECConfig()]\t\t\t " ;
97  std::ifstream in(filename.c_str());
98 
99  if (!in.good()){
100  std::cout << __LINE__ << mthn << "Could not open: " << filename << std::endl;
101  throw std::runtime_error("Failed to open file "+filename);
102  }
103  else {
104  std::cout << __LINE__ << mthn << "Opened: " << filename << std::endl;
105  }
106 
107  std::string dummy;
108 
109  getline(in, dummy); // skip the column headings
110 
111  do {
112 
113  std::string TKFECID;
114  unsigned int crate;
116  unsigned int address;
117 
118  in >> TKFECID >> std::dec >> crate >> type;
119  if (type=="VME" || type=="PCI")
120  {
121  in >> std::hex>> address >>std::dec ;
122  }
123  else // type not specified, default to "VME"
124  {
125  address = strtoul(type.c_str(), 0, 16); // convert string to integer using base 16
126  type = "VME";
127  }
128 
129  if (!in.eof() ){
130  //std::cout << TKFECID <<" "<< crate << " "
131  // << std::hex << vme_base_address<<std::dec<<std::endl;
132 
134 
135  tmp.setTKFECParameters(TKFECID , crate , type, address);
136 
137  TKFECconfig_.push_back(tmp);
138  }
139 
140  }
141  while (!in.eof());
142  in.close();
143 
144 }
type
Definition: HCALResponse.h:21
void setTKFECParameters(std::string TKFECID, unsigned int crate, std::string type, unsigned int address)
This class implements..
std::vector< PixelTKFECParameters > TKFECconfig_
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:121
PixelConfigBase(std::string description, std::string creator, std::string date)
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 19 of file PixelTKFECConfig.cc.

References EnergyCorrector::c, gen::n, alignCSCRings::r, pos::PixelTKFECParameters::setTKFECParameters(), AlCaHLTBitMon_QueryRunRegistry::string, TKFECconfig_, and tmp.

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

Definition at line 146 of file PixelTKFECConfig.cc.

146 {}

Member Function Documentation

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

Definition at line 248 of file PixelTKFECConfig.cc.

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

248  {
249 
250  for(unsigned int i=0;i<TKFECconfig_.size();i++){
251  if (TKFECconfig_[i].getTKFECID()==TKFECID) return TKFECconfig_[i].getAddress();
252  }
253 
254  std::cout << "Could not find TKFEC ID:"<<TKFECID<<std::endl;
255 
256  assert(0);
257 
258  return 0;
259 
260 }
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
std::string getTKFECID(unsigned int i) const
std::vector< PixelTKFECParameters > TKFECconfig_
tuple cout
Definition: gather_cfg.py:121
unsigned int getAddress(unsigned int i) const
unsigned int PixelTKFECConfig::crateFromTKFECID ( std::string  TKFECID) const

Definition at line 220 of file PixelTKFECConfig.cc.

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

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

220  {
221 
222  for(unsigned int i=0;i<TKFECconfig_.size();i++){
223  if (TKFECconfig_[i].getTKFECID()==TKFECID) return TKFECconfig_[i].getCrate();
224  }
225 
226  std::cout << "Could not find TKFEC ID:"<<TKFECID<<std::endl;
227 
228  assert(0);
229 
230  return 0;
231 
232 }
int i
Definition: DBlmapReader.cc:9
unsigned int getCrate(unsigned int i) const
assert(m_qm.get())
std::string getTKFECID(unsigned int i) const
std::vector< PixelTKFECParameters > TKFECconfig_
tuple cout
Definition: gather_cfg.py:121
unsigned int PixelTKFECConfig::getAddress ( unsigned int  i) const

Definition at line 212 of file PixelTKFECConfig.cc.

References assert(), i, and TKFECconfig_.

Referenced by addressFromTKFECID().

212  {
213 
214  assert(i<TKFECconfig_.size());
215  return TKFECconfig_[i].getAddress();
216 
217 }
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
std::vector< PixelTKFECParameters > TKFECconfig_
unsigned int PixelTKFECConfig::getCrate ( unsigned int  i) const

Definition at line 198 of file PixelTKFECConfig.cc.

References assert(), i, and TKFECconfig_.

Referenced by crateFromTKFECID().

198  {
199 
200  assert(i<TKFECconfig_.size());
201  return TKFECconfig_[i].getCrate();
202 
203 }
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
std::vector< PixelTKFECParameters > TKFECconfig_
unsigned int PixelTKFECConfig::getNTKFECBoards ( ) const

Definition at line 184 of file PixelTKFECConfig.cc.

References TKFECconfig_.

184  {
185 
186  return TKFECconfig_.size();
187 
188 }
std::vector< PixelTKFECParameters > TKFECconfig_
std::string PixelTKFECConfig::getTKFECID ( unsigned int  i) const

Definition at line 190 of file PixelTKFECConfig.cc.

References assert(), i, and TKFECconfig_.

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

190  {
191 
192  assert(i<TKFECconfig_.size());
193  return TKFECconfig_[i].getTKFECID();
194 
195 }
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
std::vector< PixelTKFECParameters > TKFECconfig_
std::string PixelTKFECConfig::getType ( unsigned int  i) const
std::string PixelTKFECConfig::typeFromTKFECID ( std::string  TKFECID) const

Definition at line 234 of file PixelTKFECConfig.cc.

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

234  {
235 
236  for(unsigned int i=0;i<TKFECconfig_.size();i++){
237  if (TKFECconfig_[i].getTKFECID()==TKFECID) return TKFECconfig_[i].getType();
238  }
239 
240  std::cout << "Could not find TKFEC ID:"<<TKFECID<<std::endl;
241 
242  assert(0);
243 
244  return 0;
245 
246 }
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
std::string getTKFECID(unsigned int i) const
std::vector< PixelTKFECParameters > TKFECconfig_
std::string getType(unsigned int i) const
tuple cout
Definition: gather_cfg.py:121
void PixelTKFECConfig::writeASCII ( std::string  dir) const
virtual

Implements pos::PixelConfigBase.

Definition at line 148 of file PixelTKFECConfig.cc.

References assert(), gather_cfg::cout, TauDecayModes::dec, lut2db_cfg::filename, getType(), i, dbtoconf::out, and TKFECconfig_.

148  {
149 
150  if (dir!="") dir+="/";
151  string filename=dir+"tkfecconfig.dat";
152 
153  ofstream out(filename.c_str());
154  if(!out.good()){
155  cout << "Could not open file:"<<filename<<endl;
156  assert(0);
157  }
158 
159  out <<"#TKFEC ID crate VME/PCI slot/address" <<endl;
160  for(unsigned int i=0;i<TKFECconfig_.size();i++){
161  out << TKFECconfig_[i].getTKFECID()<<" "
162  << TKFECconfig_[i].getCrate()<<" ";
163  if (TKFECconfig_[i].getType()=="PCI") {
164  out << "PCI ";
165  } else {
166  out << " ";
167  }
168  out << "0x"<<hex<<TKFECconfig_[i].getAddress()<<dec<<endl;
169  }
170  out.close();
171 }
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
tuple out
Definition: dbtoconf.py:99
std::vector< PixelTKFECParameters > TKFECconfig_
std::string getType(unsigned int i) const
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:121
dbl *** dir
Definition: mlp_gen.cc:35
virtual void pos::PixelTKFECConfig::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const
inlinevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 48 of file PixelTKFECConfig.h.

48 {;}
void PixelTKFECConfig::writeXML ( std::ofstream *  out,
std::ofstream *  out1 = NULL,
std::ofstream *  out2 = NULL 
) const
virtual

Reimplemented from pos::PixelConfigBase.

Definition at line 308 of file PixelTKFECConfig.cc.

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

311 {
312  std::string mthn = "[PixelTKFECConfig::writeXML()]\t\t\t " ;
313 
314  for(unsigned int i=0;i<TKFECconfig_.size();i++){
315  *outstream << " <DATA>" << std::endl ;
316  *outstream << " <TRKFEC_NAME>" << TKFECconfig_[i].getTKFECID() << "</TRKFEC_NAME>" << std::endl ;
317  *outstream << " <CRATE_NUMBER>" << TKFECconfig_[i].getCrate() << "</CRATE_NUMBER>"<< std::endl ;
318  *outstream << " <VME_ADDR>" << "0x" << hex << TKFECconfig_[i].getAddress() << dec << "</VME_ADDR>" << std::endl ;
319  *outstream << " </DATA>" << std::endl ;
320  }
321 }
int i
Definition: DBlmapReader.cc:9
std::vector< PixelTKFECParameters > TKFECconfig_
void PixelTKFECConfig::writeXMLHeader ( pos::PixelConfigKey  key,
int  version,
std::string  path,
std::ofstream *  out,
std::ofstream *  out1 = NULL,
std::ofstream *  out2 = NULL 
) const
virtual

Reimplemented from pos::PixelConfigBase.

Definition at line 263 of file PixelTKFECConfig.cc.

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

269 {
270  std::string mthn = "[PixelTKFECConfig::writeXMLHeader()]\t\t\t " ;
271  std::stringstream maskFullPath ;
272 
273  maskFullPath << path << "/Pixel_TrackerFecParameters_" << PixelTimeFormatter::getmSecTime() << ".xml";
274  std::cout << mthn << "Writing to: " << maskFullPath.str() << std::endl ;
275 
276  outstream->open(maskFullPath.str().c_str()) ;
277 
278  *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
279  *outstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ;
280  *outstream << "" << std::endl ;
281  *outstream << " <HEADER>" << std::endl ;
282  *outstream << " <TYPE>" << std::endl ;
283  *outstream << " <EXTENSION_TABLE_NAME>TRACKER_FEC_PARAMETERS</EXTENSION_TABLE_NAME>" << std::endl ;
284  *outstream << " <NAME>Tracker FEC Parameters</NAME>" << std::endl ;
285  *outstream << " </TYPE>" << std::endl ;
286  *outstream << " <RUN>" << std::endl ;
287  *outstream << " <RUN_TYPE>Tracker FEC Parameters</RUN_TYPE>" << std::endl ;
288  *outstream << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
289  *outstream << " <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl ;
290  *outstream << " <LOCATION>CERN P5</LOCATION>" << std::endl ;
291  *outstream << " </RUN>" << std::endl ;
292  *outstream << " </HEADER>" << std::endl ;
293  *outstream << "" << std::endl ;
294  *outstream << " <DATA_SET>" << std::endl ;
295  *outstream << "" << std::endl ;
296  *outstream << " <VERSION>" << version << "</VERSION>" << std::endl ;
297  *outstream << " <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>" << std::endl ;
298  *outstream << " <CREATED_BY_USER>" << getAuthor() << "</CREATED_BY_USER>" << std::endl ;
299  *outstream << "" << std::endl ;
300  *outstream << " <PART>" << std::endl ;
301  *outstream << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
302  *outstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
303  *outstream << " </PART>" << std::endl ;
304 
305 }
static std::string getmSecTime(void)
tuple path
else: Piece not in the list, fine.
static std::string getTime(void)
std::string getComment() const
std::string getAuthor() const
tuple cout
Definition: gather_cfg.py:121
void PixelTKFECConfig::writeXMLTrailer ( std::ofstream *  out,
std::ofstream *  out1 = NULL,
std::ofstream *  out2 = NULL 
) const
virtual

Reimplemented from pos::PixelConfigBase.

Definition at line 324 of file PixelTKFECConfig.cc.

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

327 {
328  std::string mthn = "[PixelTKFECConfig::writeXMLTrailer()]\t\t\t " ;
329 
330  *outstream << " </DATA_SET>" << std::endl ;
331  *outstream << "</ROOT>" << std::endl ;
332 
333  outstream->close() ;
334  std::cout << mthn << "Data written " << std::endl ;
335 
336 }
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

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