CMS 3D CMS Logo

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