22 PixelLowVoltageMap::PixelLowVoltageMap(std::vector< std::vector < std::string> > &tableMat):
PixelConfigBase(
"",
"",
"")
24 std::string mthn =
"[PixelLowVoltageMap::PixelLowVoltageMap()] " ;
25 std::map<std::string , int > colM;
26 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(
"PANEL_NAME" );
48 colNames.push_back(
"DATAPOINT" );
49 colNames.push_back(
"LV_DIGITAL" );
50 colNames.push_back(
"LV_ANALOG" );
64 for(
unsigned int c = 0 ;
c < tableMat[0].size() ;
c++)
66 for(
unsigned int n=0;
n<colNames.size();
n++)
68 if(tableMat[0][
c] == colNames[
n])
70 colM[colNames[
n]] =
c;
75 for(
unsigned int n=0;
n<colNames.size();
n++)
77 if(colM.find(colNames[
n]) == colM.end())
79 std::cerr << mthn <<
"Couldn't find in the database the column with name " << colNames[
n] << std::endl;
88 for(
unsigned int r = 1 ;
r < tableMat.size() ;
r++)
90 modulename = tableMat[
r][colM[
"PANEL_NAME"]] ;
91 dpNameBase = tableMat[
r][colM[
"DATAPOINT"]] ;
92 ianaChannel = tableMat[
r][colM[
"LV_ANALOG"]] ;
93 idigiChannel= tableMat[
r][colM[
"LV_DIGITAL"]] ;
95 pair<string, string> channels(ianaChannel,idigiChannel);
96 pair<string, pair<string,string> > dpName(dpNameBase,channels);
106 std::string mthn =
"[PixelLowVoltageMap::PixelLowVoltageMap()]\t\t\t " ;
108 if (filename[filename.size()-1]==
't'){
110 std::ifstream
in(filename.c_str());
113 std::cout << __LINE__ <<
"]\t" << mthn <<
"Could not open: " << filename << std::endl;
114 throw std::runtime_error(
"Failed to open file "+filename);
117 std::cout << __LINE__ <<
"]\t" << mthn <<
"Opened: " << filename << std::endl;
121 std::cout << __LINE__ <<
"]\t" << mthn <<
"eof before reading anything!" << std::endl;
122 throw std::runtime_error(
"Failure when reading file; file seems to be empty: "+filename);
133 in >> modulename >> dpNameBase >> ianaChannel >> idigiChannel;
136 cout << __LINE__ <<
"]\t" << mthn <<
"Read modulename: " << modulename << endl;
138 pair<string, string> channels(ianaChannel,idigiChannel);
139 pair<string, pair<string,string> > dpName(dpNameBase,channels);
141 in >> modulename >> dpNameBase >> ianaChannel >> idigiChannel;
152 std::string mthn =
"[PixelLowVoltageMap::dpNameIana()]\t\t\t " ;
153 std::map<PixelModuleName, pair< string, pair<string, string> > >::const_iterator
i=
157 cout << __LINE__ <<
"]\t" << mthn <<
"Could not find module: " << module << endl;
160 return i->second.first+
"/"+i->second.second.first;
166 std::string mthn =
"[PixelLowVoltageMap::dpNameIdigi()]\t\t\t " ;
167 std::map<PixelModuleName, pair< string, pair<string, string> > >::const_iterator
i=
171 cout << __LINE__ <<
"]\t" << mthn <<
"Could not find module: " << module << endl;
174 return i->second.first+
"/"+i->second.second.second;
181 std::string mthn =
"[PixelLowVoltageMap::writeASCII()]\t\t\t " ;
182 if (dir!=
"") dir+=
"/";
187 std::cout << __LINE__ <<
"]\t" << mthn <<
"Could not open file " << filename <<
" for write" << std::endl ;
190 std::map<PixelModuleName, pair< string, pair<string, string> > >::const_iterator imodule=
194 out << imodule->first
195 <<
" "<< imodule->second.first
196 <<
" "<< imodule->second.second.first
197 <<
" "<< imodule->second.second.second
209 std::ofstream *outstream,
210 std::ofstream *out1stream,
211 std::ofstream *out2stream)
const 213 std::string mthn =
"[PixelLowVoltageMap::writeXMLHeader()]\t\t\t " ;
214 std::stringstream maskFullPath ;
217 std::cout << __LINE__ <<
"]\t" << mthn <<
"Writing to: " << maskFullPath.str() << std::endl ;
219 outstream->open(maskFullPath.str().c_str()) ;
221 *outstream <<
"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
222 *outstream <<
"<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ;
223 *outstream <<
"" << std::endl ;
224 *outstream <<
" <HEADER>" << std::endl ;
225 *outstream <<
" <TYPE>" << std::endl ;
226 *outstream <<
" <EXTENSION_TABLE_NAME>XDAQ_LOW_VOLTAGE_MAP</EXTENSION_TABLE_NAME>" << std::endl ;
227 *outstream <<
" <NAME>XDAQ Low Voltage Map</NAME>" << std::endl ;
228 *outstream <<
" </TYPE>" << std::endl ;
229 *outstream <<
" <RUN>" << std::endl ;
230 *outstream <<
" <RUN_TYPE>XDAQ Low Voltage Map</RUN_TYPE>" << std::endl ;
231 *outstream <<
" <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
233 *outstream <<
" <LOCATION>CERN P5</LOCATION>" << std::endl ;
234 *outstream <<
" </RUN>" << std::endl ;
235 *outstream <<
" </HEADER>" << std::endl ;
236 *outstream <<
"" << std::endl ;
237 *outstream <<
" <DATA_SET>" << std::endl ;
238 *outstream <<
"" << std::endl ;
239 *outstream <<
" <VERSION>" << version <<
"</VERSION>" << std::endl ;
240 *outstream <<
" <COMMENT_DESCRIPTION>" <<
getComment() <<
"</COMMENT_DESCRIPTION>" << std::endl ;
241 *outstream <<
" <CREATED_BY_USER>" <<
getAuthor() <<
"</CREATED_BY_USER>" << std::endl ;
242 *outstream <<
"" << std::endl ;
243 *outstream <<
" <PART>" << std::endl ;
244 *outstream <<
" <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
245 *outstream <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
246 *outstream <<
" </PART>" << std::endl ;
247 *outstream <<
" " << std::endl ;
253 std::ofstream *out1stream,
254 std::ofstream *out2stream)
const 256 std::string mthn =
"[PixelLowVoltageMap::writeXML()]\t\t\t " ;
258 std::map<PixelModuleName, pair< string, pair<string, string> > >::const_iterator imodule=
dpNameMap_.begin();
261 *outstream <<
" <DATA>" << std::endl ;
262 *outstream <<
" <PANEL_NAME>" << imodule->first <<
"</PANEL_NAME>" << std::endl ;
263 *outstream <<
" <DATAPOINT>" << imodule->second.first <<
"</DATAPOINT>" << std::endl ;
264 *outstream <<
" <LV_DIGITAL>" << imodule->second.second.first <<
"</LV_DIGITAL>" << std::endl ;
265 *outstream <<
" <LV_ANALOG>" << imodule->second.second.second <<
"</LV_ANALOG>" << std::endl ;
266 *outstream <<
" </DATA>" << std::endl ;
267 *outstream <<
"" << std::endl ;
273 std::ofstream *out1stream,
274 std::ofstream *out2stream )
const 276 std::string mthn =
"[PixelLowVoltageMap::writeXMLTrailer()]\t\t\t " ;
278 *outstream <<
" </DATA_SET>" << std::endl ;
279 *outstream <<
"</ROOT>" << std::endl ;
282 std::cout << __LINE__ <<
"]\t" << mthn <<
"Data written " << std::endl ;
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
This file contains the base class for "pixel configuration data" management.
std::map< PixelModuleName, std::pair< std::string, std::pair< std::string, std::string > > > dpNameMap_
PixelLowVoltageMap(std::vector< std::vector< std::string > > &tableMat)
std::string getComment() const
std::string getAuthor() const
std::string dpNameIana(const PixelModuleName &module) const
void writeXML(pos::PixelConfigKey key, int version, std::string path) const override
std::string dpNameIdigi(const PixelModuleName &module) const
void writeASCII(std::string dir="") const override