20 std::string mthn =
"[PixelFEDConfig::PixelFEDConfig()]\t\t\t " ;
22 std::vector< std::string >
ins = tableMat[0];
23 std::map<std::string , int > colM;
24 std::vector<std::string > colNames;
38 colNames.push_back(
"CONFIG_KEY" );
39 colNames.push_back(
"KEY_TYPE" );
40 colNames.push_back(
"KEY_ALIAS" );
41 colNames.push_back(
"VERSION" );
42 colNames.push_back(
"KIND_OF_COND" );
43 colNames.push_back(
"PIXEL_FED" );
44 colNames.push_back(
"CRATE_NUMBER" );
45 colNames.push_back(
"VME_ADDR" );
51 for(
unsigned int c = 0 ;
c < tableMat[0].size() ;
c++)
53 for(
unsigned int n=0;
n<colNames.size();
n++)
55 if(tableMat[0][
c] == colNames[
n])
57 colM[colNames[
n]] =
c;
74 unsigned int fednum = 0;
77 for(
unsigned int r = 1 ;
r < tableMat.size() ;
r++){
79 fedname = tableMat[
r][colM[
"PIXEL_FED"]];
84 fednum = (
unsigned int)atoi(fedname.c_str()) ;
89 unsigned int vme_base_address = 0 ;
90 vme_base_address = strtoul(tableMat[
r][colM[
"VME_ADDR"]].c_str(), 0, 16);
93 tmp.
setFEDParameters( fednum, (
unsigned int)atoi(tableMat[
r][colM[
"CRATE_NUMBER"]].c_str()) ,
99 for(
unsigned int y = 0; y <
fedconfig_.size() ; y++)
112 tmp.
setFEDParameters( fednum, (
unsigned int)atoi(tableMat[
r][colM[
"CRATE_NUMBER"]].c_str()) ,
113 (
unsigned int)strtoul(tableMat[
r][colM[
"VME_ADDR"]].c_str(), 0, 16));
140 std::string mthn =
"[PixelFEDConfig::PixelFEDConfig()]\t\t\t " ;
141 std::ifstream
in(filename.c_str());
144 std::cout << __LINE__ <<
"]\t" << mthn <<
"Could not open: " << filename.c_str() << std::endl;
145 throw std::runtime_error(
"Failed to open file "+filename);
148 std::cout << __LINE__ <<
"]\t" << mthn <<
"Opened: " << filename.c_str() << std::endl;
162 unsigned int fednumber;
164 unsigned int vme_base_address;
166 in >> fednumber >> crate >> std::hex >> vme_base_address >>
std::dec;
197 std::string mthn =
"[PixelFEDConfig::writeASCII()]\t\t\t\t " ;
198 if (dir!=
"") dir+=
"/";
199 string filename=dir+
"fedconfig.dat";
201 ofstream
out(filename.c_str());
203 cout << __LINE__ <<
"]\t" << mthn <<
"Could not open file: " << filename << endl;
207 out <<
" #FED number crate vme base address" <<endl;
250 std::string mthn =
"[PixelFEDConfig::crateFromFEDNumber()]\t\t\t " ;
255 std::cout << __LINE__ <<
"]\t" << mthn <<
"Could not find FED number: " << fednumber << std::endl;
266 std::string mthn =
"[PixelFEDConfig::VMEBaseAddressFromFEDNumber()]\t\t " ;
271 std::cout << __LINE__ <<
"]\t" << mthn <<
"Could not find FED number: " << fednumber << std::endl;
281 std::string mthn =
"[PixelFEDConfig::FEDNumberFromCrateAndVMEBaseAddress()]\t " ;
287 std::cout << __LINE__ <<
"]\t" << mthn <<
"Could not find FED crate and address: "<< crate <<
", " << vmebaseaddress << std::endl;
299 std::ofstream *outstream,
300 std::ofstream *out1stream,
301 std::ofstream *out2stream)
const
303 std::string mthn =
"[PixelFEDConfig::::writeXMLHeader()]\t\t\t " ;
306 cout << __LINE__ <<
"]\t" << mthn <<
"Writing to: " << fullPath.str() << endl ;
308 outstream->open(fullPath.str().c_str()) ;
309 *outstream <<
"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << endl ;
310 *outstream <<
"<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << endl ;
311 *outstream <<
" <HEADER>" << endl ;
312 *outstream <<
" <TYPE>" << endl ;
313 *outstream <<
" <EXTENSION_TABLE_NAME>FED_CRATE_CONFIG</EXTENSION_TABLE_NAME>" << endl ;
314 *outstream <<
" <NAME>Pixel FED Crate Configuration</NAME>" << endl ;
315 *outstream <<
" </TYPE>" << endl ;
316 *outstream <<
" <RUN>" << endl ;
317 *outstream <<
" <RUN_NAME>Pixel FED Crate Configuration</RUN_NAME>" << endl ;
319 *outstream <<
" <LOCATION>CERN P5</LOCATION>" << endl ;
320 *outstream <<
" </RUN>" << endl ;
321 *outstream <<
" </HEADER>" << endl ;
322 *outstream <<
" " << endl ;
323 *outstream <<
" <DATA_SET>" << endl ;
324 *outstream <<
" <PART>" << endl ;
325 *outstream <<
" <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << endl ;
326 *outstream <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << endl ;
327 *outstream <<
" </PART>" << endl ;
328 *outstream <<
" <VERSION>" << version <<
"</VERSION>" << endl ;
329 *outstream <<
" <COMMENT_DESCRIPTION>" <<
getComment() <<
"</COMMENT_DESCRIPTION>" << endl ;
330 *outstream <<
" <CREATED_BY_USER>" <<
getAuthor() <<
"</CREATED_BY_USER>" << endl ;
331 *outstream <<
" " << endl ;
336 std::ofstream *out1stream,
337 std::ofstream *out2stream)
const
339 std::string mthn =
"[PixelFEDConfig::writeXML()]\t\t\t " ;
342 *outstream <<
" <DATA>" << endl ;
343 *outstream <<
" <PIXEL_FED>" <<
fedconfig_[
i].getFEDNumber() <<
"</PIXEL_FED>" << endl ;
344 *outstream <<
" <CRATE_NUMBER>" <<
fedconfig_[
i].getCrate() <<
"</CRATE_NUMBER>" << endl ;
345 *outstream <<
" <VME_ADDR>" <<
"0x" << hex <<
fedconfig_[
i].getVMEBaseAddress() <<
dec <<
"</VME_ADDR>" << endl ;
346 *outstream <<
" </DATA>" << endl ;
347 *outstream <<
"" << endl ;
354 std::ofstream *out1stream,
355 std::ofstream *out2stream)
const
357 std::string mthn =
"[PixelFEDConfig::writeXMLTrailer()]\t\t\t " ;
359 *outstream <<
" </DATA_SET>" << endl ;
360 *outstream <<
"</ROOT> " << endl ;
void setFEDParameters(unsigned int fednumber, unsigned int crate, unsigned int vmebaseaddress)
unsigned int FEDNumberFromCrateAndVMEBaseAddress(unsigned int crate, unsigned int vmebaseaddress) const
This file contains the base class for "pixel configuration data" management.
unsigned int crateFromFEDNumber(unsigned int fednumber) const
unsigned int VMEBaseAddressFromFEDNumber(unsigned int fednumber) const
std::vector< PixelFEDParameters > fedconfig_
void writeXML(pos::PixelConfigKey key, int version, std::string path) const
unsigned int getFEDNumber(unsigned int i) const
unsigned int getCrate(unsigned int i) const
tuple path
else: Piece not in the list, fine.
std::string getComment() const
virtual void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
unsigned int getVMEBaseAddress(unsigned int i) const
std::string getAuthor() const
unsigned int getNFEDBoards() const
virtual void writeASCII(std::string dir) const
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
virtual ~PixelFEDConfig()
virtual void writeXMLTrailer(std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
std::vector< std::vector< double > > tmp
PixelFEDConfig(std::string filename)