38 LOG_INFO <<
"Reading histograms from " <<
config->getBOOKING_XML_FILE();
40 if (
config->getBOOKING_XML_FILE().empty()) {
46 XMLPlatformUtils::Initialize();
52 parser.setValidationScheme(XercesDOMParser::Val_Always);
53 parser.setDoNamespaces(
true);
54 parser.setDoSchema(
true);
55 parser.setExitOnFirstFatalError(
true);
56 parser.setValidationConstraintFatal(
true);
58 parser.setErrorHandler(&eh);
60 parser.parse(
config->getBOOKING_XML_FILE().c_str());
67 for (uint32_t
i = 0;
i < itemList->getLength();
i++) {
70 if (node->getNodeType() != DOMNode::ELEMENT_NODE) {
continue; }
72 std::string nodeName = XMLString::transcode(node->getNodeName());
84 definitions.insert(make_pair(
id, dp));
99 for (CoHistoProps::iterator it = d.begin(); it != d.end(); it++) {
100 hp[it->first] = it->second;
112 LOG_DEBUG <<
"[Collection::load] loading " << prefix <<
"::" << name <<
" XML_BOOK_ONDEMAND = " << hp[
XML_BOOK_ONDEMAND];
114 CoHistoMap::iterator it =
collection.find(prefix);
120 it->second.insert(make_pair(name, hp));
128 XMLPlatformUtils::Terminate();
131 char*
message = XMLString::transcode(e.getMessage());
136 LOG_INFO <<
i->second.size() <<
" " <<
i->first <<
" histograms defined";
150 for(uint32_t
j = 0;
j < props->getLength();
j++) {
152 if (node->getNodeType() != DOMNode::ELEMENT_NODE) {
continue; }
153 std::string
name = XMLString::transcode(node->getNodeName());
154 std::string
value = XMLString::transcode(node->getTextContent());
157 for (uint32_t
i = 0;
i < attributes->getLength();
i++) {
158 DOMNode* attribute = attributes->item(
i);
159 std::string aname = XMLString::transcode(attribute->getNodeName());
160 std::string avalue = XMLString::transcode(attribute->getNodeValue());
161 p[name +
"_" + aname] = avalue;
176 CoHistoProps::const_iterator
i = h.find(name);
192 CoHistoProps::const_iterator
i = h.find(name);
196 if(EOF == std::sscanf(i->second.c_str(),
"%d", &
value)) {
211 CoHistoProps::const_iterator
i = h.find(name);
215 if(EOF == std::sscanf(i->second.c_str(),
"%lf", &
value)) {
275 char* stopstring =
NULL;
277 while (pos != std::string::npos) {
278 std::string label_pair = tmp.substr(0, pos);
279 tmp.replace(0, pos + 1,
"");
280 if (label_pair.find(
"=") != std::string::npos) {
281 int nbin = strtol(label_pair.substr(0, label_pair.find(
"=")).c_str(), &stopstring, 10);
282 std::string
label = label_pair.substr(label_pair.find(
"=") + 1, label_pair.length());
283 while (label.find(
"\'") != std::string::npos) {
284 label.erase(label.find(
"\'"), 1);
286 labels[nbin] =
label;
290 return labels.size();
298 CoHistoMap::const_iterator
i =
collection.find(
"EMU");
301 for (CoHisto::const_iterator
j = hs.begin();
j != hs.end();
j++) {
320 CoHistoMap::const_iterator
i =
collection.find(
"DDU");
323 for (CoHisto::const_iterator
j = hs.begin();
j != hs.end();
j++) {
343 CoHistoMap::const_iterator
i =
collection.find(
"CSC");
346 for (CoHisto::const_iterator
j = hs.begin();
j != hs.end();
j++) {
356 for (
int k = from;
k <=
to;
k++) {
376 CoHistoMap::const_iterator
i =
collection.find(
"CSC");
378 CoHisto::const_iterator
j = i->second.find(
h::names[hid]);
379 if (j != i->second.end()) {
381 book(hdef, j->second,
config->getFOLDER_CSC());
400 LOG_INFO <<
"MOFilter excluded " << name <<
" from booking";
406 double d1, d2, d3, d4, d5, d6;
469 throw Exception(
"Can not book histogram with type: " +
type);
502 std::map<int, std::string>
labels;
504 for (std::map<int, std::string>::iterator l_itr = labels.begin(); l_itr != labels.end(); ++l_itr) {
505 th->GetXaxis()->SetBinLabel(l_itr->first, l_itr->second.c_str());
509 std::map<int, std::string>
labels;
511 for (std::map<int, std::string>::iterator l_itr = labels.begin(); l_itr != labels.end(); ++l_itr) {
512 th->GetYaxis()->SetBinLabel(l_itr->first, l_itr->second.c_str());
516 std::vector<std::string>
v;
518 th->LabelsOption(v[0].c_str(), v[1].c_str());
522 std::vector<std::string>
v;
524 th->SetLabelSize((
double) atof(v[0].c_str()), v[1].c_str());
528 std::vector<std::string>
v;
530 th->SetTitleOffset((
double) atof(v[0].c_str()), v[1].c_str());
536 th->SetNdivisions(i1,
"X");
537 th->GetXaxis()->CenterLabels(
true);
540 th->SetNdivisions(i1,
"Y");
541 th->GetYaxis()->CenterLabels(
true);
543 if(
checkHistoValue(p,
"SetTickLengthX", d1)) th->SetTickLength(d1,
"X");
544 if(
checkHistoValue(p,
"SetTickLengthY", d1)) th->SetTickLength(d1,
"Y");
548 if(
checkHistoValue(p,
"SetErrorOption", s))
reinterpret_cast<TProfile*
>(th)->SetErrorOption(s.c_str());
554 LOG_DEBUG <<
"[Collection::book] booked " << h.
getFullPath() <<
" (" << me <<
")";
567 CoHistoMap::const_iterator
i =
collection.find(
"CSC");
570 CoHisto::const_iterator
j = hs.find(name);
585 std::ostringstream buffer;
587 buffer << hdmi->first <<
" [" << std::endl;
588 for(CoHisto::const_iterator hdi = hdmi->second.begin(); hdi != hdmi->second.end(); hdi++) {
589 buffer <<
" " << hdi->first <<
" [" << std::endl;
590 for(CoHistoProps::const_iterator hi = hdi->second.begin(); hi != hdi->second.end(); hi++) {
591 buffer <<
" " << hi->first <<
" = " << hi->second << std::endl;
593 buffer <<
" ]" << std::endl;
595 buffer <<
" ]" << std::endl;
static const bool getHistoIdByName(const std::string &p_name, HistoId &p_id)
Get Histogram ID by name.
static const char XML_BOOK_DEFINITION_ID[]
static const char XML_BOOK_ONDEMAND_FALSE[]
static const char XML_BOOK_HISTO_TYPE[]
static const char XML_BOOK_NAME_FROM[]
virtual const std::string processTitle(const std::string &p_title) const
Process Title by Adding appropriate ID.
void bookEMUHistos() const
Book EMU histograms.
Monitoring Object interface used to cover Root object and provide common interface to EventProcessor ...
Abstract Base Histogram Definition.
static const char XML_BOOK_NAME_TO[]
static const char XML_BOOK_ONDEMAND[]
static const char XML_BOOK_DEFINITION_REF[]
static const char XML_BOOK_HISTOGRAM[]
xercesc::DOMDocument DOMDocument
const bool isOnDemand(const HistoName &name) const
Check if the histogram is on demand (by histogram name)
static bool regexMatch(const std::string &expression, const std::string &message)
Match RegExp expression string against string message and return result.
CSC Level Histogram Type.
Collection(Configuration *const p_config)
Constructor.
CSCDQM Framework Global Configuration.
static const char XML_BOOK_HISTO_PREFIX[]
virtual TH1 * getTH1Lock(void)=0
static void getNodeProperties(DOMNode *&node, CoHistoProps &hp)
Extract and write single histogram properties from XML node to map.
static std::string & getHistoValue(const CoHistoProps &h, const std::string &name, std::string &value, const std::string &def_value="")
Find string histogram value in map.
xercesc::DOMElement DOMElement
EMU Level Histogram Definition.
const bool needBookMO(const std::string name) const
Check if MO is not excluded by MO Filter.
void load()
Load XML file and fill definition map(s)
static const bool checkHistoValue(const CoHistoProps &h, const std::string &name, std::string &value)
Find string histogram value in map.
xercesc::DOMNodeList DOMNodeList
DDU Level Histogram Definition.
boost::function< MonitorObject *(const HistoBookRequest &) > fnBook
static const char XML_BOOK_ONDEMAND_TRUE[]
xercesc::XercesDOMParser XercesDOMParser
static std::string from(" from ")
std::map< std::string, CoHistoProps > CoHisto
static const int DEF_HISTO_COLOR
static const char XML_BOOK_DEFINITION[]
void bookDDUHistos(const HwId dduId) const
Book DDU histograms.
void book(const HistoDef &h, const CoHistoProps &p, const std::string &folder) const
Book histogram.
xercesc::DOMNamedNodeMap DOMNamedNodeMap
std::vector< std::vector< double > > tmp
boost::function< void(const HistoDef &histoT, MonitorObject *&) > fnPutHisto
const std::string getFullPath() const
Get full path of the histogram. It is being constructed by appending path and histogam name...
virtual const std::string getName() const
Get processed histogram name. It can include additional parameter in formated name. This Name is being constructed from raw name and additional parameter.
void bookCSCHistos(const HwId crateId, const HwId dmbId) const
Book Chamber Histograms.
static const TPRegexp REGEXP_ONDEMAND("^.*%d.*$")
Takes care of errors and warnings while parsing XML files file in XML format.
static const char XML_BOOK_HISTO_NAME[]
void printCollection() const
Print collection of available histograms and their parameters.
static const char XML_BOOK_HISTO_TITLE[]
virtual void SetMaximum(const double d)=0
static const int ParseAxisLabels(const std::string &s, std::map< int, std::string > &labels)
Parse Axis label string and return values in vector.
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
static const HistoName names[]
std::map< std::string, std::string > CoHistoProps
static int tokenize(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")
Break string into tokens.
virtual void setAxisTitle(const std::string title, const int axisN)=0
xercesc::XMLException XMLException