22 #include <xercesc/util/XMLString.hpp> 23 #include <xercesc/util/TransService.hpp> 38 LOG_INFO <<
"Reading histograms from " <<
config->getBOOKING_XML_FILE();
40 if (
config->getBOOKING_XML_FILE().empty()) {
49 parser.setValidationScheme(XercesDOMParser::Val_Always);
50 parser.setDoNamespaces(
true);
52 parser.setExitOnFirstFatalError(
true);
53 parser.setValidationConstraintFatal(
true);
55 parser.setErrorHandler(&eh);
63 for (XMLSize_t
i = 0;
i < itemList->getLength();
i++) {
65 if (node->getNodeType() != DOMNode::ELEMENT_NODE) {
69 std::string nodeName = XMLString::transcode(node->getNodeName());
95 for (CoHistoProps::iterator it =
d.begin(); it !=
d.end(); it++) {
96 hp[it->first] = it->second;
109 LOG_DEBUG <<
"[Collection::load] loading " <<
prefix <<
"::" <<
name 118 it->second.insert(make_pair(
name,
hp));
127 char* message = XMLString::transcode(
e.getMessage());
132 LOG_INFO <<
i->second.size() <<
" " <<
i->first <<
" histograms defined";
147 for (XMLSize_t
j = 0;
j < props->getLength();
j++) {
149 if (node->getNodeType() != DOMNode::ELEMENT_NODE) {
155 const XMLCh*
content = element->getTextContent();
157 std::istringstream
buffer((
const char*)tc.str());
162 for (XMLSize_t
i = 0;
i < attributes->getLength();
i++) {
163 DOMNode* attribute = attributes->item(
i);
164 std::string aname = XMLString::transcode(attribute->getNodeName());
165 std::string avalue = XMLString::transcode(attribute->getNodeValue());
166 p[
name +
"_" + aname] = avalue;
181 CoHistoProps::const_iterator
i =
h.find(
name);
197 CoHistoProps::const_iterator
i =
h.find(
name);
201 if (EOF == std::sscanf(
i->second.c_str(),
"%d", &
value)) {
216 CoHistoProps::const_iterator
i =
h.find(
name);
220 if (EOF == std::sscanf(
i->second.c_str(),
"%lf", &
value)) {
283 char* stopstring =
nullptr;
285 while (
pos != std::string::npos) {
287 tmp.replace(0,
pos + 1,
"");
288 if (label_pair.find(
'=') != std::string::npos) {
289 int nbin = strtol(label_pair.substr(0, label_pair.find(
'=')).c_str(), &stopstring, 10);
290 std::string label = label_pair.substr(label_pair.find(
'=') + 1, label_pair.length());
291 while (
label.find(
'\'') != std::string::npos) {
306 CoHistoMap::const_iterator
i =
collection.find(
"EMU");
309 for (CoHisto::const_iterator
j = hs.begin();
j != hs.end();
j++) {
328 CoHistoMap::const_iterator
i =
collection.find(
"FED");
331 for (CoHisto::const_iterator
j = hs.begin();
j != hs.end();
j++) {
350 CoHistoMap::const_iterator
i =
collection.find(
"DDU");
353 for (CoHisto::const_iterator
j = hs.begin();
j != hs.end();
j++) {
373 CoHistoMap::const_iterator
i =
collection.find(
"CSC");
376 for (CoHisto::const_iterator
j = hs.begin();
j != hs.end();
j++) {
384 int from = 0,
to = 0;
387 for (
int k = from;
k <=
to;
k++) {
407 CoHistoMap::const_iterator
i =
collection.find(
"CSC");
409 CoHisto::const_iterator
j =
i->second.find(
h::names[hid]);
410 if (
j !=
i->second.end()) {
429 if (!
config->needBookMO(
h.getFullPath())) {
430 LOG_INFO <<
"MOFilter excluded " <<
name <<
" from booking";
436 double d1, d2, d3, d4, d5, d6;
441 throw Exception(
"Histogram does not have type!");
458 }
else if (
type ==
"h2") {
470 }
else if (
type ==
"h3") {
485 }
else if (
type ==
"hp") {
503 }
else if (
type ==
"hp2") {
519 throw Exception(
"Can not book histogram with type: " +
type);
524 TH1* th =
me->getTH1Lock();
528 s =
h.processTitle(
s);
530 me->setAxisTitle(
s, 1);
535 s =
h.processTitle(
s);
537 me->setAxisTitle(
s, 2);
542 s =
h.processTitle(
s);
544 me->setAxisTitle(
s, 3);
548 th->SetOption(
s.c_str());
553 std::map<int, std::string>
labels;
555 th->GetXaxis()->SetNoAlphanumeric();
556 for (std::map<int, std::string>::iterator l_itr =
labels.begin(); l_itr !=
labels.end(); ++l_itr) {
557 th->GetXaxis()->SetBinLabel(l_itr->first, l_itr->second.c_str());
561 std::map<int, std::string>
labels;
563 th->GetYaxis()->SetNoAlphanumeric();
564 for (std::map<int, std::string>::iterator l_itr =
labels.begin(); l_itr !=
labels.end(); ++l_itr) {
565 th->GetYaxis()->SetBinLabel(l_itr->first, l_itr->second.c_str());
569 std::vector<std::string>
v;
571 th->LabelsOption(
v[0].c_str(),
v[1].c_str());
575 std::vector<std::string>
v;
577 th->SetLabelSize((
double)atof(
v[0].c_str()),
v[1].c_str());
581 std::vector<std::string>
v;
583 th->SetTitleOffset((
double)atof(
v[0].c_str()),
v[1].c_str());
591 th->SetNdivisions(
i1,
"X");
592 th->GetXaxis()->CenterLabels(
true);
595 th->SetNdivisions(
i1,
"Y");
596 th->GetYaxis()->CenterLabels(
true);
599 th->SetTickLength(
d1,
"X");
601 th->SetTickLength(
d1,
"Y");
603 th->SetLabelSize(
d1,
"X");
605 th->SetLabelSize(
d1,
"Y");
607 th->SetLabelSize(
d1,
"Z");
609 reinterpret_cast<TProfile*
>(th)->SetErrorOption(
s.c_str());
614 LOG_DEBUG <<
"[Collection::book] booked " <<
h.getFullPath() <<
" (" <<
me <<
")";
626 CoHistoMap::const_iterator
i =
collection.find(
"CSC");
629 CoHisto::const_iterator
j = hs.find(
name);
643 std::ostringstream
buffer;
645 buffer << hdmi->first <<
" [" << std::endl;
646 for (CoHisto::const_iterator hdi = hdmi->second.begin(); hdi != hdmi->second.end(); hdi++) {
647 buffer <<
" " << hdi->first <<
" [" << std::endl;
648 for (CoHistoProps::const_iterator
hi = hdi->second.begin();
hi != hdi->second.end();
hi++) {
649 buffer <<
" " <<
hi->first <<
" = " <<
hi->second << std::endl;
651 buffer <<
" ]" << std::endl;
653 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[]
static const HistoName names[]
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[]
const bool isOnDemand(const HistoName &name) const
Check if the histogram is on demand (by histogram name)
static const char XML_BOOK_DEFINITION_REF[]
static const char XML_BOOK_HISTOGRAM[]
xercesc::DOMDocument DOMDocument
void bookEMUHistos() const
Book EMU histograms.
static bool regexMatch(const std::string &expression, const std::string &message)
Match RegExp expression string against string message and return result.
#define XERCES_CPP_NAMESPACE_QUALIFIER
void printCollection() const
Print collection of available histograms and their parameters.
CSC Level Histogram Type.
Collection(Configuration *const p_config)
Constructor.
CSCDQM Framework Global Configuration.
static const char XML_BOOK_HISTO_PREFIX[]
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.
void book(const HistoDef &h, const CoHistoProps &p, const std::string &folder) const
Book histogram.
xercesc::DOMElement DOMElement
EMU Level Histogram Definition.
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.
void bookDDUHistos(const HwId dduId) const
Book DDU histograms.
static const char XML_BOOK_ONDEMAND_TRUE[]
xercesc::XercesDOMParser XercesDOMParser
std::map< std::string, CoHistoProps > CoHisto
static const int DEF_HISTO_COLOR
static const char XML_BOOK_DEFINITION[]
FED Level Histogram Definition.
void bookFEDHistos(const HwId fedId) const
Book FED histograms.
xercesc::DOMNamedNodeMap DOMNamedNodeMap
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[]
static const char XML_BOOK_HISTO_TITLE[]
void bookCSCHistos(const HwId crateId, const HwId dmbId) const
Book Chamber Histograms.
static const int ParseAxisLabels(const std::string &s, std::map< int, std::string > &labels)
Parse Axis label string and return values in vector.
static constexpr float d1
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
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.
xercesc::XMLException XMLException