test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiPixelConfigParser.cc
Go to the documentation of this file.
5 #include <iostream>
6 
7 using namespace xercesc;
8 using namespace std;
9 
10 //
11 // -- Constructor
12 //
14  edm::LogInfo("SiPixelConfigParser") <<
15  " Creating SiPixelConfigParser " << "\n" ;
16 }
17 //
18 // -- Destructor
19 //
21  edm::LogInfo("SiPixelActionExecutor") <<
22  " Deleting SiPixelConfigParser " << "\n" ;
23 }
24 //
25 // -- Read ME list for the TrackerMap
26 //
28  vector<string>& me_names){
29  if (!doc()) {
30  cout << " SiPixelConfigParser::Configuration File is not set!!! " << endl;
31  return false;
32  }
33 
34  me_names.clear();
35  unsigned int tkMapNodes = doc()->getElementsByTagName(qtxml::_toDOMS("TkMap"))->getLength();
36  if (tkMapNodes != 1)
37  {
38  cout << ACYellow << ACBold
39  << "[SiPixelConfigParser::getMENamesForTrackerMap()]"
40  << ACRed << ACBold
41  << "No TkMap tag found in configuration file"
42  << ACPlain << endl ;
43  return false;
44  }
46  DOMNode* tkMapNode = doc()->getElementsByTagName(qtxml::_toDOMS("TkMap"))->item(0);
47  //Get QTEST name
48  if (! tkMapNode)
49  {
50  cout << ACYellow << ACBold
51  << "[SiPixelConfigParser::getMENamesForTrackerMap()]"
52  << ACRed << ACBold
53  << " No TkMap tag elements found in configuration file"
54  << ACPlain << endl ;
55  return false;
56  }
57  DOMElement* tkMapElement = static_cast<DOMElement *>(tkMapNode);
58  if (! tkMapElement)
59  {
60  cout << ACYellow << ACBold
61  << "[SiPixelConfigParser::getMENamesForTrackerMap()]"
62  << ACRed << ACBold
63  << " No TkMap tag dom elements found in configuration file"
64  << ACPlain << endl ;
65  return false;
66  }
67  tkmap_name = qtxml::_toString(tkMapElement->getAttribute(qtxml::_toDOMS("name")));
68 
69  DOMNodeList * meList
70  = tkMapElement->getElementsByTagName(qtxml::_toDOMS("MonElement"));
71  if( meList->getLength() == 0 )
72  {
73  cout << ACYellow << ACBold
74  << "[SiPixelConfigParser::getMENamesForTrackerMap()]"
75  << ACRed << ACBold
76  << " No MonElement found in configuration file"
77  << ACPlain << endl ;
78  }
79  for (unsigned int k = 0; k < meList->getLength(); k++) {
80  DOMNode* meNode = meList->item(k);
81  if (!meNode)
82  {
83  cout << ACYellow << ACBold
84  << "[SiPixelConfigParser::getMENamesForTrackerMap()]"
85  << ACRed << ACBold
86  << " No MonElement item found in configuration file"
87  << ACPlain << endl ;
88  return false;
89  }
90  DOMElement* meElement = static_cast<DOMElement *>(meNode);
91  if (!meElement)
92  {
93  cout << ACYellow << ACBold
94  << "[SiPixelConfigParser::getMENamesForTrackerMap()]"
95  << ACRed << ACBold
96  << " No MonElement sub-elements found in configuration file"
97  << ACPlain << endl ;
98  return false;
99  }
100  string me_name = qtxml::_toString(meElement->getAttribute (qtxml::_toDOMS ("name")));
101  me_names.push_back(me_name);
102  }
103  if (me_names.size() == 0)
104  {
105  cout << ACYellow << ACBold
106  << "[SiPixelConfigParser::getMENamesForTrackerMap()]"
107  << ACRed << ACBold
108  << " No MonElement sub-element names found in configuration file"
109  << ACPlain << endl ;
110  return false;
111  } else {
112  return true;
113  }
114 }
115 //
116 // -- Read Update Frequency for the TrackerMap
117 //
119  if (!doc()) {
120  cout << " SiPixelConfigParser::Configuration File is not set!!! " << endl;
121  return false;
122  }
123 
124  unsigned int tkMapNodes = doc()->getElementsByTagName(qtxml::_toDOMS("TkMap"))->getLength();
125  if (tkMapNodes != 1) return false;
127  DOMNode* tkMapNode = doc()->getElementsByTagName(qtxml::_toDOMS("TkMap"))->item(0);
128  //Get Node name
129  if (! tkMapNode) return false;
130  DOMElement* tkMapElement = static_cast<DOMElement *>(tkMapNode);
131  if (! tkMapElement) return false;
132 
133  u_freq = atoi(qtxml::_toString(tkMapElement->getAttribute(qtxml::_toDOMS("update_frequency"))).c_str());
134  return true;
135 }
136 //
137 // -- Get List of MEs for the module tree plots:
138 //
139 bool SiPixelConfigParser::getMENamesForTree(string& structure_name,
140  vector<string>& me_names) {
141  //cout<<"Entering SiPixelConfigParser::getMENamesForTree..."<<endl;
142  if (!doc()) {
143  cout << " SiPixelConfigParser::Configuration File is not set!!! " << endl;
144  return false;
145  }
146 
147  me_names.clear();
148  unsigned int structureNodes = doc()->getElementsByTagName(qtxml::_toDOMS("SubStructureLevel"))->getLength();
149  if (structureNodes == 0) return false;
151  DOMNode* structureNode = doc()->getElementsByTagName(qtxml::_toDOMS("SubStructureLevel"))->item(0);
152  //Get QTEST name
153  if (! structureNode) return false;
154  DOMElement* structureElement = static_cast<DOMElement *>(structureNode);
155  if (! structureElement) return false;
156 
157  structure_name = qtxml::_toString(structureElement->getAttribute(qtxml::_toDOMS("name")));
158 
159  DOMNodeList * meList = structureElement->getElementsByTagName(qtxml::_toDOMS("MonElement"));
160  for (unsigned int k = 0; k < meList->getLength(); k++) {
161  DOMNode* meNode = meList->item(k);
162  if (!meNode) return false;
163  DOMElement* meElement = static_cast<DOMElement *>(meNode);
164  if (!meElement) return false;
165  string me_name = qtxml::_toString(meElement->getAttribute (qtxml::_toDOMS ("name")));
166  me_names.push_back(me_name);
167  }
168  if (me_names.size() == 0) return false;
169  else return true;
170  //cout<<"...leaving SiPixelConfigParser::getMENamesForTree!"<<endl;
171 
172 }
173 //
174 // -- Get List of MEs for the summary plot and the
175 //
177  vector<string>& me_names) {
178 // cout<<"Entering SiPixelConfigParser::getMENamesForBarrelSummary..."<<endl;
179  if (!doc()) {
180  cout << " SiPixelConfigParser::Configuration File is not set!!! " << endl;
181  return false;
182  }
183  me_names.clear();
184  unsigned int structureNodes = doc()->getElementsByTagName(qtxml::_toDOMS("SubStructureBarrelLevel"))->getLength();
185  if (structureNodes == 0) return false;
187  DOMNode* structureNode = doc()->getElementsByTagName(qtxml::_toDOMS("SubStructureBarrelLevel"))->item(0);
188  //Get QTEST name
189  if (! structureNode) return false;
190  DOMElement* structureElement = static_cast<DOMElement *>(structureNode);
191  if (! structureElement) return false;
192  structure_name = qtxml::_toString(structureElement->getAttribute(qtxml::_toDOMS("name")));
193 
194  DOMNodeList * meList = structureElement->getElementsByTagName(qtxml::_toDOMS("MonElement"));
195  for (unsigned int k = 0; k < meList->getLength(); k++) {
196  DOMNode* meNode = meList->item(k);
197  if (!meNode) return false;
198  DOMElement* meElement = static_cast<DOMElement *>(meNode);
199  if (!meElement) return false;
200  string me_name = qtxml::_toString(meElement->getAttribute (qtxml::_toDOMS ("name")));
201  me_names.push_back(me_name);
202  }
203 // cout<<"...leaving SiPixelConfigParser::getMENamesForBarrelSummary!"<<endl;
204  if (me_names.size() == 0) return false;
205  else return true;
206 
207 }
209  vector<string>& me_names) {
210 // cout<<"Entering SiPixelConfigParser::getMENamesForEndcapSummary..."<<endl;
211  if (!doc()) {
212  cout << " SiPixelConfigParser::Configuration File is not set!!! " << endl;
213  return false;
214  }
215 
216  me_names.clear();
217  unsigned int structureNodes = doc()->getElementsByTagName(qtxml::_toDOMS("SubStructureEndcapLevel"))->getLength();
218  if (structureNodes == 0) return false;
220  DOMNode* structureNode = doc()->getElementsByTagName(qtxml::_toDOMS("SubStructureEndcapLevel"))->item(0);
221  //Get QTEST name
222  if (! structureNode) return false;
223  DOMElement* structureElement = static_cast<DOMElement *>(structureNode);
224  if (! structureElement) return false;
225 
226  structure_name = qtxml::_toString(structureElement->getAttribute(qtxml::_toDOMS("name")));
227 
228  DOMNodeList * meList = structureElement->getElementsByTagName(qtxml::_toDOMS("MonElement"));
229  for (unsigned int k = 0; k < meList->getLength(); k++) {
230  DOMNode* meNode = meList->item(k);
231  if (!meNode) return false;
232  DOMElement* meElement = static_cast<DOMElement *>(meNode);
233  if (!meElement) return false;
234  string me_name = qtxml::_toString(meElement->getAttribute (qtxml::_toDOMS ("name")));
235  me_names.push_back(me_name);
236  }
237  if (me_names.size() == 0) return false;
238  else return true;
239 // cout<<"...leaving SiPixelConfigParser::getMENamesForEndcapSummary!"<<endl;
240 
241 }
242 
243 
245  vector<string>& me_names) {
246  //cout<<"Entering SiPixelConfigParser::getMENamesForFEDErrorSummary..."<<endl;
247  if (!doc()) {
248  cout << " SiPixelConfigParser::Configuration File is not set!!! " << endl;
249  return false;
250  }
251 
252  me_names.clear();
253  unsigned int structureNodes = doc()->getElementsByTagName(qtxml::_toDOMS("SubStructureNonDetId"))->getLength();
254  if (structureNodes == 0) return false;
256  DOMNode* structureNode = doc()->getElementsByTagName(qtxml::_toDOMS("SubStructureNonDetId"))->item(0);
257  //Get QTEST name
258  if (! structureNode) return false;
259  DOMElement* structureElement = static_cast<DOMElement *>(structureNode);
260  if (! structureElement) return false;
261 
262  structure_name = qtxml::_toString(structureElement->getAttribute(qtxml::_toDOMS("name")));
263 
264  DOMNodeList * meList = structureElement->getElementsByTagName(qtxml::_toDOMS("MonElement"));
265  for (unsigned int k = 0; k < meList->getLength(); k++) {
266  DOMNode* meNode = meList->item(k);
267  if (!meNode) return false;
268  DOMElement* meElement = static_cast<DOMElement *>(meNode);
269  if (!meElement) return false;
270  string me_name = qtxml::_toString(meElement->getAttribute (qtxml::_toDOMS ("name")));
271  me_names.push_back(me_name);
272  }
273  if (me_names.size() == 0) return false;
274  else return true;
275  //cout<<"...leaving SiPixelConfigParser::getMENamesForFEDErrorSummary!"<<endl;
276 
277 }
279 // -- Get List of MEs for the summary plot and the
280 //
282  if (!doc()) {
283  cout << " SiPixelConfigParser::Configuration File is not set!!! " << endl;
284  return false;
285  }
286 
287  unsigned int structureNodes = doc()->getElementsByTagName(qtxml::_toDOMS("SubStructureBarrelLevel"))->getLength();
288  if (structureNodes == 0) return false;
290  DOMNode* structureNode = doc()->getElementsByTagName(qtxml::_toDOMS("SubStructureBarrelLevel"))->item(0);
291  //Get Node name
292  if (! structureNode) return false;
293  DOMElement* structureElement = static_cast<DOMElement *>(structureNode);
294  if (! structureElement) return false;
295 
296  u_freq = atoi(qtxml::_toString(structureElement->getAttribute(qtxml::_toDOMS("update_frequency"))).c_str());
297  return true;
298 }
299 
300 
302  if (!doc()) {
303  cout << " SiPixelConfigParser::Configuration File is not set!!! " << endl;
304  return false;
305  }
306 
307  unsigned int structureNodes = doc()->getElementsByTagName(qtxml::_toDOMS("SubStructureEndcapLevel"))->getLength();
308  if (structureNodes == 0) return false;
310  DOMNode* structureNode = doc()->getElementsByTagName(qtxml::_toDOMS("SubStructureEndcapLevel"))->item(0);
311  //Get Node name
312  if (! structureNode) return false;
313  DOMElement* structureElement = static_cast<DOMElement *>(structureNode);
314  if (! structureElement) return false;
315 
316  u_freq = atoi(qtxml::_toString(structureElement->getAttribute(qtxml::_toDOMS("update_frequency"))).c_str());
317  return true;
318 }
319 
320 
322  vector<string>& me_names) {
323  //cout<<"Entering SiPixelConfigParser::getMENamesForGrandBarrelSummary..."<<endl;
324  if (!doc()) {
325  cout << " SiPixelConfigParser::Configuration File is not set!!! " << endl;
326  return false;
327  }
328 
329  me_names.clear();
330  unsigned int structureNodes = doc()->getElementsByTagName(qtxml::_toDOMS("SubStructureGrandBarrelLevel"))->getLength();
331  if (structureNodes == 0) return false;
333  DOMNode* structureNode = doc()->getElementsByTagName(qtxml::_toDOMS("SubStructureGrandBarrelLevel"))->item(0);
334  //Get QTEST name
335  if (! structureNode) return false;
336  DOMElement* structureElement = static_cast<DOMElement *>(structureNode);
337  if (! structureElement) return false;
338 
339  structure_name = qtxml::_toString(structureElement->getAttribute(qtxml::_toDOMS("name")));
340 
341  DOMNodeList * meList = structureElement->getElementsByTagName(qtxml::_toDOMS("MonElement"));
342  for (unsigned int k = 0; k < meList->getLength(); k++) {
343  DOMNode* meNode = meList->item(k);
344  if (!meNode) return false;
345  DOMElement* meElement = static_cast<DOMElement *>(meNode);
346  if (!meElement) return false;
347  string me_name = qtxml::_toString(meElement->getAttribute (qtxml::_toDOMS ("name")));
348  me_names.push_back(me_name);
349  }
350  if (me_names.size() == 0) return false;
351  else return true;
352  //cout<<"...leaving SiPixelConfigParser::getMENamesForGrandBarrelSummary!"<<endl;
353 
354 }
355 
356 
358  vector<string>& me_names) {
359  //cout<<"Entering SiPixelConfigParser::getMENamesForGrandEndcapSummary..."<<endl;
360  if (!doc()) {
361  cout << " SiPixelConfigParser::Configuration File is not set!!! " << endl;
362  return false;
363  }
364 
365  me_names.clear();
366  unsigned int structureNodes = doc()->getElementsByTagName(qtxml::_toDOMS("SubStructureGrandEndcapLevel"))->getLength();
367  if (structureNodes == 0) return false;
369  DOMNode* structureNode = doc()->getElementsByTagName(qtxml::_toDOMS("SubStructureGrandEndcapLevel"))->item(0);
370  //Get QTEST name
371  if (! structureNode) return false;
372  DOMElement* structureElement = static_cast<DOMElement *>(structureNode);
373  if (! structureElement) return false;
374 
375  structure_name = qtxml::_toString(structureElement->getAttribute(qtxml::_toDOMS("name")));
376 
377  DOMNodeList * meList = structureElement->getElementsByTagName(qtxml::_toDOMS("MonElement"));
378  for (unsigned int k = 0; k < meList->getLength(); k++) {
379  DOMNode* meNode = meList->item(k);
380  if (!meNode) return false;
381  DOMElement* meElement = static_cast<DOMElement *>(meNode);
382  if (!meElement) return false;
383  string me_name = qtxml::_toString(meElement->getAttribute (qtxml::_toDOMS ("name")));
384  me_names.push_back(me_name);
385  }
386  if (me_names.size() == 0) return false;
387  else return true;
388  //cout<<"...leaving SiPixelConfigParser::getMENamesForGrandEndcapSummary!"<<endl;
389 
390 }
391 
392 
394  if (!doc()) {
395  cout << " SiPixelConfigParser::Configuration File is not set!!! " << endl;
396  return false;
397  }
398 
399  unsigned int structureNodes = doc()->getElementsByTagName(qtxml::_toDOMS("SubStructureGrandBarrelLevel"))->getLength();
400  if (structureNodes == 0) return false;
402  DOMNode* structureNode = doc()->getElementsByTagName(qtxml::_toDOMS("SubStructureGrandBarrelLevel"))->item(0);
403  //Get Node name
404  if (! structureNode) return false;
405  DOMElement* structureElement = static_cast<DOMElement *>(structureNode);
406  if (! structureElement) return false;
407 
408  u_freq = atoi(qtxml::_toString(structureElement->getAttribute(qtxml::_toDOMS("update_frequency"))).c_str());
409  return true;
410 }
411 
412 
414  if (!doc()) {
415  cout << " SiPixelConfigParser::Configuration File is not set!!! " << endl;
416  return false;
417  }
418 
419  unsigned int structureNodes = doc()->getElementsByTagName(qtxml::_toDOMS("SubStructureGrandEndcapLevel"))->getLength();
420  if (structureNodes == 0) return false;
422  DOMNode* structureNode = doc()->getElementsByTagName(qtxml::_toDOMS("SubStructureGrandEndcapLevel"))->item(0);
423  //Get Node name
424  if (! structureNode) return false;
425  DOMElement* structureElement = static_cast<DOMElement *>(structureNode);
426  if (! structureElement) return false;
427 
428  u_freq = atoi(qtxml::_toString(structureElement->getAttribute(qtxml::_toDOMS("update_frequency"))).c_str());
429  return true;
430 }
431 
432 
434  if (!doc()) {
435  cout << " SiPixelConfigParser::Configuration File is not set!!! " << endl;
436  return false;
437  }
438  unsigned int structureNodes = doc()->getElementsByTagName(qtxml::_toDOMS("QTestMessageLimit"))->getLength();
439  if (structureNodes == 0) return false;
441  DOMNode* structureNode = doc()->getElementsByTagName(qtxml::_toDOMS("QTestMessageLimit"))->item(0);
442  //Get Node name
443  if (! structureNode) return false;
444  DOMElement* structureElement = static_cast<DOMElement *>(structureNode);
445  if (! structureElement) return false;
446 
447  u_freq = atoi(qtxml::_toString(structureElement->getAttribute(qtxml::_toDOMS("value"))).c_str());
448  return true;
449 }
450 
451 
452 
454  if (!doc()) {
455  cout << " SiPixelConfigParser::Configuration File is not set!!! " << endl;
456  return false;
457  }
458  unsigned int structureNodes = doc()->getElementsByTagName(qtxml::_toDOMS("SourceType"))->getLength();
459  if (structureNodes == 0) return false;
461  DOMNode* structureNode = doc()->getElementsByTagName(qtxml::_toDOMS("SourceType"))->item(0);
462  //Get Node name
463  if (! structureNode) return false;
464  DOMElement* structureElement = static_cast<DOMElement *>(structureNode);
465  if (! structureElement) return false;
466 
467  u_freq = atoi(qtxml::_toString(structureElement->getAttribute(qtxml::_toDOMS("code"))).c_str());
468  return true;
469 }
470 
472  if (!doc()) {
473  cout << " SiPixelConfigParser::Configuration File is not set!!! " << endl;
474  return false;
475  }
476  unsigned int structureNodes = doc()->getElementsByTagName(qtxml::_toDOMS("CalibType"))->getLength();
477  if (structureNodes == 0) return false;
479  DOMNode* structureNode = doc()->getElementsByTagName(qtxml::_toDOMS("CalibType"))->item(0);
480  //Get Node name
481  if (! structureNode) return false;
482  DOMElement* structureElement = static_cast<DOMElement *>(structureNode);
483  if (! structureElement) return false;
484 
485  u_freq = atoi(qtxml::_toString(structureElement->getAttribute(qtxml::_toDOMS("value"))).c_str());
486  return true;
487 }
488 
489 
490 
491 
#define ACRed
Definition: ANSIColors.h:15
#define ACYellow
Definition: ANSIColors.h:25
bool getMENamesForTree(std::string &structure_name, std::vector< std::string > &me_names)
std::string _toString(const XMLCh *toTranscode)
bool getMENamesForEndcapSummary(std::string &structure_name, std::vector< std::string > &me_names)
bool getCalibType(int &u_freq)
bool getMENamesForGrandEndcapSummary(std::string &structure_name, std::vector< std::string > &me_names)
bool getFrequencyForGrandBarrelSummary(int &u_freq)
bool getFrequencyForEndcapSummary(int &u_freq)
bool getMENamesForFEDErrorSummary(std::string &structure_name, std::vector< std::string > &me_names)
bool getMENamesForGrandBarrelSummary(std::string &structure_name, std::vector< std::string > &me_names)
bool getFrequencyForBarrelSummary(int &u_freq)
bool getFrequencyForGrandEndcapSummary(int &u_freq)
bool getMENamesForTrackerMap(std::string &tkmap_name, std::vector< std::string > &me_names)
bool getMENamesForBarrelSummary(std::string &structure_name, std::vector< std::string > &me_names)
bool getMessageLimitForQTests(int &u_freq)
XMLCh * _toDOMS(std::string temp)
bool getSourceType(int &u_freq)
tuple cout
Definition: gather_cfg.py:145
xercesc::DOMDocument * doc()
DOM Document.
Definition: DQMParserBase.h:45
bool getFrequencyForTrackerMap(int &u_freq)
#define ACPlain
Definition: ANSIColors.h:28
#define ACBold
Definition: ANSIColors.h:29