22 std::string mthn =
"[PixelMaxVsf::PixelMaxVsf()]\t\t\t\t ";
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(
"ROC_NAME");
44 colNames.push_back(
"MAXVSF");
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;
54 for (
unsigned int n = 0;
n < colNames.size();
n++) {
55 if (colM.find(colNames[
n]) == colM.end()) {
56 std::cerr << __LINE__ <<
"]\t" << mthn <<
"Couldn't find in the database the column with name " << colNames[
n]
64 for (
unsigned int r = 1;
r < tableMat.size();
r++)
68 vsf = atoi(tableMat[
r][colM[
"MAXVSF"]].c_str());
76 std::string mthn =
"[PixelMaxVsf::PixelMaxVsf()]\t\t\t\t ";
82 std::cout << __LINE__ <<
"]\t" << mthn <<
"Could not open: " <<
filename << std::endl;
83 throw std::runtime_error(
"Failed to open file " +
filename);
89 std::cout << __LINE__ <<
"]\t" << mthn <<
"eof before reading anything!" << std::endl;
90 throw std::runtime_error(
"File appears to be empty: " +
filename);
113 std::map<PixelROCName, unsigned int>::const_iterator itr =
rocs_.find(
roc);
115 if (itr ==
rocs_.end()) {
127 std::string mthn =
"[PixelMaxVsf::writeASCII()]\t\t\t\t ";
134 std::cout << __LINE__ <<
"]\t" << mthn <<
"Could not open file " <<
filename <<
" for write" << std::endl;
138 std::map<PixelROCName, unsigned int>::const_iterator irocs =
rocs_.begin();
139 for (; irocs !=
rocs_.end(); ++irocs) {
140 out << (irocs->first).rocname() <<
" " << irocs->second << endl;
150 std::ofstream *outstream,
151 std::ofstream *out1stream,
152 std::ofstream *out2stream)
const {
153 std::string mthn =
"[PixelMaxVsf::writeXMLHeader()]\t\t\t ";
154 std::stringstream maskFullPath;
157 std::cout << __LINE__ <<
"]\t" << mthn <<
"Writing to: " << maskFullPath.str() << std::endl;
159 outstream->open(maskFullPath.str().c_str());
161 *outstream <<
"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl;
162 *outstream <<
"<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl;
163 *outstream <<
"" << std::endl;
164 *outstream <<
" <HEADER>" << std::endl;
165 *outstream <<
" <TYPE>" << std::endl;
166 *outstream <<
" <EXTENSION_TABLE_NAME>ROC_MAXVSF</EXTENSION_TABLE_NAME>" << std::endl;
167 *outstream <<
" <NAME>ROC MaxVsf Setting</NAME>" << std::endl;
168 *outstream <<
" </TYPE>" << std::endl;
169 *outstream <<
" <RUN>" << std::endl;
170 *outstream <<
" <RUN_TYPE>ROC MaxVsf Settings</RUN_TYPE>" << std::endl;
171 *outstream <<
" <RUN_NUMBER>1</RUN_NUMBER>" << std::endl;
173 *outstream <<
" <LOCATION>CERN P5</LOCATION>" << std::endl;
174 *outstream <<
" </RUN>" << std::endl;
175 *outstream <<
" </HEADER>" << std::endl;
176 *outstream <<
"" << std::endl;
177 *outstream <<
" <DATA_SET>" << std::endl;
178 *outstream <<
"" << std::endl;
179 *outstream <<
" <VERSION>" <<
version <<
"</VERSION>" << std::endl;
180 *outstream <<
" <COMMENT_DESCRIPTION>" <<
getComment() <<
"</COMMENT_DESCRIPTION>" << std::endl;
181 *outstream <<
" <CREATED_BY_USER>" <<
getAuthor() <<
"</CREATED_BY_USER>" << std::endl;
182 *outstream <<
"" << std::endl;
183 *outstream <<
" <PART>" << std::endl;
184 *outstream <<
" <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl;
185 *outstream <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl;
186 *outstream <<
" </PART>" << std::endl;
191 std::string mthn =
"[PixelMaxVsf::writeXML()]\t\t\t ";
193 std::map<PixelROCName, unsigned int>::const_iterator irocs =
rocs_.begin();
194 for (; irocs !=
rocs_.end(); ++irocs) {
195 *outstream <<
" <DATA>" << std::endl;
196 *outstream <<
" <ROC_NAME>" << (irocs->first).rocname() <<
"</ROC_NAME>" << std::endl;
197 *outstream <<
" <MAXVSF>" << irocs->second <<
"</MAXVSF>" << std::endl;
198 *outstream <<
" </DATA>" << std::endl;
199 *outstream << std::endl;
205 std::ofstream *out1stream,
206 std::ofstream *out2stream)
const {
207 std::string mthn =
"[PixelMaxVsf::writeXMLTrailer()]\t\t\t ";
209 *outstream <<
" </DATA_SET>" << std::endl;
210 *outstream <<
"</ROOT>" << std::endl;
213 std::cout << __LINE__ <<
"]\t" << mthn <<
"Data written " << std::endl;