CMS 3D CMS Logo

SiPixelConfigParser.cc
Go to the documentation of this file.
4 #include <iostream>
5 
6 using namespace std;
7 
8 //
9 // -- Constructor
10 //
12  edm::LogInfo("SiPixelConfigParser") << " Creating SiPixelConfigParser "
13  << "\n";
14 }
15 
17  boost::property_tree::ptree xml;
18  boost::property_tree::read_xml(filename, xml);
19 
20  auto it = xml.find("MonElementConfiguration");
21  if (it == xml.not_found()) {
22  throw cms::Exception("SiPixelConfigParser")
23  << "SiPixelConfigParser XML needs to have a MonElementConfiguration node.";
24  }
25  this->config_ = it->second;
26 }
27 
28 static bool readMEListHelper(boost::property_tree::ptree &config, string const &tagname, vector<string> &me_names) {
29  for (auto &kv : config) {
30  if (kv.first == tagname) {
31  for (auto &mekv : kv.second) {
32  if (mekv.first == "MonElement") {
33  me_names.push_back(mekv.second.get<std::string>("<xmlattr>.name"));
34  }
35  }
36  return true;
37  }
38  }
39  return false;
40 }
41 
42 //
43 // -- Read ME list for the TrackerMap
44 //
45 bool SiPixelConfigParser::getMENamesForTrackerMap(string &tkmap_name, vector<string> &me_names) {
46  tkmap_name = config_.get<std::string>("TkMap.<xmlattr>.name", "");
47  return readMEListHelper(config_, "TkMap", me_names);
48 }
49 //
50 // -- Read Update Frequency for the TrackerMap
51 //
53  u_freq = config_.get<int>("TkMap.<xmlattr>.update_frequency", -1);
54  if (u_freq >= 0)
55  return true;
56  return false;
57 }
58 //
59 // -- Get List of MEs for the module tree plots:
60 //
61 bool SiPixelConfigParser::getMENamesForTree(string &structure_name, vector<string> &me_names) {
62  structure_name = config_.get<std::string>("SummaryPlot.SubStructureLevel.<xmlattr>.name", "");
63  auto it = config_.find("SummaryPlot");
64  if (it == config_.not_found())
65  return false;
66  return readMEListHelper(it->second, "SubStructureLevel", me_names);
67 }
68 //
69 // -- Get List of MEs for the summary plot and the
70 //
71 bool SiPixelConfigParser::getMENamesForBarrelSummary(string &structure_name, vector<string> &me_names) {
72  structure_name = config_.get<std::string>("SummaryPlot.SubStructureBarrelLevel.<xmlattr>.name", "");
73  auto it = config_.find("SummaryPlot");
74  if (it == config_.not_found())
75  return false;
76  return readMEListHelper(it->second, "SubStructureBarrelLevel", me_names);
77 }
78 bool SiPixelConfigParser::getMENamesForEndcapSummary(string &structure_name, vector<string> &me_names) {
79  structure_name = config_.get<std::string>("SummaryPlot.SubStructureEndcapLevel.<xmlattr>.name", "");
80  auto it = config_.find("SummaryPlot");
81  if (it == config_.not_found())
82  return false;
83  return readMEListHelper(it->second, "SubStructureEndcapLevel", me_names);
84 }
85 
86 bool SiPixelConfigParser::getMENamesForFEDErrorSummary(string &structure_name, vector<string> &me_names) {
87  structure_name = config_.get<std::string>("SummaryPlot.SubStructureNonDetId.<xmlattr>.name", "");
88  auto it = config_.find("SummaryPlot");
89  if (it == config_.not_found())
90  return false;
91  return readMEListHelper(it->second, "SubStructureNonDetId", me_names);
92 }
94 // -- Get List of MEs for the summary plot and the
95 //
97  u_freq = config_.get<int>("SummaryPlot.SubStructureBarrelLevel.<xmlattr>.update_frequency", -1);
98  if (u_freq >= 0)
99  return true;
100  return false;
101 }
102 
104  u_freq = config_.get<int>("SummaryPlot.SubStructureEndcapLevel.<xmlattr>.update_frequency", -1);
105  if (u_freq >= 0)
106  return true;
107  return false;
108 }
109 
110 bool SiPixelConfigParser::getMENamesForGrandBarrelSummary(string &structure_name, vector<string> &me_names) {
111  structure_name = config_.get<std::string>("SummaryPlot.SubStructureGrandBarrelLevel.<xmlattr>.name", "");
112  auto it = config_.find("SummaryPlot");
113  if (it == config_.not_found())
114  return false;
115  return readMEListHelper(it->second, "SubStructureGrandBarrelLevel", me_names);
116 }
117 
118 bool SiPixelConfigParser::getMENamesForGrandEndcapSummary(string &structure_name, vector<string> &me_names) {
119  structure_name = config_.get<std::string>("SummaryPlot.SubStructureGrandEndcapLevel.<xmlattr>.name", "");
120  auto it = config_.find("SummaryPlot");
121  if (it == config_.not_found())
122  return false;
123  return readMEListHelper(it->second, "SubStructureGrandEndcapLevel", me_names);
124 }
125 
127  u_freq = config_.get<int>("SummaryPlot.SubStructureGrandBarrelLevel.<xmlattr>.update_frequency", -1);
128  if (u_freq >= 0)
129  return true;
130  return false;
131 }
132 
134  u_freq = config_.get<int>("SummaryPlot.SubStructureGrandEndcapLevel.<xmlattr>.update_frequency", -1);
135  if (u_freq >= 0)
136  return true;
137  return false;
138 }
139 
141  u_freq = config_.get<int>("QTests.QTestMessageLimit.<xmlattr>.value", -1);
142  if (u_freq >= 0)
143  return true;
144  return false;
145 }
146 
148  u_freq = config_.get<int>("Source.SourceType.<xmlattr>.code", -1);
149  if (u_freq >= 0)
150  return true;
151  return false;
152 }
153 
155  u_freq = config_.get<int>("Calib.CalibType.<xmlattr>.value", -1);
156  if (u_freq >= 0)
157  return true;
158  return false;
159 }
SiPixelConfigParser::getCalibType
bool getCalibType(int &u_freq)
Definition: SiPixelConfigParser.cc:154
SiPixelConfigParser.h
ANSIColors.h
MessageLogger.h
SiPixelConfigParser::getSourceType
bool getSourceType(int &u_freq)
Definition: SiPixelConfigParser.cc:147
SiPixelConfigParser::getFrequencyForEndcapSummary
bool getFrequencyForEndcapSummary(int &u_freq)
Definition: SiPixelConfigParser.cc:103
SiPixelConfigParser::getFrequencyForGrandBarrelSummary
bool getFrequencyForGrandBarrelSummary(int &u_freq)
Definition: SiPixelConfigParser.cc:126
SiPixelConfigParser::getMENamesForFEDErrorSummary
bool getMENamesForFEDErrorSummary(std::string &structure_name, std::vector< std::string > &me_names)
Definition: SiPixelConfigParser.cc:86
SiPixelConfigParser::SiPixelConfigParser
SiPixelConfigParser()
Definition: SiPixelConfigParser.cc:11
SiPixelConfigParser::getFrequencyForBarrelSummary
bool getFrequencyForBarrelSummary(int &u_freq)
Definition: SiPixelConfigParser.cc:96
SiPixelConfigParser::getMENamesForTrackerMap
bool getMENamesForTrackerMap(std::string &tkmap_name, std::vector< std::string > &me_names)
Definition: SiPixelConfigParser.cc:45
SiPixelConfigParser::getMENamesForBarrelSummary
bool getMENamesForBarrelSummary(std::string &structure_name, std::vector< std::string > &me_names)
Definition: SiPixelConfigParser.cc:71
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
config
Definition: config.py:1
SiPixelConfigParser::getMENamesForGrandBarrelSummary
bool getMENamesForGrandBarrelSummary(std::string &structure_name, std::vector< std::string > &me_names)
Definition: SiPixelConfigParser.cc:110
SiPixelConfigParser::getFrequencyForTrackerMap
bool getFrequencyForTrackerMap(int &u_freq)
Definition: SiPixelConfigParser.cc:52
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
SiPixelConfigParser::getDocument
void getDocument(std::string filename)
Definition: SiPixelConfigParser.cc:16
SiPixelConfigParser::getMENamesForTree
bool getMENamesForTree(std::string &structure_name, std::vector< std::string > &me_names)
Definition: SiPixelConfigParser.cc:61
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
createPayload.tagname
tagname
Definition: createPayload.py:183
SiPixelConfigParser::getMENamesForGrandEndcapSummary
bool getMENamesForGrandEndcapSummary(std::string &structure_name, std::vector< std::string > &me_names)
Definition: SiPixelConfigParser.cc:118
std
Definition: JetResolutionObject.h:76
SiPixelConfigParser::getMENamesForEndcapSummary
bool getMENamesForEndcapSummary(std::string &structure_name, std::vector< std::string > &me_names)
Definition: SiPixelConfigParser.cc:78
Exception
Definition: hltDiff.cc:245
SiPixelConfigParser::getFrequencyForGrandEndcapSummary
bool getFrequencyForGrandEndcapSummary(int &u_freq)
Definition: SiPixelConfigParser.cc:133
SiPixelConfigParser::getMessageLimitForQTests
bool getMessageLimitForQTests(int &u_freq)
Definition: SiPixelConfigParser.cc:140
readMEListHelper
static bool readMEListHelper(boost::property_tree::ptree &config, string const &tagname, vector< string > &me_names)
Definition: SiPixelConfigParser.cc:28